문서의 이전 판입니다!
해당 문서는 KVM 에 배포할 redhat qcow guest image 생성하는 방법을 작성한 문서 입니다.
### 2021.08.02 RHEL8 관련 내용 추가
참고 : RHEL 8 guest image 생성시 호스트 서버가 RHEL8 이여야 한다. url : https://access.redhat.com/solutions/4073061
Red Hat Enterprise Linux KVM Guest Images 다운로드
# 참고 url : https://access.redhat.com/solutions/894123
KVM Guest Images 편집
패키지 설치 및 서비스 구동
# yum -y install libguestfs-tools # yum -y install guestfish # systemctl start libvirtd
guest image 편집
root 패스워드 변경
## rhel-server-7.9-x86_64-kvm.qcow2 이미지 있는 경로로 이동 후 작업 # virt-customize -a rhel-server-7.9-x86_64-kvm.qcow2 --root-password password:<패스워드 입력> [ 0.0] Examining the guest ... [ 5.3] Setting a random seed [ 5.4] Setting the machine ID in /etc/machine-id [ 5.4] Setting passwords [ 7.0] Finishing off
필요한 패키지 설치 방법
# virt-customize -a rhel-server-7.9-x86_64-kvm.qcow2 --install httpd,vim
기타 리눅스 설정 파일 수정 방법
## timezone 변경 방법 # virt-customize -a rhel-server-7.9-x86_64-kvm.qcow2 --run-command "rm -rf /etc/localtime" # virt-customize -a rhel-server-7.9-x86_64-kvm.qcow2 --run-command "ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime" ## RHEL8 timezone 변경 방법 # virt-customize -a rhel-8.4-x86_64-kvm.qcow2 --timezone "Asia/Seoul" ## repository 추가 방법 # virt-customize -a rhel-server-7.9-x86_64-kvm.qcow2 --copy-in [로컬파일]:[넣을 경로]
RHEL8 Guest Image 생성 안되는 현상
## RHEL7 기반에서 RHEL8 Guest Image 편집 시 아래와 같은 문구가 발생 하면서 편집이 안됨
# virt-customize -a rhel-8.4.qcow2 --root-password password:SomePassword12345!
virt-customize: warning: mount: mount exited with status 32: mount: wrong
fs type, bad option, bad superblock on /dev/sda1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so. (ignored)
virt-customize: error: libguestfs error: is_dir: is_dir_stub: you must call
'mount' first to mount the root filesystem
If reporting bugs, run virt-customize with debugging enabled and include
the complete output:
virt-customize -v -x [...]
## 해결
RHEL7 기반 호스트 에서 RHEL8 GuestImage 생성 할 수 없다.
RHEL8 기반 호스트 에서 이미지 편집을 해야 한다.
또한 virt-customize 로만 편집이 가능하며, 기존에 추가적으로 이미지 생성에 사용한 guestfish 는 더이상 지원하지 않는다.