Ubuntu18.04安装Xen4.11

Ubuntu18.04安装Xen4.11

首先Ubuntu是18.04英文版的。不是英文版的不知道会不会有问题。

Build xen-hypervisor 4.10 / 4.11 and xen-tools on Ubuntu 16.04 or 18.04 for PVH

1.安装依赖包

apt-get install build-essential
apt-get install bcc bin86 gawk bridge-utils iproute2 libcurl4 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif
apt-get install texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended pciutils-dev mercurial
apt-get install make gcc libc6-dev zlib1g-dev python python-dev python-twisted libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg-dev
apt-get install libnl-route-3-200 libnl-3-dev libnl-cli-3-dev libnl-genl-3-dev libnl-route-3-dev
apt-get install iasl libbz2-dev e2fslibs-dev git-core uuid-dev ocaml ocaml-findlib libx11-dev bison flex xz-utils libyajl-dev
apt-get install gettext libpixman-1-dev libaio-dev markdown pandoc
 
apt-get install libc6-dev-i386
apt-get install lzma lzma-dev liblzma-dev
apt-get install libsystemd-dev

2.下载Xen4.11源码并安装

下载Xen Project 4.11

解压缩并进入到4.11目录

./configure
make world		#需要等很久
make install	#需要等很久

3.Post-Install

Reload dynamic libraries:

/sbin/ldconfig

Grub-Settings:

mkdir -p /etc/default/grub.d

Create /etc/default/grub.d/xen.cfg:

vi /etc/default/grub.d/xen.cfg
GRUB_DISABLE_OS_PROBER=true
GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=2560M,max:2560M"
GRUB_DEFAULT="Ubuntu GNU/Linux, with Xen hypervisor"

You have to update grub:

update-grub

Enable systemd-files:

In the current version is a bug and xendomains.service and /etc/init.d/xendomains are created both. To use systemd you have to remove /etc/init.d/xendomains。就是说有一个bug导致有两个文件同时生成,需要删除一个。

rm /etc/init.d/xendomains
systemctl enable xen-qemu-dom0-disk-backend.service
systemctl enable xen-init-dom0.service
systemctl enable xenconsoled.service
systemctl enable xenstored.service
systemctl enable xendomains.service

4.安装xen-tools

暂时不知道不安装会不会有问题,我觉得如果不创建new VMs,应该是可以的,我猜测是安装类似于xl xm等工具的。

Install requirements for build

apt install lvm2 debootstrap libconfig-inifiles-perl libdata-validate-domain-perl libdata-validate-ip-perl libdata-validate-uri-perl libfile-slurp-perl libfile-which-perl libsort-versions-perl libterm-ui-perl libtext-template-perl openssh-client perl debian-archive-keyring rinse libtest-notabs-perl

Download and prepare and make

git clone https://github.com/xen-tools/xen-tools.git
cd xen-tools
make install

5.测试是否安装成功

xentop

-----至此其实Xen环境已经安装成功了。

如果需要安装PVH客户机,进行第6步;否则可以不需要执行。

6.设置PVH

For PVH you have to use Linux 4.11 or newer (e.g. HWE-Kernel) in guest:
apt install linux-virtual-hwe-16.04 linux-tools-virtual-hwe-16.04

Then you can use:

bootloader = '/usr/local/bin/pygrub'
type="pvh"

If you have an old kernel in your guest-system, you have to boot from dom0-kernel with this settings:

type="pvh"
kernel='/vmlinuz'
ramdisk="/initrd.img"

问题解决

  1. 看不到启动项

解决:修改了/etc/default/grub

  1. 在输入xl xentop类似命令时报错

我找不到具体的信息了。原因是因为没有进入带有xen内核的启动模式。

你可能感兴趣的:(学习)