CentOS9 Kvm的部署和安装虚拟机中安装虚拟主机

Kvm的部署和安装虚拟机中安装虚拟主机

  1. 首先部署kvm前提条件:

CPU: 8核

内存:8G

硬盘:128G

服务器硬件支持虚拟化(CPU支持)

参考文档  https://support.huawei.com/enterprise/zh/doc/EDOC1100318044/c887b2ca

2.第二步yum安装下载cockpit

yum -y install cockpit

yum install qemu-kvm libvirt libvirt-daemon virt-install virt-manager libvirt-dbus

systemctl start libvirtd.service

3.设置开机自启动

systemctl enable --now cockpit.socket

4.查看启动的进程端口号为:9090

[root@localhost ~]# netstat -ntpl

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    

tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      938/sshd: /usr/sbin

tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      36253/dnsmasq       

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      937/cupsd           

tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN      2841/sshd: root@pts

tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      2775/sshd: root@pts

tcp        0      0 127.0.0.1:6012          0.0.0.0:*               LISTEN      36705/sshd: root@pt

tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           

tcp6       0      0 :::22                   :::*                    LISTEN      938/sshd: /usr/sbin

tcp6       0      0 ::1:6012                :::*                    LISTEN      36705/sshd: root@pt

tcp6       0      0 ::1:6010                :::*                    LISTEN      2775/sshd: root@pts

tcp6       0      0 ::1:6011                :::*                    LISTEN      2841/sshd: root@pts

tcp6       0      0 :::9090                 :::*                    LISTEN      1/systemd           

tcp6       0      0 ::1:631                 :::*                    LISTEN      937/cupsd     

      

  1. 输入本机IP地址加端口访问网页,进行登录

192.168.8.73:9090/

6.进入下面配置文件中注释root用户,登录成功

cat /etc/cockpit/disallowed-users

7.访问成功后,添加网桥

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

8.添加和本机相同的镜像,镜像到虚拟机的根目录下

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

vim /etc/libvirt/qemu.conf

9.需要改镜像的属组和主

chown -R root CentOS-Stream-9-latest-x86_64-dvd1.iso

[root@localhost ~]# ll

总用量 9840648

-rw-r--r--. 1 root root        1305  1月 26 15:53 1.sh

drwxr-xr-x. 2 root root           6  1月 26 15:45 公共

drwxr-xr-x. 2 root root           6  1月 26 15:45 模板

drwxr-xr-x. 2 root root           6  1月 26 15:45 视频

drwxr-xr-x. 2 root root           6  1月 26 15:45 图片

drwxr-xr-x. 2 root root           6  1月 26 15:45 文档

drwxr-xr-x. 2 root root           6  1月 26 15:45 下载

drwxr-xr-x. 2 root root           6  1月 26 15:45 音乐

drwxr-xr-x. 2 root root           6  1月 26 15:45 桌面

-rw-------. 1 root root        1053  1月 26 15:44 anaconda-ks.cfg

-rw-r--r--. 1 root root 10076815360  1月 26 16:26 CentOS-Stream-9-latest-x86_64-dvd1.iso

9.修改镜像的权限命令如下:

chmod 700 CentOS-Stream-9-latest-x86_64-dvd1.iso

[root@localhost ~]# ll

总用量 9840648

-rw-r--r--. 1 root root        1305  1月 26 15:53 1.sh

drwxr-xr-x. 2 root root           6  1月 26 15:45 公共

drwxr-xr-x. 2 root root           6  1月 26 15:45 模板

drwxr-xr-x. 2 root root           6  1月 26 15:45 视频

drwxr-xr-x. 2 root root           6  1月 26 15:45 图片

drwxr-xr-x. 2 root root           6  1月 26 15:45 文档

drwxr-xr-x. 2 root root           6  1月 26 15:45 下载

drwxr-xr-x. 2 root root           6  1月 26 15:45 音乐

drwxr-xr-x. 2 root root           6  1月 26 15:45 桌面

-rw-------. 1 root root        1053  1月 26 15:44 anaconda-ks.cfg

-rwx------. 1 root root 10076815360  1月 26 16:26 CentOS-Stream-9-latest-x86_64-dvd1.iso

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

【总结】到这里就部署完成了。

  • 28
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值