安装好Centos8后先配置yum源
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir yum.bak
[root@localhost yum.repos.d]# ls
CentOS-AppStream.repo CentOS-CR.repo CentOS-Extras.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-PowerTools.repo yum.bak
CentOS-centosplus.repo CentOS-Devel.repo CentOS-HA.repo CentOS-Sources.repo
[root@localhost yum.repos.d]# mv *.repo yum.bak/
[root@localhost yum.repos.d]# ls
yum.bak
然后下载阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
[root@192 yum.repos.d]# ll
总用量 8
-rw-r--r--. 1 root root 2590 8月 4 2022 CentOS-Base.repo
drwxr-xr-x. 2 root root 4096 10月 11 05:43 yum.bak
重建缓存
[root@localhost yum.repos.d]# yum clean all
0 文件已删除
[root@localhost yum.repos.d]# yum -y makecache
CentOS-8 - Base - mirrors.aliyun.com 1.6 MB/s | 4.6 MB 00:02
CentOS-8 - Extras - mirrors.aliyun.com 26 kB/s | 10 kB 00:00
CentOS-8 - AppStream - mirrors.aliyun.com 1.0 MB/s | 8.4 MB 00:08
元数据缓存已建立。
下载输入法和语言
[root@192 yum.repos.d]# yum install ibus ibus-libpinyin
[root@192 yum.repos.d]# yum install glibc-common
[root@192 yum.repos.d]# yum install -y langpacks-zh_CN
然后再图形化界面进行配置
查看CPU是否支持VT技术(虚拟化技术)若输出结果中带有svm和vmx则可以使用
svm代表cpu是amd
vmx代表cpu是intel
[root@192 ~]# cat /proc/cpuinfo | grep -E 'vmx|svm'
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves clzero wbnoinvd arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor flush_l1d
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves clzero wbnoinvd arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor flush_l1d
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves clzero wbnoinvd arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor flush_l1d
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves clzero wbnoinvd arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor flush_l1d
查看是否加载KVM
[root@192 ~]# lsmod | grep kvm
kvm_amd 110592 0
ccp 98304 1 kvm_amd
kvm 753664 1 kvm_amd
irqbypass 16384 1 kvm
如上显示的结果说明已经加载,若果没有加载请执行如下命令:modprobe kvm
关闭selinux,编辑文件SELINUX=disabled
[root@192 ~]# setenforce 0
[root@192 ~]# vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
安装KVM相关软件包
[root@192 ~]# yum install qemu-kvm qemu-img \
> virt-manager libvirt libvirt-python virt-manager \
> libvirt-client virt-install virt-viewer -y
CentOS-8 - Base - mirrors.aliyun.com 75 kB/s | 3.9 kB 00:00
CentOS-8 - Extras - mirrors.aliyun.com 32 kB/s | 1.5 kB 00:00
CentOS-8 - AppStream - mirrors.aliyun.com 148 kB/s | 4.3 kB 00:00
软件包 qemu-kvm-15:2.12.0-88.module_el8.1.0+248+298dec18.x86_64 已安装。
软件包 qemu-img-15:2.12.0-88.module_el8.1.0+248+298dec18.x86_64 已安装。
未找到匹配的参数: libvirt-python
错误:没有任何匹配: libvirt-python
如果出错那就一个个安装
root@192 ~]# yum install virt-manager libvirt virt-manager libvirt-client virt-install virt-viewer -y
安装完毕回返回一个complet
检查一下libvirt-python,其实已经有了
root@192 ~]# pip3 list |grep libvirt-python
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
libvirt-python (6.0.0)
这里先安装kvm环境
[root@192 ~]# yum install -y libvirt-devel
安装完成后也会返回完毕!
启动libvrt并设置开机自启
[root@192 ~]# systemctl start libvirtd
[root@192 ~]# systemctl enable libvirtd
Created symlink /etc/systemd/system/sockets.target.wants/libvirtd.socket → /usr/lib/systemd/system/libvirtd.socket.
Created symlink /etc/systemd/system/sockets.target.wants/libvirtd-ro.socket → /usr/lib/systemd/system/libvirtd-ro.socket.
检查机器存储
[root@192 ~]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs tmpfs 3.9G 10M 3.8G 1% /run
tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/nvme0n1p3 xfs 120G 5.4G 115G 5% /
/dev/nvme0n1p1 ext4 283M 137M 128M 52% /boot
tmpfs tmpfs 779M 1.2M 778M 1% /run/user/42
tmpfs tmpfs 779M 5.7M 774M 1% /run/user/0
再home目录下创建像个新目录
iso里面放镜像文件
image里面放虚拟机要存储的文件
[root@192 ~]# mkdir /home/image
[root@192 ~]# mkdir /home/iso
[root@192 ~]# ll /home
总用量 4
drwxr-xr-x. 2 root root 6 10月 11 06:30 image
drwxr-xr-x. 2 root root 6 10月 11 06:30 iso
drwx------. 15 xyh xyh 4096 10月 11 05:36 xyh
[root@192 ~]#
使用SSH工具将镜像文件传到iso文件夹中
启动virt-manager
virt-manager
点击文件->新建->本地镜像
前进,选择本地浏览,选择刚才上传的文件,操作系统选择默认值(我也不知道为什么不能先centos8)
分配内存与cpu
分配51.2G的磁盘,然后就完成了
然后开始安装
然后进行配置,最后进行安装
还有一种用命令行创建,很麻烦
基于centos安装并使用KVM_centos kvm-CSDN博客有写
参考文档:
基于centos安装并使用KVM_centos kvm-CSDN博客
CentOS 8 安装国内、本地YUM源_centos8 源-CSDN博客
Centos8图形界面修改语言为中文_centos8中文设置-CSDN博客
Centos8 设置中文_centos8怎么设置中文-CSDN博客
CentOS7中安装、配置与使用KVM(图形化操作方式)_centos kvm-CSDN博客
标签:CentOS,avx512,KVM,192,repo,yum,使用,root,Centos8 From: https://www.cnblogs.com/xyh0703/p/18459461