Difference between revisions of "Xen installation"
| Line 1: | Line 1: | ||
| The section contains the instruction to install Xen hypervisor on platform x86_64 with one of the following operating system:   | The section contains the instruction to install Xen hypervisor on platform x86_64 with one of the following operating system:   | ||
| <ul> | <ul> | ||
| − | <li><i>Ubuntu 16.04</i>  | + | <li><i>Ubuntu 16.04</i></li> | 
| − | <li><i>Ubuntu 18.04.1 LTS</i>  | + | <li><i>Ubuntu 18.04.1 LTS</i></li> | 
| </ul> | </ul> | ||
| Line 11: | Line 11: | ||
|    # apt install build-essential |    # apt install build-essential | ||
|    # apt install bcc bin86 gawk bridge-utils iproute2   |    # apt install bcc bin86 gawk bridge-utils iproute2   | ||
| − |    # apt install  | + |    # apt install libcurl4 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif | 
|    # apt install texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended |    # apt install texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended | ||
|    # apt install pciutils-dev mercurial |    # apt install pciutils-dev mercurial | ||
| Line 23: | Line 23: | ||
|    # apt install lzma lzma-dev liblzma-dev #for rombios |    # apt install lzma lzma-dev liblzma-dev #for rombios | ||
|    # apt install libsystemd-dev   |    # apt install libsystemd-dev   | ||
| + | |||
| + | == Retrieve the GRUB version == | ||
| + | The Xen installation strictly depends on the installed Grub version: <code>grub-pc</code> or <code>grub-efi</code>. | ||
| + | In order to retrieve the grub version, launch the following command: | ||
| + |   $ dpkg --get-selections | grep grub | ||
| == Xen Installation == | == Xen Installation == | ||
| Line 28: | Line 33: | ||
| <b>Retrieve Xen source</b> | <b>Retrieve Xen source</b> | ||
| − | Clone the Xen repository and switch to the chosen version (i.e.,  | + | Clone the Xen repository and switch to the chosen version (i.e., <code>RELEASE 4.11</code>): | 
|    $ git clone https://github.com/xen-project/xen.git |    $ git clone https://github.com/xen-project/xen.git | ||
| Line 37: | Line 42: | ||
| <b>Configure</b> | <b>Configure</b> | ||
| − | Configure (for < | + | Configure (for <code>grub-pc</code>): | 
|    $ $XENPATH/configure --enable-systemd --libdir=/usr/local/lib64 |    $ $XENPATH/configure --enable-systemd --libdir=/usr/local/lib64 | ||
| − | Configure ( | + | Configure for Xen EFI (e.g., <code>grub-efi</code>): | 
| − |    $ $XENPATH/configure --enable-systemd --libdir=/usr/local/lib64 | + |    $ $XENPATH/configure --enable-systemd --libdir=/usr/local/lib64 --enable-targets=x86_64-pep | 
| <b>Build and install</b> | <b>Build and install</b> | ||
| Line 65: | Line 70: | ||
| == Grub setup == | == Grub setup == | ||
| − | <b>Grub-pc</b> (e.g., <i>Ubuntu 16.04<i>) | + | <b>Grub-pc</b> (e.g., <i>Ubuntu 16.04</i>) | 
| Update grub and reboot: | Update grub and reboot: | ||
| Line 71: | Line 76: | ||
|    # reboot |    # reboot | ||
| − | <b>Grub- | + | <b>Grub-efi</b> (e.g., <i>Ubuntu 18.04.01</i>) | 
| − | + | ||
| + | Remove the entry created for Grub-pc (it will no work since the installed grub is UEFI): | ||
| + |   # rm /etc/grub.d/20_linux_xen | ||
| + | |||
| + | Create the Xen UEFI entry as follows: | ||
| + |   # mkdir /boot/efi/EFI/xen | ||
| + |   # cp /usr/lib64/efi/xen.efi /boot/efi/EFI/xen | ||
| + |   # cp /boot/vmlinuz-$VERSION /boot/efi/EFI/xen | ||
| + |   # cp /boot/initrd.img-$VERSION /boot/efi/EFI/xen/ | ||
| + | where $VERSION is the chosen version of the Linux kernel and initramdisk that MUST reside in the same directory as <code>xen.efi</code>. | ||
| + | |||
| + | Create the <code>xen.cfg</code> file in <code>/boot/efi/EFI/xen/</code>: | ||
| + | |||
| + |   global] | ||
| + |   default=ubuntu | ||
| + |   [ubuntu] | ||
| + |   options=console=vga,com1 com1=115200,8n1 iommu=verbose ucode=scan flask=disabled conring_size=2097152  loglvl=all | ||
| + |   kernel=vmlinuz-$VERSION root=UUID=$ROOT_UUID ro quiet vt.handoff=7 console=hvc0 | ||
| + |   ramdisk=initrd.img-$VERSION | ||
| + | |||
| + | where <code>$VERSION</code> is the chosen version moved into <code>/boot/efi/EFI/xen</code> and <code>ROOT_UUID</code> is the identifier of the Ubuntu partition (note: command used <code>cat /proc/cmdline</code>). | ||
| + | |||
| + | Create an entry for Grub <code>/etc/grub.d/20_linux_xen_efi</code>:  | ||
| + |   menuentry "Ubuntu GNU/Linux, with Xen EFI hypervisor" { | ||
| + |     insmod part_gpt | ||
| + |     insmod search_fs_uuid | ||
| + |     insmod chain | ||
| + |     chainloader (hd0,gpt1)/EFI/XEN/xen.efi | ||
| + |   } | ||
| + | |||
| + |   # chmod +x /etc/grub.d/20_linux_xen_efi | ||
| + | |||
| + | Note, in case of no Grub menu at start-up, modify the following grub configuration parameter in <code>/etc/default/grub</code>: | ||
| + |   GRUB_TIMEOUT_STYLE=text | ||
| + |   GRUB_TIMEOUT=5 | ||
| Update grub and reboot: | Update grub and reboot: | ||
|    # udate-grub |    # udate-grub | ||
|    # reboot |    # reboot | ||
Revision as of 17:20, 29 November 2018
The section contains the instruction to install Xen hypervisor on platform x86_64 with one of the following operating system:
- Ubuntu 16.04
- Ubuntu 18.04.1 LTS
Build Dependencies
Install the following packages:
# apt update && apt dist-upgrade #update/upgrade the kernel # apt install build-essential # apt install bcc bin86 gawk bridge-utils iproute2 # apt install libcurl4 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif # apt install texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended # apt install pciutils-dev mercurial # apt install make gcc libc6-dev zlib1g-dev python python-dev python-twisted # apt install libncurses5-dev patch libsdl-dev libjpeg-dev # apt install libvncserver-dev # apt install iasl libbz2-dev e2fslibs-dev git-core uuid-dev # apt install ocaml ocaml-findlib libx11-dev bison flex xz-utils libyajl-dev # apt install gettext libpixman-1-dev libaio-dev markdown pandoc # apt install libc6-dev-i386 # apt install lzma lzma-dev liblzma-dev #for rombios # apt install libsystemd-dev
Retrieve the GRUB version
The Xen installation strictly depends on the installed Grub version: grub-pc or grub-efi.
In order to retrieve the grub version, launch the following command:
$ dpkg --get-selections | grep grub
Xen Installation
Retrieve Xen source
Clone the Xen repository and switch to the chosen version (i.e., RELEASE 4.11):
$ git clone https://github.com/xen-project/xen.git $ git checkout RELEASE-4.11.0 -b RELEASE-4.11.0
In the following part of the tutorial, we refer to the Xen repository path as $XENPATH.
Configure
Configure (for grub-pc):
$ $XENPATH/configure --enable-systemd --libdir=/usr/local/lib64
Configure for Xen EFI (e.g., grub-efi):
$ $XENPATH/configure --enable-systemd --libdir=/usr/local/lib64 --enable-targets=x86_64-pep
Build and install
Build all components (hypervisor, tools, docs, stubdomains, etc):
$ cd $XENPATH $ make dist
Install (as root):
# make install
Enable the Xen services Reload dynamic libraries:
# /sbin/ldconfig
Enable systemd Xen services:
# 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
Note that in case of error for enabling xendomains service, remove /etc/init.d/xendomains.
Grub setup
Grub-pc (e.g., Ubuntu 16.04)
Update grub and reboot:
# udate-grub # reboot
Grub-efi (e.g., Ubuntu 18.04.01)
Remove the entry created for Grub-pc (it will no work since the installed grub is UEFI):
# rm /etc/grub.d/20_linux_xen
Create the Xen UEFI entry as follows:
# mkdir /boot/efi/EFI/xen # cp /usr/lib64/efi/xen.efi /boot/efi/EFI/xen # cp /boot/vmlinuz-$VERSION /boot/efi/EFI/xen # cp /boot/initrd.img-$VERSION /boot/efi/EFI/xen/
where $VERSION is the chosen version of the Linux kernel and initramdisk that MUST reside in the same directory as xen.efi.
Create the xen.cfg file in /boot/efi/EFI/xen/:
global] default=ubuntu [ubuntu] options=console=vga,com1 com1=115200,8n1 iommu=verbose ucode=scan flask=disabled conring_size=2097152 loglvl=all kernel=vmlinuz-$VERSION root=UUID=$ROOT_UUID ro quiet vt.handoff=7 console=hvc0 ramdisk=initrd.img-$VERSION
where $VERSION is the chosen version moved into /boot/efi/EFI/xen and ROOT_UUID is the identifier of the Ubuntu partition (note: command used cat /proc/cmdline).
Create an entry for Grub /etc/grub.d/20_linux_xen_efi: 
 menuentry "Ubuntu GNU/Linux, with Xen EFI hypervisor" {
   insmod part_gpt
   insmod search_fs_uuid
   insmod chain
   chainloader (hd0,gpt1)/EFI/XEN/xen.efi
 }
# chmod +x /etc/grub.d/20_linux_xen_efi
Note, in case of no Grub menu at start-up, modify the following grub configuration parameter in /etc/default/grub:
GRUB_TIMEOUT_STYLE=text GRUB_TIMEOUT=5
Update grub and reboot:
# udate-grub # reboot
