본문으로 바로가기

[RHEL8] KVM virsh install 샘플

category Cloud/KVM 2021. 10. 29. 19:12
반응형

RHEL8에서 virsh 명령어를 사용하여 일반적으로 설치하는 방법과 터미널에서 text로 설치하는 방법, 그리고 기 구성한 qcow2로 생성하는 명령어에 대한 샘플입니다.

 

 

1. ISO 이미지를 사용하여 virt-manager gui를 통해 설치할 때 (일반적인 방법)

virt-install \
--name test \
--ram 2048 \
--vcpus 2 \
--disk path=/var/lib/libvirt/images/test.qcow2,size=20 \
--os-variant rhel8.4 \
--os-type linux \
--network bridge=br-mgmt \
--graphics none \
--console pty,target_type=serial \
--location /root/os-images/rhel-8.4-x86_64-dvd.iso \
--graphics=vnc

 

명령어를 실행하면, VM이 생성되고 설치 후 재기동 또는 전원을 내리지 않는 이상 터미널이 유지가 됩니다.

 

 

 

2. ISO 이미지를 사용하여 터미널에서 console로 설치하는 방법

해당 방법으로 할 경우 OS설치 후 VM에 Display VNC Hardware를 추가해야만 virt-manager에서 해당 VM의 GUI를 볼 수 있습니다.

virt-install \
--name test \
--ram 2048 \
--vcpus 2 \
--disk path=/var/lib/libvirt/images/test.qcow2,size=20 \
--os-variant rhel8.4 \
--os-type linux \
--network bridge=br-mgmt \
--graphics none \
--console pty,target_type=serial \
--location /root/os-images/rhel-8.4-x86_64-dvd.iso \
--extra-args 'console=ttyS0,115200n8 serial'

 

아래와 같이 SSH 터미널에서 VM에 console 접속하여 설치하는 것 처럼 텍스트로 설치를 진행할 수 있습니다.

 

단, 앞에서 말했듯이 virt-manager를 통해서 GUI를 볼 수 없습니다.

 

아래 방법으로 Display VNC를 추가해주면 됩니다.

 

 

3. qcow2를 통한 VM 생성방법

OS가 이미 설치된 qcow2파일을 가지고 VM을 생성하는 방법입니다.

virt-install \
--name test \
--ram 2048 \
--vcpus 2 \
--import \
--disk path=/root/centos7.0.qcow2 \
--os-variant rhel8.4 \
--os-type linux \
--network bridge=br-mgmt \
--graphics none \
--console pty,target_type=serial \
--graphics=vnc

 

 

아래와 같이 qcow2를 가지고 VM이 생성됩니다.

728x90