1.下载对于Centos版本的云镜像
2.查看镜像格式,镜像格式由qcow2转换成raw
qemu-img info CentOS-7-x86_64-GenericCloud-2009.qcow2 qemu-img convert -f CentOS-7-x86_64-GenericCloud-2009.qcow2 Centos7.9.raw |
3. virt-sysgrep修改登录密码
virt-sysprep --root-password password:111-a CentOS7.9.raw |
4.KVM系统中启动虚拟机
virt-install --name=Centos7.9 --ram=4096 --vcpus=8 --disk path=/root/iso/CentOS7.9.raw,size=8,format=raw --boot hd --network bridge=br0 --vnc --vncport=46041 --vnclisten=0.0.0.0 --accelerate --hvm --noautoconsole |
5.通过VNC进入系统
6.更改cloud-init用户名
LINUX: root@ubuntu18:~# vi /etc/cloud/cloud.cfg
system_info: # This will affect which distro class gets used distro: ubuntu # Default user name + that default users groups (if added/used) default_user: name: centosxxx #修改想要的用户名 lock_passwd: True gecos: Ubuntu groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video] sudo: ["ALL=(ALL) NOPASSWD:ALL"] #配置权限 shell: /bin/bash
systemctl restart cloud-init systemctl enable cloud-init |
7. 删除 默认用户
cd /home
userdel -r centos |

4500

被折叠的 条评论
为什么被折叠?



