[root@rebekk ~]# cat /etc/yum.repos.d/xen48.repo[xen48]name=Xen4.8 on Aliyunbaseurl=https://mirrors.aliyun.com/centos/7/virt/x86_64/xen-48/gpgcheck=0enabled=1
2、升级安装包并安装Xen[root@rebekk ~]# yum update[root@rebekk ~]# yum install xen
3、修改Grub引导文件,并指定Dom0启动内核参数[root@rebekk ~]# vim /etc/default/grubGRUB_TIMEOUT=5GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT="console"GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"GRUB_DISABLE_RECOVERY="true"GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=1024M,max:1024M dom0_max_vcpus=2 dom0_vcpus_pin=true cpuinfo com1=115200,8n1 console=com1,tty loglvl=all guest_loglvl=all"GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT="console=hvc0 earlyprintk=xen nomodeset"
4、启动Dom0[root@rebekk ~]# bash $(which grub-bootxen.sh)[root@rebekk ~]# reboot
5、查看结果[root@rebekk ~]# uname -aLinux rebekk 4.9.215-36.el7.x86_64 #1 SMP Mon Mar 2 11:42:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux[root@rebekk ~]# uname -r4.9.215-36.el7.x86_64[root@rebekk ~]# xl listName ID Mem VCPUsStateTime(s)Domain-0 0 1024 2 r----- 51.4# 通过xl info命令可以查看底层硬件平台(Xen Hypervisor)的一些信息,如总内存(total_memory)、空闲内存(free_memory)等[root@rebekk ~]# xl infohost : rebekkrelease : 4.9.215-36.el7.x86_64version : #1 SMP Mon Mar 2 11:42:52 UTC 2020machine : x86_64nr_cpus : 1max_cpu_id : 127nr_nodes : 1cores_per_socket : 1threads_per_core : 1cpu_mhz : 3599hw_caps : 078bfbff:f7fa3223:2c100800:00000121:0000000f:009c27ab:00000000:00000100virt_caps : hvmtotal_memory : 2047free_memory : 998sharing_freed_memory : 0sharing_used_memory : 0outstanding_claims : 0free_cpus : 0xen_major : 4xen_minor : 8xen_extra : .5.86.g8db85532xen_version : 4.8.5.86.g8db85532xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 xen_scheduler : creditxen_pagesize : 4096platform_params : virt_start=0xffff800000000000xen_changeset : xen_commandline : placeholder dom0_mem=1024M,max:1024M dom0_max_vcpus=2 dom0_vcpus_pin=true cpuinfo com1=115200,8n1 console=com1,tty loglvl=all guest_loglvl=allcc_compiler : gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)cc_compile_by : mockbuildcc_compile_domain : centos.orgcc_compile_date : Thu Dec 12 15:10:22 UTC 2019build_id : 758b32738223bc21223741bec488a75ce4f823abxend_config_format : 4