虚拟化1-创建虚拟机

虚拟化1—虚拟机的创建

需要安装的包

dnf module install virt -y
dnf install virt-install virt-viewer -y
dnf install cockpit -y
dnf install cockpit-machines -y

虚拟机镜像

可以前往官网下载:https://www.redhat.com/zh

产品页面:https://www.redhat.com/zh/technologies/linux-platforms/enterprise-linux

方法一:在文本环境下创建虚拟机

一、启动服务

systemctl start libvirtd

二、关闭客户机

shutdown -h now

在这里插入图片描述

三、检查

virt-host-validate

查看是否支持,需要确保没有FAIL的结果,WARN的根据情况决定 。

[root@kittod ~]# virt-host-validate 
QEMU: Checking for hardware virtualization : 
FAIL (Only emulated CPUs are available, performance will be significantly 
limited) 
QEMU: Checking if device /dev/vhost-net exists : 
PASS
QEMU: Checking if device /dev/net/tun exists : 
PASS
QEMU: Checking for cgroup 'cpu' controller support : 
PASS
QEMU: Checking for cgroup 'cpuacct' controller support : 
PASS
QEMU: Checking for cgroup 'cpuset' controller support : 
PASS
QEMU: Checking for cgroup 'memory' controller support : 
PASS
QEMU: Checking for cgroup 'devices' controller support : 
PASS
QEMU: Checking for cgroup 'blkio' controller support : 
PASS 
WARN (Unknown if this platform has IOMMU support) 
QEMU: Checking for secure guest support : 
WARN (Unknown if this platform has Secure Guest support) 

出现该图情况表示可以开始下一步,创建虚拟机了
在这里插入图片描述

四、文本环境下创建虚拟机

virt-install --name demo-guest1 --memory 1024 --vcpus 2 --disk size=20 --os-variant rhel8.0 --location /iso/rhel-server-8.2-x86_64-dvd.iso --graphics none --extra-args='console=ttyS0'
命令 含义
virt-install
–name demo-guest1 虚拟机名称
–memory 2048 虚拟机内存大小
–vcpus 2 虚拟机cpu个数
–disk size=20 虚拟机磁盘大小 单位G
–os-variant rhel8.0 虚拟机版本
–location /iso/rhel-server-8.2-x86_64-dvd.iso 需要安装镜像路径
–graphics none 不需要图形化
–extra-args=‘console=ttyS0’ 将虚拟安装的窗口画面传递到当前的画面上来
注意事项:

如果 virt-install 失败并显示 cannot find default network 错误:

确定安装了 libvirt-daemon-config-network 软件包:

dnf info libvirt-daemon-config-network

在这里插入图片描述

验证 libvirt 默认网络是否活跃,并配置为自动启动:

virsh net-list --all
[root@kittod ~]# virsh net-list --all 

Name State Autostart Persistent 

-------------------------------------------- 

default active yes yes 

# 如果没有,激活默认网络并将其设置为 auto-start: 

[root@kittod ~]# virsh net-autostart default 

Network default marked as autostarted 

[root@kittod ~]# virsh net-start default 

在这里插入图片描述


================================================================================
================================================================================
Installation

1) [x] Language settings                 2) [x] Time settings
       (English (United States))                (America/New_York timezone)
3) [!] Installation source               4) [!] Software selection
       (Processing...)                          (Processing...)
5) [!] Installation Destination          6) [x] Kdump
       (No disks selected)                      (Kdump is enabled)
7) [ ] Network configuration             8) [!] Root password
       (Not connected)                          (Password is not set.)
9) [!] User creation
       (No user will be created)

Please make a selection from the above ['b' to begin installation, 'q' to quit,
'r' to refresh]: r
================================================================================
================================================================================
Installation

1) [x] Language settings                 2) [x] Time settings
       (English (United States))                (America/New_York timezone)
3) [x] Installation source               4) [x] Software selection
       (Local media)                            (Server with GUI)
5) [!] Installation Destination          6) [x] Kdump
       (No disks selected)                      (Kdump is enabled)
7) [ ] Network configuration             8) [!] Root password
       (Not connected)                          (Password is not set.)
9) [!] User creation
       (No user will be created)

Please make a selection from the above ['b' to begin installation, 'q' to quit,
'r' to refresh]: 5
Probing storage...
================================================================================
======================================================
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值