pavement

X Windows Terminal

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
(From the Beginning)
(NFS - Setup)
Line 180: Line 180:
 
==NFS - Setup==
 
==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.
 
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.
 +
 +
===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
 +
<pre>
 +
rpcbind_enable="YES"
 +
nfs_server_enable="YES"
 +
nfs_server_flags="-u -t -n 20 -h 192.168.1.2"
 +
 +
</pre>
 +
 +
===Test===
 +
A quick test to see if your NFS server is acting normal:
 +
 +
Edit the /etc/exports and add the following
 +
<pre>
 +
/usr      -alldirs
 +
</pre>
 +
 +
This allows anyone to connect to your /usr mount.
 +
 +
Now run these commands to restart and view your mounts
 +
<pre>
 +
# kill -HUP `cat /var/run/mountd.pid`
 +
# showmount -e
 +
</pre>
 +
 +
Now try and mount it from a client running BSD
 +
<pre>
 +
# mount -t nfs <server ip>:/usr /mnt
 +
</pre>
 +
  
  
Line 199: Line 232:
 
</pre>
 
</pre>
  
Enable NFS /etc/rc.conf
 
<pre>
 
rpcbind_enable="YES"
 
nfs_server_enable="YES"
 
nfs_server_flags="-u -t -n 20 -h 192.168.1.2"
 
 
</pre>
 
  
  
Line 240: Line 266:
 
/diskless_ro                      192.168.1.0
 
/diskless_ro                      192.168.1.0
 
</pre>
 
</pre>
 
 
  
 
==GRUB Floppy boot==
 
==GRUB Floppy boot==

Revision as of 01:00, 21 July 2006

Contents

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.

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:

 Swap          (equal to how much memory I have in my machine)
 /             512MB
 /var          1.4G
 /tmp          512MB
 /usr          2GB

I selected 'A' for auto and then deleted /usr and created /usr as 2g.

Select User-X install.

Select SSH Server and NFS Server in the installation process

After the install I went back into sysinstall and added the following labels. NOTE: you cannot add labels to your boot drive, 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.

 /diskless_ro  512MB
 /diskless_rw  1GB    minimum


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.1 = 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


Use the following command to update your fluxbox menus:

shell$ fluxbox-generate_menu

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 freesbie 1.1 boot CD to perform these initial tests. You can get this from www.freesbie.org. I entered into fluxbox, but you could equally use xfce4.

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$ setenv 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

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)


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

create ~/.xsession for each user which requires access and enter your start up for x eg:

startkde

run xdm on server as root

You can put this xdm into the /etc/ttys so that it starts automatically on boot up.

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


DHCP - Install and setup

Server setup.


install /usr/ports/net/isc-dhcp3-server

We do this so we can define the root path for the diskless system.

edit /usr/local/etc/dhcpd.conf

option domain-name "iinet.net.au";
option domain-name-servers 203.0.178.191;

# The shared root file system of diskless workstation
option root-path "192.168.1.2:/diskless_ro";

# The server from which to upload the initial boot-file (loads tftp server)
next-server 192.168.1.2;

default-lease-time 3600;
max-lease-time 86400;
ddns-update-style none;

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.30;

        # Set up default gateway
        option routers 192.168.1.1;
}

shell# dhcpd

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.

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"
nfs_server_flags="-u -t -n 20 -h 192.168.1.2"

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 <server ip>:/usr /mnt


# mkdir /diskless_ro
# chmod 444 /diskless_ro

# mkdir /diskless_rw
# chmod 777 diskless_rw

Make directories for each IP for your clients

# cd /diskless_rw
# mkdir 192.168.1.XXX
# cd 192.168.1.XXX
# mkdir etc var


Configure /etc/exports

# file systems accessible only for reading:
/usr -ro -maproot=0 -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

# file systems accessible for writing. All the resources
# given to every diskless station are specified by one line:
#
# Diskless-20
/diskless_rw/192.168.1.20/etc /diskless_rw/192.168.1.20/var \
        -mapall=root 192.168.1.20

Starting NFS

data# rpcbind
data# nfsd -u -t -n 20 -h 192.168.1.2
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.20/var      192.168.1.20
/diskless_rw/192.168.1.20/etc      192.168.1.20
/diskless_ro                       192.168.1.0

GRUB Floppy boot

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


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

Completely Diskless System (PXEBOOT ROM)

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;
}

links

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://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://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/

Personal tools