In such an information age with ceaseless change, the cloud and virtual machine has play its leading role. As one of the biggest hypervisor platform, xen
run many instances of an operating system or indeed different operating systems in parallel on a single machine (or host). This article elaborates how to install the xen on the server and create a PV guest vm.
Prelimilaries:
1.During the install of Ubuntu:
For the partitioning method, choose "Guided - use the entire disk and setup LVM".
Then, when prompted to enter "Amount of volume group to use for guided partitioning:", Enter a value just large enough for the Xen Dom0 system, such as 25%
2.Set the password for the root at the first time to start the OS: `sudo passwd root`
3.Install the necessary applicatins
a.Update the software in the system: `apt-get update`
b.Install an editor: `apt-get install vim`
c.Install the basic modules of development: `apt-get install build-essential`
1.During the install of Ubuntu:
For the partitioning method, choose "Guided - use the entire disk and setup LVM".
Then, when prompted to enter "Amount of volume group to use for guided partitioning:", Enter a value just large enough for the Xen Dom0 system, such as 25%
2.Set the password for the root at the first time to start the OS: `sudo passwd root`
3.Install the necessary applicatins
a.Update the software in the system: `apt-get update`
b.Install an editor: `apt-get install vim`
c.Install the basic modules of development: `apt-get install build-essential`
Notes:
1.You can use --help to find more help. e.g., xen-create-image --help.
2.you must remenber the password, which is a messy code after the sucessful *xen-create-image* operation. And
it's better to change it into a simper password for you with 'sudo passwd root'
3. Find the orginal password: `
grep Password /var/log/xen-tools/vm0.log`
References
1.Xen in Unbuntu wiki community: (
https://help.ubuntu.com/community/Xen
)
2.Network configuration examples: (
https://wiki.xen.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)
)
3.Xen project beginner: (
https://wiki.xenproject.org/wiki/Xen_Project_Beginners_Guide
)
Install Xen:
1. Install xen: ` apt-get install xen-hypervisor-amd64 `
2.Reboot the system: `reboot`
1. Install xen: ` apt-get install xen-hypervisor-amd64 `
2.Reboot the system: `reboot`
Network configuration (Bridge)
There are three main styles of network setup for a Xen host, bridged , routed and nat .
The default and most common is bridged.
Thus, we introduce how to use the *bridge-utils* configre the bridged network.
1.Install the bridge-utils: `apt-get install bridge-utils`
2.Assign the IP address to the bridged interface
3. Open the */etc/network/interfaces*: `vim /etc/network/interfaces`
4. Modify the */etc/network/interfaces* as follow:
`# This file describes the network interfaces available on your system`
`# and how to activate them. For more information, see interfaces(5).`
`# The loopback network interface`
`auto lo`
`iface lo inet loopback`
`# The primary network interface`
`auto em1`
`iface em1 inet manual`
`auto xenbr0`
`iface xenbr0 inet static`
`bridge_ports em1`
`address 192.168.1.203`
`broadcast 192.168.1.255`
`netmask 255.255.255.0`
`gateway 192.168.1.1`
5.Restart the system: `reboot`
Create a PV Guest vm
1.Install *xen-tools* to control xen and vms: `apt-get install xen-tools`
2. Create a PV guest VM: ` xen-create-image --hostname=vm0 --memory=512mb --vcpus=2 --lvm=yourvggroup --dhcp --pygrub --dist=trusty`
Control the vm
1.Start the vm: `xl create /etc/xen/vm0.cfg`
2.Connect to the vm: `xl console vm0`
3.Get back to the Domain-0 (hypervisor) `ctrl+]`