XenClientPreface

Wat’s the best way to deploy XenClient?

That’s pretty much up to YOU, which way you prefer and you might have answered this before. As you know typically you’ll get access to the XenClient installer by downloading the ISO image form the Citrix website. After that you have the choice to:

  • Burn a CD and boot form the optical media
  • Create a USB stick and boot from the USB media
  • Create a PXE boot environment and boot form network

I actually use all of these methods, where PXE is my favorite one, just due to the flexibility, speed and I often use notebooks where the CD-Rom bay is being used for a 2nd harddrive.

However, there’s a huge drawback, you wont have a working PXE environment in some locations, or you’re not allowed to set the required options in the DHCP infrastructure.

So I thaught, specifically since XenClient 2 (still TechPreview) does have (experimental) Linux guest OS support, let me create a environment based on a XenCLient Linux VM, which provides all necessary services for network installations.

There’s not much new information about creating such an environment, I’ve written blogs about XenClient PXE install and creating a bootable memory stick.

PXE boot: /blogs/?p=168854068
Bootable Memory Stick: /blogs/?p=157324829

I just found it extremely helpful and wanted to share my best practices….and adapt the imnformation to make that a portable/XenClient VM based approach which can travel with you!

What is needed?

  • XenClient capable notebook – http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300408
  • XenClient 2.0 (TechPreview) – http://www.citrix.com/English/ps2/products/feature.asp?contentID=2300346
  • Ubuntu 11.04 – http://www.ubuntu.com/download/ubuntu/download
  • Internet connection
  • Switch / Network cables

Step 1: Installing Ubuntu and the infrastructure services

Install Base Ubuntu

Because I regularly do various testing with Linux I just keep an ISO file in my repository on the XenClient.

Note: SSH (daemon) is turned of by default, to enable it:

  • Open a terminal Ctrl-t in the UIVM (Citrix Receiver for XenClient)
  • enter: touch /config/ssh_enabled
  • Reboot XenClient

Now copy the ubuntu-11.04-desktop-i386.iso file to your XenClient to the directory /storage/isos.
(I use Filezilla as a scp client)
After the copy is done press Ctrl+Q in order to reload the GUI, so it will re-read the ISO directory.

Create a new VM – use all default values. After the failed boot, go into VM details and edit the field Tools CD in order to attach the ubuntu iso image.

Create Linux VMChange ISO

Now you can boot from the ISO and start your ubuntu installation

I always choose to Download updates while installing in order get the latest fixes.

When done make sure the xc-tools is selected as Tools-CD before you reboot Ubuntu.

Use the System -> Administrator -> Update Manager to get the latest updates.

Let’s install ssh(d), so we can work form another terminal: Applications -> Ubuntu Software Center.

After installing ssh you can login from any unix system e.g. ssh walterh@192.168.1.138 or putty on Windows.

After login get a root shell by enter: sudo bash

The first thing we’re going to do is installing the XenClient Tools, which are on the xc-tools iso as debian package.
If all goes well you should see the Installed Tools on the UIVM (Note: you need the –force-all option.

Tools InstallTools Installed

In the next steps we’ll install the required services, such as dhcp, tftp and ftp. In my example I also added apache, samba, webmin and wireshark (for troubleshooting).

Various Software Installations

  • apt-get autoremove (removes obsolete packages)
  • apt-get install dhcp3-server
  • apt-get install apache2
  • apt-get install php5
  • apt-get install proftpd
  • apt-get install tftpd-hpa
  • apt-get install samba
  • apt-get install swat (samba management on port 901)
  • apt-get install wireshark (network capture / packet decoder)
  • apt-get install mc
  • wget http://prdownloads.sourceforge.net/webadmin/webmin_1.550_all.deb
    • apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions
    • dpkg -i webmin_1.550_all.deb
  • wget http://www.rivetcode.com/files/phpftpwho/phpftpwho-1_06.tar.gz
    • extract the archive to /var/www

Note: The red ones are needed for a PXE environment.

Step 2:Setting up services

As might have seen the dhcp server wasn’t started after the installation, due to missing configuration which is good.
If you’re running that VM in a real network, the dhcp server may cause big troubles, so in config the dhcp server is always being started manually.

You can turn autostart off by issuing: update-rc.d isc-dhcp-server disable

I suggest to now taking your XenClient off-line, means attach it to a switch / hub which isn’t connected to any other network. Once this is done, you have to assign a fixed IP address to XenClient and the VM we just created. This can be accomplished on the Citrix Receiver Screen -> Network -> Network Connections -> Edit (for XenClient). For Ubuntu edit the /etc/network/interfaces file.

Network Settingsinterfaces

Configure the dhcp server

We can stick with a quit simple configuration for this setup; just add the following lines to the file /etc/dhcp/dhcpd.conf:

subnet 192.168.1.0 netmask 255.255.255.0 {
next-server 192.168.1.101;
range 192.168.1.101 192.168.1.127;
filename “pxelinux.0”;
server-name “192.168.1.101”;
option routers 192.168.1.1 , 192.168.1.50;
}

The next server points to the tftp server (itself) and the filename to the bootstrap file being used.
With this configuration the dhcp server should be able to start, verify with:

root@Isserver:~# service isc-dhcp-server start
* Starting ISC DHCP server dhcpd                                        [ OK ]
root@Isserver:~#

Configure anonymous FTP access

Uncomment the section of the Anonymous ftp in the file /etc/proftpd/proftpd.conf.

Anonymous FTP

Restart the ftp daemon (service proftpd restart) and try point your browser to that url to see if anonymous ftp works (ftp://192.168.1.101).

Copy the installer files

  • Copy the XenClient installer ISO to your Linux host
  • Mount the ISO file
    e.g. mount -o loop /root/XenClient_2_TechPreview_installer.iso /mnt
  • copy the directory packages.main to the directory /srv/ftp
    e.g. cp -R /mnt/packages.main /srv/ftp
  • copy the content of the directory isolinux to the tftproot root directory
    e.g. cp -R /mnt/isolinux/* /var/lib/tftpboot
  • copy the bootstrap file to the tftproot
    e.g. cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot

Step 3: Create your XenClient PXE configuration

Now we can go ahead and make the actual PXE configuration, this consists of a single file /var/lib/tftpboot/pxelinux.cfg/default or can be made for multiple / any machine based on the Ethernet mac address.

This will be the configuration for our server:

default xenclient-pxe
label xenclient-pxe
DISPLAY bootmsg.txt
kernel mboot.c32
append xen.gz console=com1,vga max_dom0_vcpus=1 com1=115200/921600,8n1,magic — vmlinuz quiet console=xencons root=/dev/ram rw start_install answerfile=tftp://192.168.1.101/answerfile.pxe — rootfs.gz

Everything after the “append” has to be on a single line.
Note: There’s a reference to a answer file for the installer which points to tftp://192.168.1.101/answerfile.pxe

Create an answer file as with nano /var/lib/tftpboot/answerfile.pxe:

In this answerfile the installation will be pretty much manual as with the CD install.
Obviously there are many option how you can influence and keep it “silent”.

I also enabled ssh, which is disabled by default.

Step 4: Use your XenClient PXE infrastructure

You’re pretty much set, when ever you need to deploy a XenClient somewhere take your XenClient notebook and one of these small hubs / switches and a few patch cables.

  • Connect your XenClient and the “to be installed” unit to your network hub / switch and boot the XenClient
  • Make sure you’re using the static IP address, so the network is being properly configured
  • Start the Ubuntu VM
  • Open a terminal and enter: sudo service isc-dhcp-server start to enable the dhcp server
  • Boot the “to be instgalled” XenClient form network

A nice thing is really the flexibility using different pxelinx.cfg and answer files.

e.g. My Dell has no CD-Rom, but a 2nd hard drive in the bay, o I configured a pxelinx.cfg file for that Dell which points to a different answerfile where the installation target is NOT the first, but 2nd H of the system (sdb). Additionally want to joggle between multiple versions – Just make a soft link in the ftp directory which points to right location of the packages.main.

Remember once you got XenClient 2 deployed updating will be even easier, we did implement the foundation for a “over the air upgrade” in this release 🙂

Happy installing and lots of fun with your XenClient!

Walter Hofstetter