728x90
virt-customize를 사용하여 glance image 수정 방법
- libguestfs-tools-c 패키지 설치
# yum install -y libguestfs-tools-c
- index.html 생성
$ vi /tmp/index.html
hello
# virt-customize 명령으로 아래 작업 수행
- repository 파일 업로드
- index.html 파일 업로드
- httpd 패키지 설치
- httpd 서비스 자동 활성화
- httpd 서비스 시작
- root 계정 패스워드 설정 : test1234
- selinux 리라벨링
-> qcow2 내부의 repository 설정이 되어 있어야 yum 으로 패키지 설치 가능함
$ virt-customize -a /tmp/rhel7.qcow2 \
--upload /tmp/rhosp.repo:/etc/yum.repos.d/rhosp.repo \
--upload /tmp/index.html:/var/www/html/index.html \
--install httpd \
--run-command 'systemctl enable httpd' \
--run-command 'systemctl start httpd' \
--root-password password:test1234 \
--selinux-relabel
[ 0.0] Examining the guest ...
[ 43.2] Setting a random seed
[ 43.5] Uploading: rhosp.repo to /etc/yum.repos.d/rhosp.repo
[ 43.8] Uploading: index.html to /var/www/html/index.html
[ 44.0] Installing packages: httpd
[ 76.4] Running: systemctl enable httpd
[ 78.4] Running: systemctl start httpd
[ 80.0] Setting passwords
[ 104.4] SELinux relabelling
[ 307.0] Finishing off
# virt-customize 명령어 옵션
virt-customize
[ -a disk.img [ -a disk.img ... ] | -d domname ]
[--attach ISOFILE] [--attach-format FORMAT]
[ -c URI | --connect URI ] [ -n | --dry-run ]
[ --format FORMAT] [ -m MB | --memsize MB ]
[ --network | --no-network ]
[ -q | --quiet ] [--smp N] [ -v | --verbose ] [-x]
[--append-line FILE:LINE] [--chmod PERMISSIONS:FILE]
[--commands-from-file FILENAME] [--copy SOURCE:DEST]
[--copy-in LOCALPATH:REMOTEDIR] [--delete PATH] [--edit FILE:EXPR]
[--firstboot SCRIPT] [--firstboot-command 'CMD+ARGS']
[--firstboot-install PKG,PKG..] [--hostname HOSTNAME]
[--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR]
[--move SOURCE:DEST] [--password USER:SELECTOR]
[--root-password SELECTOR] [--run SCRIPT]
[--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR]
[--sm-register] [--sm-remove] [--sm-unregister]
[--ssh-inject USER[:SELECTOR]] [--truncate FILE]
[--truncate-recursive PATH] [--timezone TIMEZONE] [--touch FILE]
[--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
[--write FILE:CONTENT] [--no-logfile]
[--password-crypto md5|sha256|sha512] [--selinux-relabel]
[--sm-credentials SELECTOR]
virt-customize [ -V | --version ]
반응형
'Openstack' 카테고리의 다른 글
KVM vs QEMU (0) | 2021.06.05 |
---|---|
instance의 interface, mac 정보 조회 (0) | 2021.05.28 |
RHOSP13 - 500노드 이상 배포 시 디렉터 튜닝 (0) | 2021.05.26 |
horizon - multiple domain enable (0) | 2021.05.26 |
redis password 확인 (0) | 2021.05.26 |