You're reading a how-to that is part of our new Learn Beta. Track your progress. Earn badges. Learn IT! Read More about the beta experience.

Introduction

During our transition from individual workstations to a VMWare View VDI setup, we decided to try and reuse some of our older workstations, to squeeze the last few drops of usefulness out of them. VMWare has an excellent tutorial on how to replace the stock explorer.exe shell with the Windows View client:

however, performing these tasks on 50+ workstations looked like a daunting task. Instead, I looked to the Linux community and decided on PXE boot. Fortunately for me, I was not the first person to walk down this path. Much of the following is pulled, stolen and massaged from the following sites:

a. VMWare only supports the LTS Ubuntu releases, 12.04 (Precise) and 10.04 (Lucid). I’m sure there are ways to get this to work in a different Debian based distros, however that’s beyond my limited Linux knowledge.

b. I initially tried and failed to use the NFS server on my EMC VNXe 3300. I’m not sure why, but Ubuntu gave me an ‘RPC: 5’ error when trying to boot. If I can find someone who knows why and can fix it, I’ll update this.

c. Finally, I used Microsoft WDS as the TFTP/boot server. I already had the WDS server up and going, so it seemed like an easier path than setting up a new one. There are instructions on how to setup a Linux based TFTP server on the above websites.

Steps
(2 total)

1

The NFS Server/Client root

1. The first thing we need is an NFS server. Create a Linux server (hardware or VM) and install Ubuntu 12.04 server. I found it was best to keep the versions identical between systems. We’ll need a few things from apt:
a. sudo apt-get –y install nfs-kernel-server nfs-common debootstrap nano

2. After that gets done downloading and installing, we need a directory to point the NFS server at.
a. sudo mkdir /nfs

3. Now we need to let NFS server know about the directory. Switch to the /etc directory (cd /etc) and use your favorite command line file editor to add the directory to the ‘exports’ file. (I prefer nano. Replace the ‘192.168.10.0/255.255.255.0’ with your subnet. If you just want to allow everybody access, replace it with a *.)
a. sudo nano exports
b. /nfs 192.168.10.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check)
c. sudo exportfs –a (lets the NFS server know about the new exports)
d. sudo service nfs-kernel-server restart (restarts the NFS server)

4. The NFS server will act as the root of the installation, so we need to install the base Ubuntu package into the /nfs directory. This will download, expand and install a very, very minimal version of Ubuntu in the NFS directory. Still it took about 5-10 minutes on my system, so it’s a good time to get a cup of coffee or Diet Coke.
a. sudo debootstrap --arch i386 precise /nfs

7. Now we need the timezone files from the NFS server copied over to the NFS client system. You’ll need to change the XXXX to the kernel version that you’re using. The easiest way I found was to type in the command up to the / after ‘modules’ and press the TAB key. Ubuntu will fill in the rest. You could also pass the ‘uname –r command’ and get the name.

8. Finally, we need to add the Canonical partners to sources.list and copy it over.
a. sudo nano /etc/apt/sources.list
b. Find the ‘Partners’ section and remove the # signs from those two lines, then save the file and exit nano.
c. sudo cp /etc/apt/sources.list /nfs/etc/apt/sources.list

9. Next, there’s some packages we need to install on the NFS client system. There are two ways to do this. Boot into the client system and install the packages (which we don’t have all the pieces in place yet), or chroot into the system and do it from the NFS server. We’ll just chroot into it for now.
a. sudo chroot /nfs
i. Note that this drops you into the client system as root, so you don’t need to sudo your commands while in this side. The standard warnings about running as root apply.
b. apt-get update
c. apt-get –y install lxde lxdm xorg vmware-view-client:i386 ifupdown locales netbase net-tools iproute apt-utils alsa-base
i. This is going to download and install a lot of stuff. Coffee break!

11. There’s no hostname on the system. If you’re going to boot more than one PXE workstation, it’s recommended that you have your DHCP server name the machines. Just to get things up and going, though, we’ll give it a name and change it later when things go live.
a. echo “TESTING” > /etc/hostname

12. Finally, setup any users and passwords.
a. chpassword root
i. Follow the steps
b. adduser mis
i. Follow those steps. This will be for administering the system without logging in as root. You can name it whatever you want.
c. Finally, add a ‘view’ user with the same command as the user mis, this will be an auto login user so the users don’t have to login to get to their View login.

13. Now, exit the chroot system.

14. We are going to make some customizations to LXDE to auto login as the view user, remove as much of the user interface as possible and autostart the View Client.

15. A quick note on USB redirection. It doesn’t work out of the box with the View Client. There’s a file from HP called vmware-view-usb that can be found on HP’s website. When you get that, copy it to the /usr/bin directory on the NFS client (the full directory would be /nfs/usr/bin on the server). You’ll then need to apply this command:
a. sudo chmod 4755 /nfs/usr/bin/vmware-view-usb
To make it all work. I’m not going to link to the file, since I’m fairly certain this breaks HP’s EULA. It’s not hard to find, though.

16. Create a script to autostart the VMWare View client and restart it if it’s closed out.
a. cd /home/view
b. nano viewstarter
#!/bin/bash
while true; do
vmware-view.bin --serverURL= URLofViewServer --domainName=ADDomainName --desktopSize=full
done
1. The vmware-view.bin line needs to be on one line. There are a lot of different command line options you can apply here. More info here: http://www.vmware.com/pdf/view-client-linux-document.pdf

17. CD to the /nfs/etc/xdg/lxsession/LXDE/ directory, nano into autostart and add a line that says ‘@~/viewstart’ (no quotes) to the file. While you’re in that file, put a # in front of ‘@lxpanel –profile LXDE’ line. This will make most of the stuff in LXDE inaccessible. Also put a # in front of ‘@xscreensaver –no-splash’ line, this disables the screensaver.

18. CD to the /nfs/etc/xdg/openbox directory and use nano to edit that file and remove everything between the and lines.

19. CD to the /nfs/etc/lxdm and nano lxdm.conf. Uncomment the line ‘autologin=’ and put in ‘view’ (no quotes).

2

The Client

20. Now, we’ll need one of client workstations to install Ubuntu onto, mine is a Dell Optiplex 330. Ideally you’ll do this for all your different hardware to ensure the kernel is 100% compatible, but I also tested the same image and kernel with a Gateway e4300 and it worked fine. To save time, I used Ubuntu Minimal:

a. Note: The samba stuff below allows you to be able to copy the kernel, syslinux and the RAM image to a Windows machine. I needed this since I’m using WDS as the TFTP server. If you’re using a Linux TFTP server, you won’t need this, and a lot of the following can be done on the TFTP server (as long as it’s the same make and model of Linux), saving copying the files around.

21. After you get it installed and logged in, we need to install some stuff.
a. sudo apt-get install syslinux samba samba-common

24. Save and close the file, then restart Samba
a. sudo service smb restart
i. You should be able to open the share on your Windows box now. You won’t be able to copy anything to there, but it’s not important right now.

25. Now we edit the initramfs.conf file to tell Ubuntu what we’re doing.
a. sudo nano /etc/initramfs-tools/initramfs.conf
i. Change the ‘MODULES=most’ line to read ‘MODULES=netboot’
ii. Change the ‘BOOT=local’ line to read ‘BOOT=nfs’
iii. Save and close the file

27. On your Windows WDS server, open the share and copy the vmlinuz, initrd, the pxelinux.0 and menu.c32 files somewhere handy. To keep this already epic HOWTO somewhat shorter, I’m going to refer to the syslinux-WDS website at the top. Instead of downloading the various syslinux files, though, use the files from the linux client system that you copied over. Your ‘default’ file (creates the PXE boot menu) will need an additional entry to point at the kernel and stuff. Mine looks like this:

The APPEND line needs to be on a single line.
If everything is setup correctly, your workstations should now be able to PXE boot to the VMWare View client. There are a ton of tweaks that can be done to make things work differently, like removing desktop wallpapers, hiding menus, disabling right clicks, and there are about 10 different command line options just for the VMWare View Client.

Conclusion

I also recompiled the kernel to put NFS and DHCP boot support in that, rather than as modules. As I don’t know if it was necessary, I left that part out.

I hope this helps anybody who needs it.

3 Comments

Nice. Putting the NFS and network support into the kernel is crucial because kernel booted via PXE need to know how to talk Ethernet and how to mount NFS before it get to load anything like modules :) Great work!