Difference between revisions of "XAPI on Debian"

From Xen
m
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
#REDIRECT [[XAPI_toolstack_on_a_Debian-based_distribution]]
  +
 
<!-- MoinMoin name: XAPI_on_debian -->
 
<!-- MoinMoin name: XAPI_on_debian -->
 
<!-- Comment: -->
 
<!-- Comment: -->
Line 17: Line 19:
   
   
<pre><nowiki>
+
<pre>
 
echo "deb http://ftp.uk.debian.org/debian/ squeeze non-free" >> /etc/apt/sources.list
 
echo "deb http://ftp.uk.debian.org/debian/ squeeze non-free" >> /etc/apt/sources.list
</nowiki></pre>
+
</pre>
   
   
   
<pre><nowiki>
+
<pre>
 
apt-get update
 
apt-get update
</nowiki></pre>
+
</pre>
   
   
   
<pre><nowiki>
+
<pre>
 
apt-get install firmware-bnx2
 
apt-get install firmware-bnx2
</nowiki></pre>
+
</pre>
   
   
Line 37: Line 39:
 
* Edit /etc/apt/sources.list and replace 'squeeze' with 'unstable'
 
* Edit /etc/apt/sources.list and replace 'squeeze' with 'unstable'
   
<pre><nowiki>
+
<pre>
 
perl -pi -e 's/squeeze/unstable/g' /etc/apt/sources.list
 
perl -pi -e 's/squeeze/unstable/g' /etc/apt/sources.list
</nowiki></pre>
+
</pre>
   
   
   
<pre><nowiki>
+
<pre>
 
apt-get update
 
apt-get update
</nowiki></pre>
+
</pre>
   
   
   
<pre><nowiki>
+
<pre>
 
apt-get dist-upgrade
 
apt-get dist-upgrade
</nowiki></pre>
+
</pre>
   
   
 
3. Edit /etc/apt/sources.list and add a line for experimental
 
3. Edit /etc/apt/sources.list and add a line for experimental
   
<pre><nowiki>
+
<pre>
 
echo "deb http://ftp.uk.debian.org/debian/ experimental main" >> /etc/apt/sources.list
 
echo "deb http://ftp.uk.debian.org/debian/ experimental main" >> /etc/apt/sources.list
</nowiki></pre>
+
</pre>
   
   
   
<pre><nowiki>
+
<pre>
 
apt-get update
 
apt-get update
</nowiki></pre>
+
</pre>
   
   
 
4. Install Xen hypervisor and dom0 kernel
 
4. Install Xen hypervisor and dom0 kernel
   
<pre><nowiki>
+
<pre>
 
apt-get install xen-hypervisor-4.1-amd64 linux-image-3.0.0-2-686-pae
 
apt-get install xen-hypervisor-4.1-amd64 linux-image-3.0.0-2-686-pae
</nowiki></pre>
+
</pre>
   
   
 
5. Set up a Debian apt sources repo. This will update your system with the latest Kronos packages from our build server.
 
5. Set up a Debian apt sources repo. This will update your system with the latest Kronos packages from our build server.
   
<pre><nowiki>
+
<pre>
 
apt-get install curl
 
apt-get install curl
 
echo "deb http://downloads.xen.org/XCP/debian/repo/debian unstable main" > /etc/apt/sources.list.d/kronos.list
 
echo "deb http://downloads.xen.org/XCP/debian/repo/debian unstable main" > /etc/apt/sources.list.d/kronos.list
Line 82: Line 84:
 
wget --quiet -O - http://downloads.xen.org/XCP/debian/xcp.gpg.key | apt-key add -
 
wget --quiet -O - http://downloads.xen.org/XCP/debian/xcp.gpg.key | apt-key add -
 
apt-get update
 
apt-get update
apt-get install xapi eliloader
+
apt-get install xcp-xapi xcp-eliloader
</nowiki></pre>
+
</pre>
   
   
Line 93: Line 95:
   
   
<pre><nowiki>
+
<pre>
 
mv /etc/grub.d/20_linux_xen /etc/grub.d/09_linux_xen
 
mv /etc/grub.d/20_linux_xen /etc/grub.d/09_linux_xen
 
update-grub
 
update-grub
</nowiki></pre>
+
</pre>
   
   
Line 102: Line 104:
   
   
<pre><nowiki>
+
<pre>
 
cat > /etc/network/interfaces <<EOF
 
cat > /etc/network/interfaces <<EOF
 
# This file describes the network interfaces available on your system
 
# This file describes the network interfaces available on your system
Line 118: Line 120:
   
 
EOF
 
EOF
</nowiki></pre>
+
</pre>
   
   
 
Setup the xensource-inventory file:
 
Setup the xensource-inventory file:
   
<pre><nowiki>
+
<pre>
 
control_domain=`uuidgen`
 
control_domain=`uuidgen`
 
installation=`uuidgen`
 
installation=`uuidgen`
Line 135: Line 137:
 
PRIMARY_DISK='/dev/sda1'
 
PRIMARY_DISK='/dev/sda1'
 
EOF
 
EOF
</nowiki></pre>
+
</pre>
   
   
Line 144: Line 146:
 
Set up your path:
 
Set up your path:
   
<pre><nowiki>
+
<pre>
 
export PATH=$PATH:/usr/lib/xen-common/xapi/bin
 
export PATH=$PATH:/usr/lib/xen-common/xapi/bin
</nowiki></pre>
+
</pre>
   
   
 
Edit the /etc/xensource-inventory file to add your main interface as the management interface, and to tell the storage plugins where your main filesystem is located. It should have lines in approximating the following:
 
Edit the /etc/xensource-inventory file to add your main interface as the management interface, and to tell the storage plugins where your main filesystem is located. It should have lines in approximating the following:
   
<pre><nowiki>
+
<pre>
 
MANAGEMENT_INTERFACE='eth0'
 
MANAGEMENT_INTERFACE='eth0'
 
PRIMARY_DISK='/dev/sda1'
 
PRIMARY_DISK='/dev/sda1'
</nowiki></pre>
+
</pre>
   
   
 
Set up a storage repository. For now, I recommend NFS, or EXT if you have an unused block device. For example:
 
Set up a storage repository. For now, I recommend NFS, or EXT if you have an unused block device. For example:
   
<pre><nowiki>
+
<pre>
 
SR=`xe sr-create type=nfs name-label=nfs device-config:server=<nfs server> device-config:serverpath=<path on server>`
 
SR=`xe sr-create type=nfs name-label=nfs device-config:server=<nfs server> device-config:serverpath=<path on server>`
</nowiki></pre>
+
</pre>
   
 
or
 
or
   
<pre><nowiki>
+
<pre>
 
SR=`xe sr-create type=ext device-config:device=/dev/sda3 name-label=ext`
 
SR=`xe sr-create type=ext device-config:device=/dev/sda3 name-label=ext`
</nowiki></pre>
+
</pre>
   
   
 
Set this as pool default SR:
 
Set this as pool default SR:
   
<pre><nowiki>
+
<pre>
 
POOL=`xe pool-list --minimal`
 
POOL=`xe pool-list --minimal`
 
xe pool-param-set uuid=$POOL default-SR=$SR
 
xe pool-param-set uuid=$POOL default-SR=$SR
</nowiki></pre>
+
</pre>
   
   
 
To install windows, you'll need an iso. These can be served by an NFS server. Try this:
 
To install windows, you'll need an iso. These can be served by an NFS server. Try this:
   
<pre><nowiki>
+
<pre>
 
xe-mount-iso-sr nfs-server:/path/to/isos
 
xe-mount-iso-sr nfs-server:/path/to/isos
</nowiki></pre>
+
</pre>
   
   
 
Then create a windows VM:
 
Then create a windows VM:
   
<pre><nowiki>
+
<pre>
 
xe vm-install template=Windows\ 7\ \(32-bit\) new-name-label=windows
 
xe vm-install template=Windows\ 7\ \(32-bit\) new-name-label=windows
 
xe vm-cd-add vm=windows cd-name=win7.iso device=3
 
xe vm-cd-add vm=windows cd-name=win7.iso device=3
 
xe vm-start vm=windows
 
xe vm-start vm=windows
</nowiki></pre>
+
</pre>
   
   
 
To get networking working, you'll need to manually set up the bridge:
 
To get networking working, you'll need to manually set up the bridge:
   
<pre><nowiki>
+
<pre>
 
brctl addbr xenbr0
 
brctl addbr xenbr0
 
brctl addif xenbr0 eth0
 
brctl addif xenbr0 eth0
</nowiki></pre>
+
</pre>
   
   
Line 205: Line 207:
   
   
<pre><nowiki>
+
<pre>
 
xe pif-scan
 
xe pif-scan
</nowiki></pre>
+
</pre>
   
   
Line 215: Line 217:
   
   
<pre><nowiki>
+
<pre>
 
wget http://downloads.xen.org/XCP/debian/xs-tools-5.9.960.iso
 
wget http://downloads.xen.org/XCP/debian/xs-tools-5.9.960.iso
 
mv xs-tools-5.9.960.iso /usr/lib/xen-common/xapi/packages/iso
 
mv xs-tools-5.9.960.iso /usr/lib/xen-common/xapi/packages/iso
</nowiki></pre>
+
</pre>
   
   
Line 227: Line 229:
 
The easiest way to compile the XCP toolstack from source is to use the [https://github.com/jonludlam/xapi-autobuilder xapi-autobuilder].
 
The easiest way to compile the XCP toolstack from source is to use the [https://github.com/jonludlam/xapi-autobuilder xapi-autobuilder].
   
<pre><nowiki>
+
<pre>
 
git clone https://github.com/jonludlam/xapi-autobuilder.git
 
git clone https://github.com/jonludlam/xapi-autobuilder.git
 
cd xapi-autobuilder
 
cd xapi-autobuilder
 
make clean ; make
 
make clean ; make
</nowiki></pre>
+
</pre>
   
 
Requirements for xapi-autobuilder:
 
Requirements for xapi-autobuilder:
Line 240: Line 242:
   
   
<pre><nowiki>
+
<pre>
 
wget http://downloads.xen.org/XCP/debian/blktap-dkms_0.1_all.deb
 
wget http://downloads.xen.org/XCP/debian/blktap-dkms_0.1_all.deb
</nowiki></pre>
+
</pre>
   
   
Line 249: Line 251:
 
You can manually download all of the latest packages and source packages using:
 
You can manually download all of the latest packages and source packages using:
   
<pre><nowiki>
+
<pre>
 
wget -r -l1 --no-parent -nd http://downloads.xen.org/XCP/debian/latest/
 
wget -r -l1 --no-parent -nd http://downloads.xen.org/XCP/debian/latest/
 
rm index.html*
 
rm index.html*
</nowiki></pre>
+
</pre>
 
[[Category:XCP]]
 
[[Category:HowTo]]
 
[[Category:Design Document]]
 
[[Category:Developers]]
 
[[Category:Users]]
 

Latest revision as of 14:11, 11 July 2013


Installing xapi on Debian Unstable

This is Project Kronos. Follow theses instructions to get xapi, the XenAPI server daemon, installed on a Debian unstable box, using the upstream Linux kernel. This will effectively allow you to turn an existing Debian machine into an XCP host. Note that this is *very much* a work-in-progress. Some features will be broken, and there will be a bit of manual configuration required. We appreciate any testing you do for this project, but please don't consider this production ready yet! Please visit the Kronos Supported Features page for a list of XCP features that are known to work on Kronos.

1. Install Debian Squeeze

1.5 Install firmware (only if necessary - http://wiki.debian.org/Firmware)

  • (Install any firmware required - may not be necessary)

So, for example:


echo "deb http://ftp.uk.debian.org/debian/ squeeze non-free" >> /etc/apt/sources.list


apt-get update


apt-get install firmware-bnx2


2. Convert to Unstable:

  • Edit /etc/apt/sources.list and replace 'squeeze' with 'unstable'
perl -pi -e 's/squeeze/unstable/g' /etc/apt/sources.list


apt-get update


apt-get dist-upgrade


3. Edit /etc/apt/sources.list and add a line for experimental

echo "deb http://ftp.uk.debian.org/debian/ experimental main" >> /etc/apt/sources.list


apt-get update


4. Install Xen hypervisor and dom0 kernel

apt-get install xen-hypervisor-4.1-amd64 linux-image-3.0.0-2-686-pae


5. Set up a Debian apt sources repo. This will update your system with the latest Kronos packages from our build server.

apt-get install curl
echo "deb http://downloads.xen.org/XCP/debian/repo/debian unstable main" > /etc/apt/sources.list.d/kronos.list
echo "deb-src http://downloads.xen.org/XCP/debian/repo/debian unstable main" >> /etc/apt/sources.list.d/kronos.list
wget --quiet -O - http://downloads.xen.org/XCP/debian/xcp.gpg.key | apt-key add -
apt-get update
apt-get install xcp-xapi xcp-eliloader


Once you've installed these packages, you can just do an `apt-get update && apt-get upgrade` to keep up with the latest builds.

6. Post-install setups

Optional: Make xen the default grub entry:


mv /etc/grub.d/20_linux_xen /etc/grub.d/09_linux_xen
update-grub


Setup the network/interfaces file:


cat > /etc/network/interfaces <<EOF 
# 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 xenbr0
iface lo inet loopback

# The primary network interface
iface eth0 inet manual

iface xenbr0 inet dhcp
	bridge_ports eth0

EOF


Setup the xensource-inventory file:

control_domain=`uuidgen`
installation=`uuidgen`

cat > /etc/xensource-inventory << EOF
CURRENT_INTERFACES='xenbr0'
BUILD_NUMBER='0'
CONTROL_DOMAIN_UUID='${control_domain}'
INSTALLATION_UUID='${installation}'
MANAGEMENT_INTERFACE='xenbr0'
PRIMARY_DISK='/dev/sda1'
EOF


6. Reboot.

Using XCP

Set up your path:

export PATH=$PATH:/usr/lib/xen-common/xapi/bin


Edit the /etc/xensource-inventory file to add your main interface as the management interface, and to tell the storage plugins where your main filesystem is located. It should have lines in approximating the following:

MANAGEMENT_INTERFACE='eth0'
PRIMARY_DISK='/dev/sda1'


Set up a storage repository. For now, I recommend NFS, or EXT if you have an unused block device. For example:

SR=`xe sr-create type=nfs name-label=nfs device-config:server=<nfs server> device-config:serverpath=<path on server>`

or

SR=`xe sr-create type=ext device-config:device=/dev/sda3 name-label=ext`


Set this as pool default SR:

POOL=`xe pool-list --minimal`
xe pool-param-set uuid=$POOL default-SR=$SR


To install windows, you'll need an iso. These can be served by an NFS server. Try this:

xe-mount-iso-sr nfs-server:/path/to/isos


Then create a windows VM:

xe vm-install template=Windows\ 7\ \(32-bit\) new-name-label=windows
xe vm-cd-add vm=windows cd-name=win7.iso device=3
xe vm-start vm=windows


To get networking working, you'll need to manually set up the bridge:

brctl addbr xenbr0
brctl addif xenbr0 eth0


You may need to move the IP address to the bridge rather than the physical interface. Having done this, try a pif-scan:


xe pif-scan


This might create the network for your interface.

PV drivers for Windows

wget http://downloads.xen.org/XCP/debian/xs-tools-5.9.960.iso
mv xs-tools-5.9.960.iso /usr/lib/xen-common/xapi/packages/iso


After doing this, rescan the SR to pick up the new ISO.

Compiling from source

The easiest way to compile the XCP toolstack from source is to use the xapi-autobuilder.

git clone https://github.com/jonludlam/xapi-autobuilder.git
cd xapi-autobuilder
make clean ; make

Requirements for xapi-autobuilder:

pbuilder debhelper dh-ocaml dh-autoreconf cdebootstrap python-debian mercurial git

Note that you will also need to install blktap-dkms_0.1_all.deb from http://downloads.xen.org/XCP/debian/latest


wget http://downloads.xen.org/XCP/debian/blktap-dkms_0.1_all.deb


This will build all of the required packages for Xapi on Debian (except for vncterm, which is only available as a binary until we sort out licensing issues). Take a look at xapi-autobuilder/build.sh to see what's going on inside, and modify that script to point to your own repositories if you plan on compiling your own code.

You can manually download all of the latest packages and source packages using:

wget -r -l1 --no-parent -nd http://downloads.xen.org/XCP/debian/latest/
rm index.html*