Centos 9 KVM虚拟机部署

1、部署软件

#安装Web-UI服务管理工具cockpit
dnf -y install cockpit
#安装KVM
dnf install qemu-kvm libvirt libvirt-daemon virt-install virt-manager libvirt-dbus
#启动服务
systemctl start libvirtd.service
#设置开机自启cockpit
systemctl enable --now cockpit.socket

查看启动的服务和端口

netstat -ntpl
#看到9090说明cockpit启动了
http://xx.xx.xx.xx:9090
#网页可以访问了

2、配置

默认不支持root用户登陆的,需要修改对应的配置。 CentOS Srream9 Cockpit 开启root用户远程登录open in new window权限 解决方法:

#把配置里root加#注释掉,重启cockpit服务即可,这样就可以用root登录了,安全起见不要用root登录

vim /etc/cockpit/disallowed-users

# List of users which are not allowed to login to Cockpit
# root

访问成功后添加网桥

进入添加网桥之后,名称自己修改,端口设置为自己的网卡名称

QEMU虚拟机的配置文件

进入到该配置文件中修改为root

vim /etc/libvirt/qemu.conf
#去掉下面#并把用户组和用户改成root
user = "root"
group = "root"

最后

在网页中创建虚拟主机,在左边的菜单栏中找到“应用程序”下载虚拟主机

3、挂载windows共享目录

方便安装相关系统镜像

#挂载
mount -t cifs -o username=administrator,password=xxxx //1.2.2.9/xx /dada/ioo