pxe boot the ubuntu vmware view client

5
PXE Boot the Ubuntu VMWare View Client Steps During our transition from i ndividual workstations to a VMWare View VDI setup, we decided to try and reuse some of our older workstations, to squeeze the last f ew drops of usefulness out of them. VMWare has an excellent tutorial on how t o replace the stock explorer.exe shell with the Windows View client: http://communities.vmware.com/serv let/JiveServlet/previewBody/17 901-102-1-23069 /PC%20Re-purposing%20with%20VMware%20 View%20client%20for%20Windows.pdf ) 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 fi rst person to walk down this path. Much of the following is pulled, stolen and massaged from the following sites: http://communities.vmware.com/thread/390022?start=0&tstart=0  http://mindref.blogspot.com/2011/03/debian-diskless.html  http://www.syslinux.org/wiki/index.php/WDSLINUX   A couple of notes before w e start: 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 t o 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 f ix 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. 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 pre fer 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 5. We need to configure our new system. First fstab a. sudo nano /nfs/etc/fstab  proc /proc proc defaults 0 0 /dev/nfs / nfs defaults 1 1 none /tmp tmpfs defaults 0 0 #none /var/run tmpfs defaults 0 0 #none /var/lock tmpfs defaults 0 0

Upload: melvin-matos

Post on 14-Apr-2018

256 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PXE Boot the Ubuntu VMWare View Client

7/30/2019 PXE Boot the Ubuntu VMWare View Client

http://slidepdf.com/reader/full/pxe-boot-the-ubuntu-vmware-view-client 1/5

PXE Boot the Ubuntu VMWare View Client

Steps

During our transition from i ndividual workstations to a VMWare View VDI setup, we decided to try and reuse some of our older workstations, to squeeze the last f ew drops of usefulness out of them. VMWare hasan excellent tutorial on how t o replace the stock explorer.exe shell with the W indows View client:

http://communities.vmware.com/servlet/JiveServlet/previewBody/17901-102-1-23069/PC%20Re-purposing%20with%20VMware%20View%20client%20for%20Windows.pdf )

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 fi rst person to walk downthis path. Much of the following is pulled, stolen and massaged from the following sites:

http://communities.vmware.com/thread/390022?start=0&tstart=0 

http://mindref.blogspot.com/2011/03/debian-diskless.html 

http://www.syslinux.org/wiki/index.php/WDSLINUX 

 A couple of notes before we start:

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 Linuxknowledge.

b. I initially tried and failed t o 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 f ix it, I’llupdate 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 Linuxbased TFTP server on the above websites.

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 pre fer 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

5. We need to configure our new system. First fstaba. sudo nano /nfs/etc/fstab

 proc /proc proc defaults 0 0

/dev/nfs / nfs defaults 1 1

none /tmp tmpfs defaults 0 0

#none /var/run tmpfs defaults 0 0

#none /var/lock tmpfs defaults 0 0

Page 2: PXE Boot the Ubuntu VMWare View Client

7/30/2019 PXE Boot the Ubuntu VMWare View Client

http://slidepdf.com/reader/full/pxe-boot-the-ubuntu-vmware-view-client 2/5

none /var/tmp tmpfs defaults 0 0

none /media tmpfs defaults 0 0

none /var/log tmpfs defaults 0 0

6. Now the network interface config file. Some references have the

‘manual’ set to ‘dhcp’. I had some minor issues with this, although it was

exceedingly rare.

a. sudo nano /nfs/etc/network/interfaces

auto lo

iface lo inet loopback 

iface eth0 inet manual

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.

a. sudo cp /etc/timezone /srv/diskless/c1/etc/timezone

 b. sudo cp /etc/localtime /srv/diskless/c1/etc/localtime

c. sudo cp -r /lib/modules/XXXX/ /srv/diskless/c1/lib/modules/

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 /nfsi. Note that this drops you into the client system as r oot, 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!

10. Configure locale

a. echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen

 b. locale-gen en_US.UTF-8

c. update-locale LANG=en_US.UTF-8

d. dpkg-reconfigure -u tzdata

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 

Page 3: PXE Boot the Ubuntu VMWare View Client

7/30/2019 PXE Boot the Ubuntu VMWare View Client

http://slidepdf.com/reader/full/pxe-boot-the-ubuntu-vmware-view-client 3/5

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 wor k. 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 <menu id=”root-menu”

label=”Openbox 3”> and </menu> lines. 

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

Page 4: PXE Boot the Ubuntu VMWare View Client

7/30/2019 PXE Boot the Ubuntu VMWare View Client

http://slidepdf.com/reader/full/pxe-boot-the-ubuntu-vmware-view-client 4/5

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:

https://help.ubuntu.com/community/Installation/MinimalCD 

This will keep things a little tidier as we build the thing.

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

22. After that’s done crunching… 

a. sudo mkdir /share

 b. sudo nano /etc/samba/smb.conf 

23. Add the following lines to smb.conf 

[incoming]

comment = incoming

writable = yes

 path = /share

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. Youwon’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

26. Copy the kernel, syslinux and make a new RAM image

a. sudo cp – r /boot/vmlinuz-`uname – r` /share

i. Those are backticks (or a grave accent) around the uname – r. It shares

the key with the tilde.

 b. sudo mkinitramfs – d /etc/initramfs-tools – o /share/initrd.img-`uname – 

r` `uname – r`i. Again with the backticks!

c. sudo cp – r /usr/lib/syslinux/pxelinux.0 /share

d. sudo cp – r /usr/lib/syslinux/menu.c32 /share

27. On your Windows WDS server, open the share and copy the

vmlinuz, initrd, the pxelinux.0 and menu.c32 files somewhere handy. To

Page 5: PXE Boot the Ubuntu VMWare View Client

7/30/2019 PXE Boot the Ubuntu VMWare View Client

http://slidepdf.com/reader/full/pxe-boot-the-ubuntu-vmware-view-client 5/5

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:

LABEL View Client

MENU View ClientKERNEL Linux/Ubuntu_12.04/vmlinuz-3.2.34

APPEND root=/dev/nfs nfsroot=192.168.10.102:/nfs

initrd=Linux/Ubuntu_12.04/initrd.img-3.2.34 rw quiet

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.