kvm virt-customize工具使用:

安装virt-customize
yum -y install libguestfs-tools
修改qcow2镜像密码:

(undercloud) [stack@undercloud ~]$ virt-customize -a overcloud-full.qcow2 --root-password password:99cloud
[  0.0] Examining the guest ...
[  49.7] Setting a random seed
[  50.0] Setting passwords
[  71.8] Finishing off

出现以下报错时,执行以下命令:
[root@kolla ~]# virt-customize -a CentOS7.6.qcow2 --root-password password:99cloud
[   0.0] Examining the guest ...
virt-customize: error: libguestfs error: could not create appliance through 
libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: Cannot access storage file 
'/root/CentOS7.6.qcow2' (as uid:107, gid:107): Permission denied [code=38 
int1=13]

If reporting bugs, run virt-customize with debugging enabled and include 
the complete output:

virt-customize -v -x [...]
执行如下:
[root@kolla ~]# export LIBGUESTFS_BACKEND=direct

为qcow2镜像安装软件包并注入自己的ssh key,如下:

virt-customize -a overcloud-full.qcow2 --install epel-release --ssh-inject centos:string:"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKCqX6EZIrGHoGaMII4QAqr0QC72t+Kg/c5ZIRNTMb6Q+BwzejQgjhBTXeyPnp0rfE9XI4pTxkZqAUOGSK9Bfqg= smiller@bruckner"

为qcow2镜像安装多个软件包,如下:

virt-customize -a overcloud-full.qcow2 --install [vim,bash-completion,wget,curl,telnet,unzip]
[   0.0] Examining the guest ...
[   2.1] Setting a random seed
[   2.1] Installing packages: [vim bash-completion wget curl telnet unzip]
[ 563.2] Finishing off
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值