X Windows Terminal
(→links) |
m (Protected "X Windows Terminal": nonstop barrage of garbage edits from rotating IPs [edit=sysop:move=sysop]) |
||
(53 intermediate revisions by 16 users not shown) | |||
Line 8: | Line 8: | ||
* Everything can be backed up centrally. | * Everything can be backed up centrally. | ||
* Boot times for client PC's are the fastest around. | * Boot times for client PC's are the fastest around. | ||
− | * Clients don't need much CPU speed, memory, etc. Because of this they would be very cheap. You could get away with using a Pentium 100Mhz with 32MB ram, no hard drive, no CD-ROM, no Floppy and a fanless power supply. You just need a ethernet card with a PXEBOOT ROM. | + | * Clients don't need much CPU speed, memory, etc. Because of this they would be very cheap. You could get away with using a Pentium 100Mhz with 32MB ram, no hard drive, no CD-ROM, no Floppy and a fanless power supply. You just need a ethernet card with a PXEBOOT ROM. (XDM mode) |
+ | * Central management of applications, users, config | ||
==From the Beginning== | ==From the Beginning== | ||
Line 15: | Line 16: | ||
Install FreeBSD 6.1 as per usual. | Install FreeBSD 6.1 as per usual. | ||
I've setup my mount points as this: | I've setup my mount points as this: | ||
− | Swap | + | '''Part Mount Size''' |
− | / | + | ad0s1b Swap (equal to how much memory I have in my machine) |
− | /var | + | ad0s1a / 512MB |
− | /tmp | + | ad0s1d /var 1G |
− | /usr | + | ad0s1e /tmp 512MB |
+ | ad0s1f /usr 2GB min. | ||
+ | /diskless_ro 512MB | ||
+ | /diskless_rw 1GB min. | ||
I selected 'A' for auto and then deleted /usr and created /usr as 2g. | I selected 'A' for auto and then deleted /usr and created /usr as 2g. | ||
− | Select User-X install. | + | Select User-X install. Yes to Ports if you have the room. |
− | Select SSH Server and NFS Server in the installation process | + | Select SSH Server and NFS Server in the installation process, for the rest of the options go with the default. |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | NOTE: If you forget to add any of the labels above, you will have to reboot as you cannot add labels to your boot drive when you have booted off it. So boot of the installation CD and use the configure -> label option in the sysinstall screen to add these labels to your boot drive. You may need to retype the mount points for /, /var, /tmp and /usr by hitting 'm' on each label. Once you have created these labels in the 'Disklabel Editor' then you can hit 'w' to write them to the disk. answer 'yes' to the next question, hit 'ok' to the warning message. Now quit and reboot. Add them to fstab (/dev/ad0s1g /diskless_ro) & (/dev/ad0s1h /diskless_rw) and mount. | ||
I find the best way to get this working is to break it down in to small steps and get each step working independantly. IE: Setup NFS and see if you can mount it from another FreeBSD machine, don't just assume it will work and boot your PXE-Boot machine. | I find the best way to get this working is to break it down in to small steps and get each step working independantly. IE: Setup NFS and see if you can mount it from another FreeBSD machine, don't just assume it will work and boot your PXE-Boot machine. | ||
Line 46: | Line 46: | ||
At this point I normally install fluxbox with the following line: | At this point I normally install fluxbox with the following line: | ||
− | shell# pkg_add -r fluxbox-devel | + | shell# pkg_add -r fluxbox-devel |
change your ~/.xinitrc file to the following: | change your ~/.xinitrc file to the following: | ||
− | startfluxbox | + | startfluxbox |
+ | |||
+ | Copy to .xsession | ||
+ | $ ln -s ~/.xinitrc ~/.xsession | ||
Use the following command to update your fluxbox menus: | Use the following command to update your fluxbox menus: | ||
− | shell$ fluxbox-generate_menu | + | shell$ fluxbox-generate_menu |
==Running a single application== | ==Running a single application== | ||
− | To get started I have my server setup running FreeBSD, with X-Windows and a few applications. Nothing too special. Then I have my client PC, which to start off I used the | + | To get started I have my server setup running FreeBSD, with X-Windows and a few applications. Nothing too special. Then I have my client PC, which to start off I used the frenzy 1.0 boot CD to perform these initial tests. You can get this from [http://frenzy.org.ua/eng/ frenzy website]. I entered into fluxbox, but you could equally use any X session. |
− | + | ||
You must allow incoming connections this is done with two commands | You must allow incoming connections this is done with two commands | ||
− | client | + | client$ startx -listen_tcp |
− | client | + | client$ xhost + |
This allows all computers to start applications on your client PC. It's dangerous but good for testing everything is setup correctly. | This allows all computers to start applications on your client PC. It's dangerous but good for testing everything is setup correctly. | ||
− | client | + | client$ ssh <server user@server ip> |
eg: ssh mick@192.168.1.1 | eg: ssh mick@192.168.1.1 | ||
− | ssh$ | + | ssh$ export DISPLAY='192.168.1.2:0' |
Or if your running bash: | Or if your running bash: | ||
Line 100: | Line 102: | ||
Whilst in the /usr/X11R6/lib/X11/xdm directory do these commands: | Whilst in the /usr/X11R6/lib/X11/xdm directory do these commands: | ||
− | shell# vi Xstartup | + | shell# vi Xstartup |
Add into this file: | Add into this file: | ||
Line 125: | Line 127: | ||
Make sure your firewall has all traffic for you lan. (Need to know which exact ports to allow). | Make sure your firewall has all traffic for you lan. (Need to know which exact ports to allow). | ||
− | |||
− | |||
− | |||
− | |||
<b>run xdm on server as root</b> | <b>run xdm on server as root</b> | ||
+ | |||
+ | shell# xdm | ||
+ | |||
You can put this xdm into the /etc/ttys so that it starts automatically on boot up. | You can put this xdm into the /etc/ttys so that it starts automatically on boot up. | ||
Line 145: | Line 146: | ||
shell# X -query 192.168.1.1 | shell# X -query 192.168.1.1 | ||
− | |||
==DHCP - Install and setup== | ==DHCP - Install and setup== | ||
Server setup. | Server setup. | ||
− | + | install through package | |
− | install | + | # pkg_add -r isc-dhcp3-server |
We do this so we can define the root path for the diskless system. | We do this so we can define the root path for the diskless system. | ||
Line 217: | Line 217: | ||
dhcpd_enable="YES" | dhcpd_enable="YES" | ||
</pre> | </pre> | ||
+ | |||
+ | ===Using a seperate DHCP server=== | ||
+ | If you already have a DHCP server and you want to use that instead then you have to do these steps. | ||
+ | |||
+ | |||
+ | ====On your DHCP Server==== | ||
+ | 1. edit /usr/local/etc/dhcpd.conf and add the following | ||
+ | <pre> | ||
+ | authoritative; | ||
+ | ddns-update-style none; | ||
+ | |||
+ | option root-path "<X Server IP>:/diskless_ro"; | ||
+ | |||
+ | # lines added for pxeboot client | ||
+ | use-host-decl-names on; | ||
+ | next-server <X Server IP>; | ||
+ | filename "pxeboot"; | ||
+ | </pre> | ||
+ | |||
+ | restart dhcpd | ||
+ | # /usr/local/etc/rc.d/isc-dhcpd.sh restart | ||
+ | |||
+ | ====Client==== | ||
+ | Your client should boot now just remember that you may get a different IP now that you are talking to a different DHCP server so you have to change your exports file and copy accross a directory in /diskless_rw for the new IP. All this is done on the X Server. | ||
==TFTP Setup== | ==TFTP Setup== | ||
Line 364: | Line 388: | ||
Copy the following files from the systems /etc directory to /diskless_rw/<client ip>/etc | Copy the following files from the systems /etc directory to /diskless_rw/<client ip>/etc | ||
+ | # cp -Rv <files> /diskless_rw/<ip>/etc | ||
+ | |||
<pre> | <pre> | ||
auth.conf | auth.conf | ||
Line 373: | Line 399: | ||
login.conf | login.conf | ||
login.conf.db | login.conf.db | ||
+ | motd | ||
master.passwd | master.passwd | ||
netconfig | netconfig | ||
protocols | protocols | ||
+ | pam.d | ||
pwd.db | pwd.db | ||
− | + | services8 | |
spwd.db | spwd.db | ||
syslog.conf | syslog.conf | ||
Line 384: | Line 412: | ||
</pre> | </pre> | ||
− | + | Here is a shortcut which you can just copy and paste in an xterm window. | |
+ | # cd /etc | ||
+ | # cp -Rv auth.conf disktab gettytab group hosts login.access login.conf login.conf.db master.passwd motd netconfig protocols pam.d pwd.db services spwd.db syslog.conf termcap ttys /diskless_rw/<ip>/etc | ||
+ | It's very important that you copy all the files in pam.d across otherwise you will not have a password prompt on your login. | ||
+ | |||
+ | Create a fstab in /diskless_rw/<ip>/etc | ||
+ | # touch /diskless_rw/<ip>/etc/fstab | ||
==Setup diskless_ro== | ==Setup diskless_ro== | ||
This is the common root mount for all pxe-boot clients. | This is the common root mount for all pxe-boot clients. | ||
+ | Copy accross important directories and kernel from boot to diskless_ro | ||
<pre> | <pre> | ||
− | # cp -rv /bin /lib /libexec /sbin | + | # cp -rv /bin /lib /libexec /sbin /boot /diskless_ro |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</pre> | </pre> | ||
Line 404: | Line 433: | ||
</pre> | </pre> | ||
− | + | So we can use the systems /var/tmp and /usr/home directory make soft links to them | |
− | + | # cd /diskless_ro | |
− | # | + | # ln -s /var/tmp /usr/home |
− | + | ||
− | + | In the /diskless_ro directory make the following directories: | |
− | + | -dev so that clients can boot without freezing | |
− | # mkdir | + | -var so we can mount from the /diskless_rw/<client ip>/var into the var directory |
− | + | -etc to store some common files | |
+ | # mkdir usr dev var etc | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
We require a few files from the systems /etc directory to be copied into the /diskless_ro/etc for common use between the thin clients. | We require a few files from the systems /etc directory to be copied into the /diskless_ro/etc for common use between the thin clients. | ||
− | + | # cd /etc; | |
− | # | + | # cp services netconfig login.conf /diskless_ro/etc |
− | # cp | + | |
− | + | ||
Line 439: | Line 460: | ||
TMP=~/tmp;export TMP | TMP=~/tmp;export TMP | ||
− | mount -t nfs 192.168. | + | mount -t nfs 192.168.1.1:/usr /usr |
boot_ip=`/sbin/ifconfig | /usr/bin/grep "inet " | /usr/bin/grep -v 127.0.0.1 | | boot_ip=`/sbin/ifconfig | /usr/bin/grep "inet " | /usr/bin/grep -v 127.0.0.1 | | ||
/usr/bin/awk '{print $2}'` | /usr/bin/awk '{print $2}'` | ||
− | + | mount_nfs -L 192.168.1.1:/diskless_rw/${boot_ip}/etc /etc | |
− | + | mount_nfs -L 192.168.1.1:/diskless_rw/${boot_ip}/var /var | |
swapon /var/swap | swapon /var/swap | ||
Line 451: | Line 472: | ||
#rm -rf /var/tmp/.* | #rm -rf /var/tmp/.* | ||
− | X -query 192.168. | + | # Option if you choose XDM terminals |
+ | #X -query 192.168.1.1 | ||
. /etc/rc2 | . /etc/rc2 | ||
Line 457: | Line 479: | ||
</pre> | </pre> | ||
+ | |||
+ | <b>Remember to change 192.168.1.1 to your X server's IP</b> | ||
+ | |||
+ | The -L on the mount_nfs is there so we don't get flock errors. | ||
===rc2 file=== | ===rc2 file=== | ||
Line 472: | Line 498: | ||
Now change permissions so rc can run. | Now change permissions so rc can run. | ||
− | + | # chmod +x rc* | |
− | # chmod +x rc* | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | Copy /diskless_ro/etc/rc and rc2 to /diskless_rw/<client ip>/etc | ||
+ | # cp /diskless_ro/etc/rc* /diskless_rw/192.168.1.2/etc | ||
==GRUB Floppy boot (optional)== | ==GRUB Floppy boot (optional)== | ||
Line 618: | Line 611: | ||
X -query <server ip> | X -query <server ip> | ||
</pre> | </pre> | ||
+ | |||
+ | Make sure on the server you setup xdm to start on system startup | ||
+ | # vi /etc/ttys | ||
+ | |||
+ | Search for this line: | ||
+ | ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure | ||
+ | |||
+ | and change it to: | ||
+ | ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure | ||
+ | |||
You can also type this command at the command line on the client to test before hand. | You can also type this command at the command line on the client to test before hand. | ||
Line 629: | Line 632: | ||
Now type 'startx' at the command line. | Now type 'startx' at the command line. | ||
+ | ==Custom Kernels== | ||
+ | If you want to create custom kernels for your clients then do this: | ||
+ | Create your custom kernel | ||
+ | # cd /sys/i386/conf | ||
+ | # cp GENERIC DISKLESS | ||
+ | # vi DISKLESS | ||
− | + | Make changes and build and install | |
− | + | ||
− | + | # cd /usr/src | |
+ | # make buildkernel KERNCONF=DISKLESS | ||
+ | # make installkernel KERNCONF=DISKLESS DESTDIR=/diskless_ro | ||
− | + | ==Convert an Existing system with standard mount points== | |
+ | If you cannot afford to create /diskless_ro and /diskless_rw then you can use /var/diskless_ro and /usr/diskless_rw instead. | ||
+ | |||
+ | Use the same notes and replace /diskless_ro with /var/diskless_ro and /diskless_rw with /usr/diskless_rw. Make sure you create these directories first. | ||
+ | |||
+ | ==todo== | ||
+ | Here are some of the jobs left to do to make this secure or generally better: | ||
- There must be a simplier way to set this up if your going to use XDM in the end. IE: do we need to do half of this tutorial if we are going to run XDM. | - There must be a simplier way to set this up if your going to use XDM in the end. IE: do we need to do half of this tutorial if we are going to run XDM. | ||
Line 648: | Line 664: | ||
- USB mice not working instead use PS/2. If we got this working it may help get the HP T5525 working | - USB mice not working instead use PS/2. If we got this working it may help get the HP T5525 working | ||
− | ===Keyboard repeating on notebooks | + | ===Keyboard repeating on notebooks=== |
- typing on some keyboards (like my notebook) causes double characters to display if you type too fast. - This is the notebook, if you go and set the KDE Accessabiltiy options and set the keyboard rate to 50ms, this fixes the problem. | - typing on some keyboards (like my notebook) causes double characters to display if you type too fast. - This is the notebook, if you go and set the KDE Accessabiltiy options and set the keyboard rate to 50ms, this fixes the problem. | ||
Line 668: | Line 684: | ||
==links== | ==links== | ||
+ | |||
+ | http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-diskless.html | ||
http://www.onlamp.com/pub/a/bsd/2004/09/09/diskless_server.html | http://www.onlamp.com/pub/a/bsd/2004/09/09/diskless_server.html |
Latest revision as of 00:18, 5 December 2008
[edit] Advantages
X Windows can be used in a Server-Client relationship. By setting up your X Windows Server you allow the use of all the programs on that computer to all the client PC's.
There are many advantages of running client computers in this manner:
- They don't even need a hard drive.
- It's silent as there are no moving parts
- The solution saves power as your computers are very thin.
- Everything can be backed up centrally.
- Boot times for client PC's are the fastest around.
- Clients don't need much CPU speed, memory, etc. Because of this they would be very cheap. You could get away with using a Pentium 100Mhz with 32MB ram, no hard drive, no CD-ROM, no Floppy and a fanless power supply. You just need a ethernet card with a PXEBOOT ROM. (XDM mode)
- Central management of applications, users, config
[edit] From the Beginning
I've based this document on FreeBSD 6.1.
Install FreeBSD 6.1 as per usual. I've setup my mount points as this:
Part Mount Size ad0s1b Swap (equal to how much memory I have in my machine) ad0s1a / 512MB ad0s1d /var 1G ad0s1e /tmp 512MB ad0s1f /usr 2GB min. /diskless_ro 512MB /diskless_rw 1GB min.
I selected 'A' for auto and then deleted /usr and created /usr as 2g.
Select User-X install. Yes to Ports if you have the room.
Select SSH Server and NFS Server in the installation process, for the rest of the options go with the default.
NOTE: If you forget to add any of the labels above, you will have to reboot as you cannot add labels to your boot drive when you have booted off it. So boot of the installation CD and use the configure -> label option in the sysinstall screen to add these labels to your boot drive. You may need to retype the mount points for /, /var, /tmp and /usr by hitting 'm' on each label. Once you have created these labels in the 'Disklabel Editor' then you can hit 'w' to write them to the disk. answer 'yes' to the next question, hit 'ok' to the warning message. Now quit and reboot. Add them to fstab (/dev/ad0s1g /diskless_ro) & (/dev/ad0s1h /diskless_rw) and mount.
I find the best way to get this working is to break it down in to small steps and get each step working independantly. IE: Setup NFS and see if you can mount it from another FreeBSD machine, don't just assume it will work and boot your PXE-Boot machine.
Throughout my documentation
192.168.1.1 = the Server
192.168.1.2 = the client (may be a full freebsd system or pxeboot)
At this point I normally install fluxbox with the following line:
shell# pkg_add -r fluxbox-devel
change your ~/.xinitrc file to the following:
startfluxbox
Copy to .xsession
$ ln -s ~/.xinitrc ~/.xsession
Use the following command to update your fluxbox menus:
shell$ fluxbox-generate_menu
[edit] Running a single application
To get started I have my server setup running FreeBSD, with X-Windows and a few applications. Nothing too special. Then I have my client PC, which to start off I used the frenzy 1.0 boot CD to perform these initial tests. You can get this from frenzy website. I entered into fluxbox, but you could equally use any X session. You must allow incoming connections this is done with two commands
client$ startx -listen_tcp client$ xhost +
This allows all computers to start applications on your client PC. It's dangerous but good for testing everything is setup correctly.
client$ ssh <server user@server ip> eg: ssh mick@192.168.1.1
ssh$ export DISPLAY='192.168.1.2:0'
Or if your running bash:
ssh$ DISPLAY=<client ip>:<client display>; export DISPLAY eg: DISPLAY=192.168.1.2:0; export DISPLAY
ssh$ xcalc &
This should display on your client
[edit] Running a whole X Windows Session (XDM)
This sets up a server so that you can share your X session with any clients which want to connect. (Simular to Terminal Services under windows)
[edit] server
edit:
/usr/X11R6/lib/X11/xdm/xdm-config
comment out with a '!' the request line
DisplayManager.requestPort: 0
edit:
/usr/X11R6/lib/X11/xdm/Xaccess
Enter a single asterisk any where in the file, so the contents should be one asterisk and the rest commented out. There should be an asterisk on line 49 which you can uncomment.
Whilst in the /usr/X11R6/lib/X11/xdm directory do these commands:
shell# vi Xstartup
Add into this file:
#!/bin/sh # # Xstartup # # This program is run as root after the user is verified # if [ -f /etc/nologin ]; then xmessage -file /etc/nologin -timeout 30 -center exit 1 fi sessreg -a -l $DISPLAY -x /usr/X11R6/lib/xdm/Xservers $LOGNAME /usr/X11R6/lib/xdm/GiveConsole exit 0
shell# chmod +x Xstartup
Make sure your firewall has all traffic for you lan. (Need to know which exact ports to allow).
run xdm on server as root
shell# xdm
You can put this xdm into the /etc/ttys so that it starts automatically on boot up.
[edit] client
make sure your not in X
type this command:
shell# X -broadcast
This assumes that you are running only one server. Otherwise use:
shell# X -query 192.168.1.1
[edit] DHCP - Install and setup
Server setup.
install through package
# pkg_add -r isc-dhcp3-server
We do this so we can define the root path for the diskless system.
copy /usr/local/etc/dhcpd.conf.sample to /usr/local/etc/dhcpd.conf
edit /usr/local/etc/dhcpd.conf and make sure it has these lines in it.
# dhcpd.conf # # Sample configuration file for ISC dhcpd # # option definitions common to all supported networks... #option domain-name "example.org"; #option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 3600; max-lease-time 86400; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; # ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates. ddns-update-style none; option root-path "192.168.1.1:/diskless_ro"; # lines added for pxeboot client use-host-decl-names on; next-server 192.168.1.1; filename "pxeboot"; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. # This is a very basic subnet declaration. subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.20; }
Create the leases file
# touch /var/db/dhcpd.leases
Restart the daemon
# killall dhcpd # dhcpd
Add to /etc/rc.conf
dhcpd_enable="YES"
[edit] Using a seperate DHCP server
If you already have a DHCP server and you want to use that instead then you have to do these steps.
[edit] On your DHCP Server
1. edit /usr/local/etc/dhcpd.conf and add the following
authoritative; ddns-update-style none; option root-path "<X Server IP>:/diskless_ro"; # lines added for pxeboot client use-host-decl-names on; next-server <X Server IP>; filename "pxeboot";
restart dhcpd
# /usr/local/etc/rc.d/isc-dhcpd.sh restart
[edit] Client
Your client should boot now just remember that you may get a different IP now that you are talking to a different DHCP server so you have to change your exports file and copy accross a directory in /diskless_rw for the new IP. All this is done on the X Server.
[edit] TFTP Setup
TFTP helps us transport the kernel to the PXE-Boot machines.
# mkdir /tftpboot # cp /boot/pxeboot /tftpboot
Uncomment the following line in /etc/inetd.conf
tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot
Restart the inetd service
# killall -HUP inetd
If inetd has not started automatically do the following:
Add the following to /etc/rc.conf
inetd_enable="YES"
Now start inetd manually.
# inetd
[edit] Test
To test that tftp has loaded type the following:
# sockstat -4l | grep 69
and you should see this:
root inetd 13719 5 udp4 *:69 *:*
[edit] NFS Setup
Network File System. Here we share all the directories from the server so that the diskless clients see these drives as if those directories were the diskless client's.
[edit] Server Setup
If you forgot to select 'Yes' to NFS server setup in the FreeBSD installation then you have to setup the server manually like so:
Enable NFS /etc/rc.conf
rpcbind_enable="YES" nfs_server_enable="YES"
[edit] Test
A quick test to see if your NFS server is acting normal:
Edit the /etc/exports and add the following
/usr -alldirs
This allows anyone to connect to your /usr mount.
Now run these commands to restart and view your mounts
# kill -HUP `cat /var/run/mountd.pid` # showmount -e
Now try and mount it from a client running BSD
# mount -t nfs 192.168.1.1:/usr /mnt
[edit] Server exports setup
Make directories for each IP for your clients
# cd /diskless_rw # mkdir 192.168.1.2 # cd 192.168.1.2 # mkdir etc var
Configure /etc/exports
# file systems accessible only for reading: # Original way of linking up the /usr #/usr -ro -maproot=0 -network 192.168.1.0 -mask 255.255.255.0 /usr -network 192.168.1.0 -mask 255.255.255.0 /diskless_ro -ro -maproot=0 -network 192.168.1.0 -mask 255.255.255.0 /diskless_rw/192.168.1.2/etc /diskless_rw/192.168.1.2/var -maproot=root 192.168.1.2
Restarting NFS
# kill -HUP `cat /var/run/mountd.pid`
If NFS is not started yet do the following:
data# rpcbind data# nfsd -u -t -n 20 -h 192.168.1.1 data# mountd -r
Testing to see if the exports are correct
data# showmount -e Exports list on localhost: /usr 192.168.1.0 /diskless_rw/192.168.1.2/var 192.168.1.2 /diskless_rw/192.168.1.2/etc 192.168.1.2 /diskless_ro 192.168.1.0
[edit] Setup diskless_rw
Create directories
# cd /diskless_rw/192.168.1.2/etc # mkdir pam.d X11 # cd /diskless_rw/192.168.1.2/var # mkdir home log run tmp # chmod 1777 tmp
Create a swap file in the var directory for the client
# dd if=/dev/zero of=/diskless_rw/192.168.1.2/var/swap bs=1k count=32000
in the /diskless_rw/<ip>/var/log directory I created the following log files so that syslogd would have files to write to:
# cd /diskless_rw/192.168.1.2/var/log # touch messages security auth.log maillog lpd-errs xferlog cron debug.log slip.log ppp.log
Copy the following files from the systems /etc directory to /diskless_rw/<client ip>/etc
# cp -Rv <files> /diskless_rw/<ip>/etc
auth.conf disktab gettytab group hosts login.access login.conf login.conf.db motd master.passwd netconfig protocols pam.d pwd.db services8 spwd.db syslog.conf termcap -> /usr/share/misc/termcap ttys
Here is a shortcut which you can just copy and paste in an xterm window.
# cd /etc # cp -Rv auth.conf disktab gettytab group hosts login.access login.conf login.conf.db master.passwd motd netconfig protocols pam.d pwd.db services spwd.db syslog.conf termcap ttys /diskless_rw/<ip>/etc
It's very important that you copy all the files in pam.d across otherwise you will not have a password prompt on your login.
Create a fstab in /diskless_rw/<ip>/etc
# touch /diskless_rw/<ip>/etc/fstab
[edit] Setup diskless_ro
This is the common root mount for all pxe-boot clients.
Copy accross important directories and kernel from boot to diskless_ro
# cp -rv /bin /lib /libexec /sbin /boot /diskless_ro
For some client machines you may have to disable the ACPI (Power management) in the /diskless_ro/boot/device.hints
hint.acpi.0.disabled="1"
So we can use the systems /var/tmp and /usr/home directory make soft links to them
# cd /diskless_ro # ln -s /var/tmp /usr/home
In the /diskless_ro directory make the following directories: -dev so that clients can boot without freezing -var so we can mount from the /diskless_rw/<client ip>/var into the var directory -etc to store some common files
# mkdir usr dev var etc
We require a few files from the systems /etc directory to be copied into the /diskless_ro/etc for common use between the thin clients.
# cd /etc; # cp services netconfig login.conf /diskless_ro/etc
[edit] rc file
The /diskless_ro/etc/rc file is the first file which is ran after the kernel has loaded. Here we mount a the labels from the server.
Create the /diskless_ro/etc/rc
#!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin; export PATH TMPDIR=~/tmp;export TMPDIR TMP=~/tmp;export TMP mount -t nfs 192.168.1.1:/usr /usr boot_ip=`/sbin/ifconfig | /usr/bin/grep "inet " | /usr/bin/grep -v 127.0.0.1 | /usr/bin/awk '{print $2}'` mount_nfs -L 192.168.1.1:/diskless_rw/${boot_ip}/etc /etc mount_nfs -L 192.168.1.1:/diskless_rw/${boot_ip}/var /var swapon /var/swap #rm -rf /var/tmp/* #rm -rf /var/tmp/.* # Option if you choose XDM terminals #X -query 192.168.1.1 . /etc/rc2 exit 0
Remember to change 192.168.1.1 to your X server's IP
The -L on the mount_nfs is there so we don't get flock errors.
[edit] rc2 file
This sets up some links for libraries and the logging daemon.
#!/bin/sh mount -a /sbin/ldconfig -elf /usr/lib/compat /usr/X11R6/lib /usr/local/lib syslogd
Now change permissions so rc can run.
# chmod +x rc*
Copy /diskless_ro/etc/rc and rc2 to /diskless_rw/<client ip>/etc
# cp /diskless_ro/etc/rc* /diskless_rw/192.168.1.2/etc
[edit] GRUB Floppy boot (optional)
(would like to compile this ourselves later) To get started we downloaded the image from www.hp.uab.edu/~ed/grub-net
shell# dd if=/data/grub-net.img of=/dev/fd0
Then we mounted it as msdos Remove/rename menu.1st from the grub directory as it was doing something funny with it. We think that it was looking for a tftp server through our dhcp and we don't have a the dhcp setup correctly here, so we wanted to do it manually.
Reboot off the floppy now..
grub> ifconfig --address=192.168.1.2 --mask=255.255.255.0 --gateway=192.168.1.1 --server=192.168.1.2
OR you can use dhcp
grub> dhcp
grub> tftpserver 192.168.1.2
Setup tftp on your server, we created a directory /tftpboot.
[edit] Starting diskless system through GRUB
This is an alternative boot loader. You can use this for testing, if you don't have a pxeboot chip, otherwise skip this section.
These commands are half working...
grub> root (nd)
grub> kernel /kernel root=ad0s1a
grub> pxeboot
[edit] Completely Diskless System (PXEBOOT ROM) (optional)
Running completely diskless by booting from a Network ROM Chip.
We have now got a Intel GD82559 Etherexpress pro/100 Card.
When we boot up on the client machine with that card it displays:
Intel UNDI, PXE-2.0 (build 067)
Copyright (C) 1997-1998 Intel Corporation
Which we cannot get working so we have read that you have to update this version to Build 82.
copy /boot/pxeboot to /tftpboot directory we made before
- Downloaded proboot.exe from support.intel.com and unpacked into a windows box.
- Copied ibautil.exe onto a windows 98 boot disk.
- Rebooted the test box after disabling network boot on the nic (otherwise it'll kick in before the floppy).
- Ran ibautil -iv to see what embedded image versions were available:
Intel(R) Boot Agent XG v1.0.09
Intel(R) Boot Agent GE v1.2.36
Intel(R) Boot Agent FE v4.1.19
- Ran ibautil -up to perform the image upgrade.
It's interesting to note that no version showed up for out intel nic when initially running ibautil. After the upgrade, however, the version corectly showed as 4.1.19.
I made sure that I had simular features to this in my dhcpd.conf file:
option broadcast-address 192.168.254.255;
option domain-name-servers 192.168.254.3;
option domain-name "simerson.net";
option routers 192.168.254.1;
option subnet-mask 255.255.255.0;
server-name "pxe-gw";
server-identifier 192.168.254.3;
next-server 192.168.254.3;
default-lease-time -1;
subnet 192.168.254.0 netmask 255.255.255.0 {
range 192.168.254.32 192.168.254.99;
option root-path "/usr/local/export/pxe";
filename "pxeboot";
}
host cm.simerson.net {
hardware ethernet 00:e0:18:98:f0:cc;
fixed-address 192.168.254.126;
}
host c1.simerson.net {
hardware ethernet 00:60:97:0e:bb:a7;
fixed-address 192.168.254.131;
}
[edit] X config notes
On the X server the /etc/X11/xorg.conf file is only used for the X server not the clients.
To use this same configuration for your X Terminal Clients copy this file to /diskless_rw/<Client IP>/etc/X11 and it will use it.
[edit] Starting X on the client
There are two ways of doing this and it depends on your hardware mainly.
1. run all programs on the server using the servers CPU and Memory this we will call the 'XDM Method' 2. run all programs from the NFS mounts using the clients CPU and Memory but the HD of the server, this we will call the 'NFS Method'
Both methods will boot from PXE-Boot and can be diskless.
[edit] XDM Method
Recommended for machines less than 1Ghz 256MB
This is quite simple to setup. Change your rc file in the /diskless_ro/etc directory to have this line at the end:
X -query <server ip>
Make sure on the server you setup xdm to start on system startup
# vi /etc/ttys
Search for this line:
ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure
and change it to:
ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure
You can also type this command at the command line on the client to test before hand.
[edit] NFS Method
Recommended for machines over 1Ghz 256MB or if you want to utilise any of the clients devices such as local HD, USB, CD/DVD burners, etc.
This is much trickier.
Log in Now type 'startx' at the command line.
[edit] Custom Kernels
If you want to create custom kernels for your clients then do this:
Create your custom kernel
# cd /sys/i386/conf # cp GENERIC DISKLESS # vi DISKLESS
Make changes and build and install
# cd /usr/src # make buildkernel KERNCONF=DISKLESS # make installkernel KERNCONF=DISKLESS DESTDIR=/diskless_ro
[edit] Convert an Existing system with standard mount points
If you cannot afford to create /diskless_ro and /diskless_rw then you can use /var/diskless_ro and /usr/diskless_rw instead.
Use the same notes and replace /diskless_ro with /var/diskless_ro and /diskless_rw with /usr/diskless_rw. Make sure you create these directories first.
[edit] todo
Here are some of the jobs left to do to make this secure or generally better:
- There must be a simplier way to set this up if your going to use XDM in the end. IE: do we need to do half of this tutorial if we are going to run XDM.
- When the same user logs onto two seperate machines they cannot start firefox or thunderbird as it complains about being open somewhere else. This assumes you have firefox and thunderbird already open on both machines that you logged onto.
[edit] Known Issues
- Doesn't work with HP-COMPAQ-T5525 thin client as it doesn't want to boot, it says it's missing libfreetype.so.9 which we do have it just cannot find it for some reason. It's trying to use the VIA chipset for graphics which is different to all the other clients I've loaded successfully so far.
- USB mice not working instead use PS/2. If we got this working it may help get the HP T5525 working
[edit] Keyboard repeating on notebooks
- typing on some keyboards (like my notebook) causes double characters to display if you type too fast. - This is the notebook, if you go and set the KDE Accessabiltiy options and set the keyboard rate to 50ms, this fixes the problem.
[edit] USB mouse
Editing /etc/devd.conf file and searched for ums remarked out the action line.
rebooted.
Someone off IRC suggested that I build a GENERIC xorg.conf file which has vesa, usb mouse and ps/2 mouse configurations through it.
I reverted everything back to normal ps/2 mouse config, copying my usb config files to the following: /etc/devd.conf_usb /etc/rc.conf_usb /etc/X11/xorg.conf_usb
I think we need a seperate configuration for the HP, it uses a weird display driver.
[edit] links
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-diskless.html
http://www.onlamp.com/pub/a/bsd/2004/09/09/diskless_server.html
http://www.onlamp.com/pub/a/bsd/2004/09/30/diskless_clients.html
http://people.freebsd.org/~alfred/pxe/en_US.ISO8859-1/articles/pxe/article.html
http://www.the-labs.com/FreeBSD/Diskless/
http://www.nber.org/sys-admin/FreeBSD-diskless.html
http://wikitest.freebsd.org/MarkusBoelter
http://www.daemonsecurity.com/pub/pxeboot/
http://www.kano.org.uk/projects/pxe/
File Examples:
http://www.watson.org/~robert/freebsd/pxe/
PXE Information http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=108551