This is an old revision of the document!


Hypervisor Layer

As the hypervisor layer, we'll first try to setup a Debian Wheezy (7.4.0) base OS using Xen and virt-manager.
Later, for production server deployment, we might try to go for some other configuration, in particular using oVirt will be one of our goals.

https://nsrc.org/workshops/2014/sanog23-virtualization/raw-attachment/wiki/Agenda/ex-debian-kvm-libvirt.htm

The latest Debian installer was used, booted from a USB stick.
In case you have no idea how to make a bootable Debian installer USB stick, please refer to the Debian documentation on the subject, our attempt was made using the latest netboot mini.iso image.

We won't go into the details of installing Debian, following are simply a few notes that might be of interest during this step.

Desktop Environment

Although choosing the right desktop environment shouldn't be a main preoccupation, we decided to go for KDE on our first trial install.

Additional Packages

Also, you might want to add some proprietary drivers on the the space that is left free on your USB key. In our case, the Realtek WiFi interface required the rtlwifi/rtl8192cfw.bin package to be present.
You'll need to create a new partition in the free space left, using GParted is one of the easiest way to do this.

Once the packages are present on this extra space, it seems the Debian installer automatically detects them and uses them.

Partitionning

In the case of the hypervisor layer, what we'd like is to have as much disk space as possible available for the virtual machines. Therefore we'll apply the following partition schema when the Debian installer asks for the partition method:

Partitioning method: Manual
Partition disks: Select your main HD (to delete all existing partitions)
Create new partitions: Select pri/log FREE SPACE, then create new partition
Create a 1GB for /boot filesystem → Primary → Beginning → Ext4 journaling file system, Mount point: /boot → Label: Boot → Bootable flag: on → Done

Repeat partition setup for another one
Use full space available → Primary → Use as: Physical volume for LVM → Done

Configure the Logical Volume Manager
Write changes to disk and configure LVM?: Yes
Create volume group: xenvg Select devices: (select only the LVM partition (/dev/sdX2)

Create logical volume
Volume group: xenvg
Logical volume name: root
Logical volume size: 4GB

Create logical volume
Volume group: xenvg
Logical volume name: swap
Logical volume size: 4GB

Create logical volume
Volume group: xenvg
Logical volume name: var
Logical volume size: 20GB

Finish

Set mount points

On top of the list, select the first entry

LVM  VG  xenvg, LV root - 4.0 GB Linux device-mapper (linear)
     #1          4.0GB

Use as: Ext4 → Mount point: / → Done

Second: LV swap entry: Use as: Swap → Done

Third: LV var: Use as: Ext4 → Mount point: /var → Done

Finish partitioning and write changes to disk

Software selection

[*] SSH server
[*] Laptop
[*] Standard system utilities

GRUB

Install the GRUB boot loader to the master boot record? Yes

Boot into the new system

Basic Configuration

Login as root

remove cdrom from sources

> nano /etc/apt/sources.list

Comment out any line which begins “deb cdrom:…” by inserting a hash (#) in front of it.
Save the file (ctrl-X).

Install sudo and create the 'nsrc' user into the sudo group

> apt-get update
> apt-get install sudo
> usermod -G sudo -a user_name (chosen during install process) 

Network Configuration

Your computer probably has received an IP address from a DHCP server, let's configure a static address for it, so the VMs can share the same network interface:

> nano /etc/hosts

add 198.168.1.251 your_host.your_hostname.com your_hostname

Install additional networking packages

> apt-get install bridge-utils vlan

Edit /etc/network/interfaces

Change the file so that it looks like this. This removes the (dynamic) IP address from eth0, and instead creates a bridge interface “br-lan” with a static IP address, and eth0 a member of the bridge.

# The loopback network interface
auto lo
iface lo inet loopback

# Management interface
auto eth0
iface eth0 inet manual

auto br-lan
iface br-lan inet static
        address         10.10.0.X
        netmask         255.255.255.0
        gateway         10.10.0.254
        bridge_ports    eth0
        bridge_stp      off
        bridge_fd       0
        bridge_maxwait  0

You can activate your changes like this:

> ifdown eth0
> killall dhclient
> ifup br-lan
> brctl show

bridge name bridge id       STP enabled interfaces
br-lan      8000.xxxxxxxxxxxx   no      eth0

You should see your new IP address on ifconfig br-lan, and you should still be able to ping out (e.g. ping 8.8.8.8) 2.4.5 Edit /etc/resolv.conf

domain ws.nsrc.org nameserver 10.10.0.241

Check you can still resolve names (e.g. ping apt.ws.nsrc.org)