it编程 > 硬件开发 > 硬件工程

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

68人参与 2024-08-06 硬件工程

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. 在网页中创建虚拟主机,在左边的菜单栏中找到“应用程序”下载虚拟主机

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

(0)
打赏 微信扫一扫 微信扫一扫

您想发表意见!!点此发布评论

推荐阅读

云计算基础-虚拟化概述

08-06

【云原生|云计算系列】云计算基础概念

08-06

【教程4>第1章>第2节】Vivado工程移植到Quartus

08-06

分布式计算 第五章 大数据多机计算:Hadoop

08-05

阿里云OS Copilot:解锁操作系统运维与编程的智能助手

08-04

在 Raspberry Pi 上运行语音识别和 LLaMA-2 GPT Whisper ASR 和 LLaMA-2 GPT 模型的完全离线使用

08-04

猜你喜欢

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论