How To Install Xen On Ubuntu
Introduction
Contents
- Introduction
- During installation of Ubuntu
- Installing Xen
- Network Configuration
- Creating vms
- Manually Create a PV Guest VM
- Manually installing an HVM Invitee VM
- Xen Toolstack Choices
- Xen and twoscore
- Xen and Libvirt
- Xen and XAPI
- Other tips and tricks
- Xen and Grub on older versions of Ubuntu
- See Also
- External Links
The Xen Projection hypervisor is an open up-source type-1 or baremetal hypervisor, which makes it possible to run many instances of an operating organization or indeed different operating systems in parallel on a single machine (or host). The Xen Project hypervisor is the simply type-i hypervisor that is bachelor as open source. Information technology is used as the basis for a number of different commercial and open source applications, such as: server virtualization, Infrastructure as a Service (IaaS), desktop virtualization, security applications, embedded and hardware appliances. The Xen Projection hypervisor is powering the largest clouds in production today.1
As of Ubuntu eleven.10 (Oneiric), the default kernel included in Ubuntu can be used direct with the Xen hypervisor as the direction (or control) domain (Dom0 or Domain0 in Xen terminology).
The residue of this guide gives a basic overview of how to set up a basic Xen organisation and create simple guests. Our example uses LVM for virtual disks and network bridging for virtual network cards. It also assumes Xen 4.iv (the version available in 14.04) and the xl toolstack. It assumes a familiarity with general virtualization issues, as well as with the specific Xen terminology. Please see the Xen wiki for more information.
During installation of Ubuntu
During the install of Ubuntu for the sectionalization method cull "Guided - use the entire deejay and setup LVM". Then, when prompted to enter "Amount of book group to use for guided partitioning:" Enter a value just large enough for the Xen Dom0 system, leaving the residual for virtual disks. Enter a value smaller than the size of your installation drive. For instance x GB or fifty-fifty v GB should exist large enough for a minimal Xen Dom0 system. Entering a pct of maximum size (e.g. 25%) is also a reasonable selection.
Installing Xen
Install a 64-fleck hypervisor. (A 64-fleck hypervisor works with a 32-fleck dom0 kernel, but allows yous to run 64-scrap guests besides.)
$ sudo apt-get install xen-hypervisor-amd64
Every bit of Ubuntu xiv.04, Grub will automatically choose to boot Xen kickoff if Xen is installed. If you're running a version of Ubuntu before fourteen.04, y'all'll accept to modify Chow to default booting to Xen; meet below for details.
Now reboot:
$ sudo reboot
And then verify that the installation has succeeded:
$ sudo xl listing Name ID Mem VCPUs State Fourth dimension(s) Domain-0 0 945 1 r----- 11.3
Network Configuration
Information technology'due south causeless that you are using a wired interface for your network configuration. WiFi networks are tricky to virtualize and many times not even possible. If you are feeling audacious, please start hither Xen in WiFi Networks.
For this example, nosotros volition use the well-nigh common Xen network setup: bridged. You will also find an example on how to set up Open vSwitch which has been bachelor since Xen 4.3.
Disable Network Manager
If you are using Network Director to control your net connections, and then you must first disable it as nosotros will be manually configuring the connections. Delight annotation that yous are about to temporarily lose your internet connection so it's important that you are physically connected to the machine.
Equally documented in NetworkManager:
$ sudo cease network-director $ echo "manual" | sudo tee /etc/init/network-director.override
Using bridge-utils
$ sudo apt-get install bridge-utils
In a bridged setup, it is required that we assign the IP address to the bridged interface. Configure network interfaces so that they persist afterward reboot:
$ sudo 6 /etc/network/interfaces
motorcar lo eth0 xenbr0 iface lo inet loopback iface xenbr0 inet dhcp bridge_ports eth0 iface eth0 inet transmission
Restart networking to enable xenbr0 span:
$ sudo ifdown eth0 && sudo ifup xenbr0 && sudo ifup eth0
The brctl control is useful for providing improver bridge information. See: man brctl
Using Open up vSwitch
$ sudo apt-become install openvswitch-switch
In a bridged setup, information technology is required that nosotros assign the IP accost to the bridged interface. Configure network interfaces so that they persist later reboot:
$ sudo vi /etc/network/interfaces
# interfaces(v) file used by ifup(viii) and ifdown(eight) machine lo eth0 iface lo inet loopback iface eth0 inet manual allow-hotplug ovsbr0 iface ovsbr0 inet dhcp
Set up Open vSwitch
$ sudo ovs-vsctl add-br ovsbr0 $ sudo ovs-vsctl gear up Bridge ovsbr0 stp_enable=imitation other_config:stp-max-age=6 other_config:stp-forrard-delay=4 $ sudo ovs-vsctl listing Span $ sudo ovs-vsctl add-port ovsbr0 eth0
Now bring the interfaces up and learn an IP address through DHCP. Y'all should have your internet connectedness back at this betoken.
$ sudo ip link set up eth0 upwardly $ sudo dhclient ovsbr0
Recommended Span Settings
For functioning and security reasons, information technology's highly recommended2 that netfilter is disabled on all bridges.
$ sudo vi /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 0 cyberspace.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0
$ sudo sysctl -p /etc/sysctl.conf # Note: These settings are created in /proc/sys/cyberspace. The span folder only appears to be created after offset creating a bridge with the ''brctl' control.
Creating vms
There are many options for installing guest images:
-
virt-architect: A program for edifice VM disk images; part of the libguestfs set of tools
-
xen-tools: A ready of scripts for creating various PV guests
-
virt-director: A direction system using libvirt
- Converting an existing installation
-
Downloading pre-build guest images (eastward.g. http://wiki.xen.org/wiki/Guest_VM_Images)
Or you can manually create ane, as described below.
Manually Create a PV Guest VM
In this section nosotros will focus on Paravirtualized (or PV) guests. PV guests are guests that are made Xen-aware and therefore can be optimized for Xen.
As a elementary example nosotros'll create a PV guest in LVM logical volume (LV) by doing a network installation of Ubuntu (other distros such as Debian, Fedora, and CentOS can be installed in a similar way).
List your existing volume groups (VG) and choose where you'd similar to create the new logical volume.
$ sudo vgs
Create the logical volume (LV).
$ sudo lvcreate -L 10G -n lv_vm_ubuntu /dev/<VGNAME>
Ostend that the new LV was successfully created.
$ sudo lvs
Become Netboot Images
Choose an archive mirror https://launchpad.net/ubuntu/+archivemirrors.
$ sudo mkdir -p /var/lib/xen/images/ubuntu-netboot/trusty14LTS $ cd /var/lib/xen/images/ubuntu-netboot/trusty14LTS $ wget http://<mirror>/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/xen/vmlinuz $ wget http://<mirror>/ubuntu/dists/trusty/chief/installer-amd64/electric current/images/netboot/xen/initrd.gz
Set Up Initial Guest Configuration
$ cd /etc/xen $ cp xlexample.pvlinux ubud1.cfg $ vi ubud1.cfg
name = "ubud1" kernel = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/vmlinuz" ramdisk = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/initrd.gz" #bootloader = "/usr/lib/xen-iv.four/bin/pygrub" retentiveness = 1024 vcpus = one # Custom pick for Open vSwitch vif = [ 'script=vif-openvswitch,span=ovsbr0' ] disk = [ '/dev/<VGNAME>/lv_vm_ubuntu,raw,xvda,rw' ] # Y'all may also consider another options # [[http://xenbits.xen.org/docs/4.four-testing/man/xl.cfg.five.html]]
Beginning the VM and connect to the console to perform the install.
$ sudo forty create -c /etc/xen/ubud1.cfg
Once installed and dorsum to command line, modify guest configuration to utilise the pygrub bootloader. These lines volition modify
$ vi /etc/xen/ubud1.cfg
#kernel = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/vmlinuz" #ramdisk = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/initrd.gz" bootloader = "/usr/lib/xen-4.4/bin/pygrub"
At present let's restart the VM with the new bootloader. (If the VM didn't shutdown later on the install above, yous may manually shut information technology downwardly.)
$ sudo xl shutdown ubud1 $ sudo xl create -c /etc/xen/ubud1.cfg
Quick Twoscore Console Tips
Connect to the VM panel
$ sudo xl console ubud1
Disconnect from the console
Ctrl+]
Manually installing an HVM Invitee VM
Download Install ISO.
http://world wide web.ubuntu.com/download/desktop
sudo pvs
choose your VG
Create a LV
sudo lvcreate -L 4G -north ubuntu-hvm /dev/<VG>
Create a guest config file /etc/xen/ubuntu-hvm.cfg
builder = "hvm" name = "ubuntu-hvm" memory = "512" vcpus = 1 vif = [''] disk = ['phy:/dev/<VG>/ubuntu-hvm,hda,due west','file:/root/ubuntu-12.04-desktop-amd64.iso,hdc:cdrom,r'] vnc = 1 boot="dc"
xl create /etc/xen/ubuntu-hvm.cfg vncviewer localhost:0
After the install you tin optionally remove the CDROM from the config and/or alter the kicking order.
For example /etc/xen/ubuntu-hvm.cfg:
builder = "hvm" name = "ubuntu-hvm" memory = "512" vcpus = one vif = [''] #deejay = ['phy:/dev/<VG>/ubuntu-hvm,hda,west','file:/root/ubuntu-12.04-server-amd64.iso,hdc:cdrom,r'] disk = ['phy:/dev/<VG>/ubuntu-hvm,hda,westward'] vnc = 1 boot="c" #boot="dc"
http://wiki.xen.org/wiki/Choice_of_Toolstacks
Xen and xl
xl is a new toolstack written from the ground up to be a replacement for xend and xm. In Xen iv.four, xl is the default toolstack and xend is deprecated. It is planned to be removed in Xen 4.5.
40 is designed to be control-for-command compatible with xm. You should be able to use the same config file and the aforementioned commands you lot're used to; just employ "xl" instead of "xm".
To switch back to xm, practice the post-obit:
sudo sed -i 's/TOOLSTACK=.*\+/TOOLSTACK="xm"/' /etc/default/xen sudo reboot sudo xm list
xl and xm are very like in functionality with a few notable exceptions: http://wiki.xen.org/wiki/XL
Xen and Libvirt
Ubuntu fourteen.04 contains libvirt i.2.2, which contains support for Xen, both libxl and xend. If you lot specify "xen:///" as the hypervisor, it will automatically detect which is the appropriate method to employ.
sudo apt-get install virtinst
sudo virt-install --connect=xen:/// --proper noun u14.04 --ram 1024 --disk u14.04.img,size=4 --location http://ftp.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/
Xen and XAPI
-
http://packages.ubuntu.com/precise/xcp-xapi
-
http://manpages.ubuntu.com/manpages/precise/man1/xapi.one.html
-
http://manpages.ubuntu.com/manpages/precise/man1/xe.1.html
Other tips and tricks
Create and format disk image file
sudo mkdir -p /var/lib/xen/images sudo dd if=/dev/zippo of=/var/lib/xen/images/ubuntu-invitee.img bs=1M seek=3096 count=0 sudo mkfs.ext4 -F /var/lib/xen/images/ubuntu-invitee.img
Xen and Chow on older versions of Ubuntu
Modify GRUB to default to booting Xen ("Xen four.1-amd64" should be replaced with the advisable name, in 12.10 the line is "Ubuntu GNU/Linux, with Xen hypervisor". The current string can be obtained past looking for 1 of the menuentry lines in /kick/grub/grub.cfg. In theory the first element created by the 20_linux_xen script):
sudo sed -i 's/GRUB_DEFAULT=.*\+/GRUB_DEFAULT="Xen 4.1-amd64"/' /etc/default/grub sudo update-chow
Come across Also
-
http://wiki.xen.org/wiki/XenPCIpassthrough
-
http://wiki.xen.org/wiki/Xen_VGA_Passthrough
External Links
-
http://wiki.xen.org/wiki/Debian_Guest_Installation_Using_Debian_Installer - Netboot installation of PV guests
-
http://wiki.xen.org/wiki/HostConfiguration/Networking - Networking configuration details from Xen.org wiki
-
http://libvirt.org/uri.html#URI_file - Libvirt xend configuration
-
http://wiki.xen.org/wiki/Xen_Man_Pages - Xen Man pages
-
http://xenbits.xen.org/docs/unstable/homo/xmdomain.cfg.5.html - xm config options
-
http://xenbits.xen.org/docs/unstable/man/xl.cfg.5.html 40 config options
-
http://xenbits.xen.org/docs/unstable/misc/xl-disk-configuration.txt xl disk configuration
-
http://serverfault.com/questions/390373/xen-4-1-host-dom0-with-blktap-disks-tapaio-non-connecting blktap issues and fixes.
Source: https://help.ubuntu.com/community/Xen
Posted by: smithcathe1941.blogspot.com
0 Response to "How To Install Xen On Ubuntu"
Post a Comment