Linux如何实现虚拟化
1.搭建软件仓库
挂载ISO光盘镜像,配置本地yum源
[root@localhost~]# mount /dev/sr0 /mnt/
mount: /mnt: /dev/sr0 already mounted on /run/media/root/RHEL-8-0-0-BaseOSx86_64.
[root@localhost ~]# cat /etc/yum.repos.d/iso.repo
[aa] name = aa
baseurl = file:///mnt/BaseOS
gpgcheck=0
[bb] name = bb
baseurl = file:///mnt/AppStream
gpgcheck=0
2、网络配置
查看网卡
[root@localhost ~]# ifconfig ens160
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.40.133 netmask 255.255.255.0 broadcast 192.168.40.255
inet6 fe80::20c:29ff:fe04:e15f prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:04:e1:5f txqueuelen 1000 (Ethernet)
RX packets 11242813 bytes 15959431204 (14.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 654757 bytes 65738087 (62.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[root@localhost ~]#
检查路由是否正常
[root@localhost ~]# route -ne
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.40.2 0.0.0.0 UG 0 0 0 ens160
192.168.40.0 0.0.0.0 255.255.255.0 U 0 0 0 ens160
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
[root@localhost ~]#
3、准备安装光盘和vmware workstation for linu
[root@localhost ~]# ls VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle
VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle
[root@localhost ~]# ls rhel-8.5-x86_64-dvd.iso
rhel-8.5-x86_64-dvd.iso
4、检查你的cpu是否支持虚拟化
[root@localhost ~]# lscpu | grep vmx
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vm
ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xsaves arat md_clear flush_l1d arch_capabilities
[root@localhost ~]#
5、安装vmware workstation
[root@localhost ~]# ls VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle
VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle[root@localhost ~]# chmod +x VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle
[root@localhost ~]# ls -ld VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle
-rwxr-xr-x. 1 root root 537847831 Apr 30 11:37 VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle
[root@localhost ~]# ./VMware-Workstation-Full-15.5.5-16285975.x86_64.bundle
Extracting VMware Installer...done.
Installing VMware Workstation 15.5.5
Configuring...
[######################################################################] 100%
Installation was successful.
6、安装gcc编译器
[root@localhost ~]# yum groupinstall "Development Tools"
[root@localhost ~]# yum -y install elfutils-libelf-devel
7、放行防火墙允许客户端连接vmware workstation server
[root@localhost ~]# firewall-cmd --add-port=443/tcp success