一、环境介绍
- Linux Centos 7.9 操作系统
- BIGIP-15.1.4-0.0.47.qcow2 镜像
二、环境部署
1、关闭防火墙
1 2
| systemctl stop firewalld systemctl disable firewalld
|
2、关闭selinux
1 2 3 4 5 6 7 8
| sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
reboot
getenforce Disabled
|
3、查看系统是否支持虚拟化
1 2 3 4 5 6 7 8 9 10
| cat /proc/cpuinfo | grep flags | egrep -o 'pae|vmx|svm' pae pae
|
4、下载 Xen 安装源
1
| yum -y install centos-release-xen
|
5、修改 Xen 安装源
1
| sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Xen.repo
|
6、更新内核
1 2 3
| yum --enablerepo=centos-virt-xen -y update kernel
|
7、安装Xen
1 2 3
| yum --enablerepo=centos-virt-xen -y install xen
|
8、修改 grub 文件
1 2 3 4 5
| vi /etc/default/grub
GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=8192M,max:8192M cpuinfo com1=115200,8n1 console=com1,tty loglvl=all guest_loglvl=all"
|
9、执行 grub-bootxen.sh
1 2 3 4 5
| find / -type f -iname grub-bootxen.sh /usr/bin/grub-bootxen.sh
/usr/bin/grub-bootxen.sh
|
10、重启系统
11、检查Xen环境是否安装完成
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| xl info
host : localhost.localdomain release : 4.9.241-37.el7.x86_64 version : machine : x86_64 nr_cpus : 8 max_cpu_id : 7 nr_nodes : 1 cores_per_socket : 1 threads_per_core : 1 cpu_mhz : 2926.007 hw_caps : 0fabfbff:83b82223:28100800:00000001:00000000:00000002:00000000:00000100 virt_caps : pv hvm total_memory : 12287 free_memory : 3927 sharing_freed_memory : 0 sharing_used_memory : 0 outstanding_claims : 0 free_cpus : 0 xen_major : 4 xen_minor : 12 xen_extra : .4.95.g95172a63 xen_version : 4.12.4.95.g95172a63 xen_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 : credit2 xen_pagesize : 4096 platform_params : virt_start=0xffff800000000000 xen_changeset : xen_commandline : placeholder dom0_mem=4096M,max:4096M cpuinfo com1=115200,8n1 console=com1,tty loglvl=all guest_loglvl=all cc_compiler : gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) cc_compile_by : mockbuild cc_compile_domain : centos.org cc_compile_date : Thu Oct 7 15:19:59 UTC 2021 build_id : e88b287373be2de53430a35e9645c5742a465e60 xend_config_format : 4
|
12、安装 Libvirt 工具
1
| yum -y install libvirt libvirt-daemon-xen virt-install
|
13、网桥配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| [root@localhost network-scripts] TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="none" DEFROUTE="yes" NAME="ens192" DEVICE="ens192" BRIDGE="br0"
[root@localhost network-scripts] TYPE="bridge" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" NAME="br0" DEVICE="br0" ONBOOT="yes" IPADDR="192.168.10.36" PREFIX="24" GATEWAY="192.168.10.1" DNS1="114.114.114.114"
[root@localhost network-scripts] TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="none" DEFROUTE="yes" NAME="ens224" DEVICE="ens224" ONBOOT="yes" BRIDGE="br1"
[root@localhost network-scripts] TYPE="bridge" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" NAME="br1" DEVICE="br1" ONBOOT="yes" IPADDR="192.168.20.36" PREFIX="24" GATEWAY="192.168.20.1" DNS1="114.114.114.114"
|
14、上传镜像至xen环境
15、镜像格式转换
1 2 3 4 5
| qemu-img convert <qcow_file_name>.qcow2 <raw_file_name>.raw
|
16、virt-manager 连接 Xen 环境
17、打开虚拟机管理工具,点击左上角File,选择 Add Connection ,Hypervisor 选择 Xen ,点击 Connect 完成 Xen 的连接。
18、打开虚拟机管理工具,点击左上角File,选择 Create a new Virtual machine。 点击Import existing disk image(使用已存在的镜像),架构选项根据情况进行选择,这里选择全虚拟化。点击 Forward 进行下一步。
19、OS type 选择 Linux ,Version 选择 Red Hat Enterprise linux 6 unkown。Browse 选择之前转换的 raw 镜像 。
20、分配 CPU 和 Memory。
21、Name 根据情况进行填写,勾选 Customize configuration before install 进行网络配置,点击 Finish 进行下一步。
22、网络配置,添加网卡,并选择网桥(两张网卡分别配置不同的网桥)。
23、点击左上角 Begin Installation 进行安装。