This document is outdated! Use the ltsp overlay (available via app-portage/layman). You can follow progress on its addition to the main tree at . You can get support for LTSP-5 on Gentoo from the #ltsp channel on Freenode IRC. Thanks, Donnie On the server ------------- Set up some functions to make installing things easier. em() { sudo emerge $@ } emva() { em -va $@ } emvp() { emerge -vp $@ } emre() { em --resume $@ } emsk() { emre --skipfirst $@ } Set up an alias to make installing things to the client root easier. alias ltsp="ROOT=/opt/ltsp/i386/ PORTAGE_CONFIGROOT=/opt/ltsp/i386/ CONFIG_PROTECT=\"/opt/ltsp/i386/usr/share/X11/xkb /opt/ltsp/i386/etc\" CONFIG_PROTECT_MASK=\"/opt/ltsp/i386/etc/terminfo\"" ROOT tells portage where to install files, and PORTAGE_CONFIGROOT tells portage where to look for its configuration files. Since we want to have a custom setup for the LTSP nodes, we don't want to use the server's configuration. This alias allows us to run commands like `ltsp emerge $packagename` to install packages to the node root. To save some time, we'll initially just create binary packages of what's built on the server and then install them to the client root. It's easier to simply create a binpkg of everything rather than figure out exactly which packages you will need. For servers, you will want to always create binpkgs anyway. Set FEATURES="buildpkg" to do this. # Get qlist and other tools emva portage-utils # Create binpkgs quickpkg $(qlist --installed --nocolor) # Create the client root, portage will not do this on its own mkdir /opt/ltsp/i386 # Set up the client root for PORTAGE_CONFIGROOT mkdir /opt/ltsp/i386/etc pushd /opt/ltsp/i386/etc PORTDIR=$(portageq portdir) ln -s ../../../../${PORTDIR}/profiles/default-linux/x86/2006.1 make.profile cp /etc/make.conf . popd # Install to client root, forcing binary-only packages # gcc is needed for libstdc++ ltsp emva --usepkgonly glibc dhcpcd udev coreutils gzip gcc less openssh nano util-linux psmisc procps xorg-x11 ltsp emva --usepkgonly debianutils diffutils findutils gawk grep kbd net-tools iputils wget tar cpio bzip2 virtual/modutils syslog-ng which # USE=bootstrap creates a useful /dev filesystem ltsp USE="bootstrap" emva baselayout A nice one-liner to generate much of the list above: ltsp grep '*' /usr/portage/profiles/base/packages \ | cut -d'*' -f2 | grep / | grep -v -e perl -e python -e portage \ | xargs emerge -vp Install a few packages on the server. syslinux contains pxelinux, the PXE boot loader. genkernel is Gentoo's kernel/initrd creator. nbd is used to swap across the network. dnsmasq is a simple DHCP/DNS server. atftp is one of the TFTP server options, and the only one to support multicast TFTP. emva syslinux genkernel nbd dnsmasq atftp Configure dnsmasq as a DHCP server. /etc/dnsmasq.conf: # Set up the local-only domain local=/lan.local/ expand-hosts domain=lan.local # Turn on the DHCP server, pass out addresses from 192.168.1.100 to .150 # with a 12-hour lease dhcp-range=192.168.1.100,192.168.1.150,12h # Here's an example of a hardcoded IP based on MAC address dhcp-host=00:E0:81:22:66:CC,supernova,192.168.1.106 # Override the default route supplied by dnsmasq, which assumes the # router is the same machine as the one running dnsmasq. dhcp-option=3,192.168.1.1 # This tells the clients the hostname and IP of the TFTP server dhcp-boot=/opt/ltsp/tftproot/pxelinux.0,supernova,192.168.1.106 # We are the authoritative DHCP server for this network dhcp-authoritative # address and root path of NFS server dhcp-option=17,192.168.1.106:/opt/ltsp/i386 Start it, and set it to start at every boot. /etc/init.d/dnsmasq start /sbin/rc-update add dnsmasq default Configure the TFTP server next. This is used for the client nodes to retrive the kernel and initrd/initramfs, before they mount their root filesystems via NFS. /etc/conf.d/atftp: TFTPD_ROOT="/opt/ltsp/tftproot/" Create the TFTP root directory. mkdir /opt/ltsp/tftproot/ Start it, and set it to start at every boot. /etc/init.d/atftp start /sbin/rc-update add atftp default Set up the PXE boot loader next. First, link the executable into the TFTP root from where it was installed. A symlink is used so that later updates require no manual effort. pushd /opt/ltsp/tftproot ln -s ../../../usr/lib/syslinux/pxelinux.0 popd Create the configuration directory and populate it with a default file. mkdir /opt/ltsp/tftproot/pxelinux.cfg nano /opt/ltsp/tftproot/pxelinux.cfg/default default: default linux.pxe label linux.pxe kernel pxe/x86/kernel append initrd=pxe/x86/initramfs ramdisk=8192 ip=dhcp root=nfs;tmpfs Link the TFTP boot directory to the client root's /boot. We install the kernel, initramfs and System.map there (particularly System.map) so booting works as expected. cd /opt/ltsp/tftproot/pxe ln -s ../../i386/boot x86 Configure the NFS server as well. /etc/exports: /opt/ltsp/i386 192.168.1.1/16(sync,ro) Start it, and set it to start at every boot. /etc/init.d/nfs start /sbin/rc-update add nfs default Now, time to build the kernel. genkernel will take care creating a working initramfs as well as the kernel and installing them to the right place. Add networking drivers to ./configs/generic/modules_load.gk so they get added to the initramfs in a module-net line. while read line; do echo -n " $line" done \ < <(find /usr/src/linux/drivers/net/ -name *.ko \ | sed -e "s:.*/::" -e "s:\.ko::"); echo ./configs/generic/modules_load.gk: modules-nfs := "nfs" For 2.6.18 and newer kernels, you'll need to grab a CVS snapshot of unionfs from the homepage. genkernel.conf: UNIONFS_VER="20060916-2203" genkernel \ --bootdir=/opt/ltsp/i386/boot \ --install-mod-path=/opt/ltsp/i386 \ --links \ --makeopts=-j4 \ --debuglevel=5 \ --unionfs \ --portmap \ --tempdir=/tmp/genkernel \ --menuconfig \ --no-clean \ all:: Try genkernel-4, only available in subversion, as suggested by the author, plasmaroo (Tim Yamin). svn co https://svn.gentooexperimental.org/genkernel You must add the --portmap option to genkernel when building. Tim also says that unionfs should work great; pass --unionfs to genkernel. For usage, see http://dev.gentoo.org/~plasmaroo/stuff/genkernel.8.html. Fix up the symlinks genkernel creates. They aren't relative so they break when the client boots. cd /opt/ltsp/i386/boot/ for i in initramfs kernel System.map; do link=$(readlink $i) sudo ln -sf ${link##*/} $i done Now let's set up the client. Yes, there is some client setup to get it booting into PXE properly. We're going to use Etherboot to generate an ISO image, assuming the client is CD-bootable. Etherboot can also generate a .zdsk, which is a floppy disk image. Creating .iso and .liso images requires mtools. The difference between .iso and .liso is that the .liso has legacy floppy emulation. emva mtools Download Etherboot from http://developer.berlios.de/projects/etherboot/ -- click Files. Edit the Config file to set the necessary options. Build the .liso image with the most common network drivers, since not all drivers will fit. Config: CFLAGS+= -DBOOT_FIRST=BOOT_NIC # Deactivated boot prompt CFLAGS+= -DCONFIG_PCI # Deactivated ISA CFLAGS+= -DSIZEINDICATOR make bin/3c509--3c595--3c90x--amd8111e--cs89x0--e1000--eepro--epic100--forcedeth--natsemi--pcnet32--pnic--rtl8139--sis900--tg3--tulip--via-rhine--via-velocity.liso This should be the full contents of the client /etc/fstab. unionfs / unionfs defaults 0 0 shm /dev/shm tmpfs nodev,nosuid,noexec 0 0 Enhancements still desired for genkernel-4: Print IP and interface info. Also do hostname option, then busybox hostname and busybox hostname -d for domain Now that the netboot is working OK, let's clean up the client root a little to eliminate some errors and unnecessary services. ltsp sudo /sbin/rc-update del netmount Make the boot a little faster, because we don't need to check filesystems. touch /opt/ltsp/i386/fastboot Set up the client's logger to start at every boot. ltsp sudo /sbin/rc-update add syslog-ng default Set up the client's timezone (NOTE: this is system-specific) cd /opt/ltsp/i386/etc sudo ln -s ../usr/share/zoneinfo/PST8PDT localtime Set up the client's library paths and symlinks. The `eselect opengl` will need http://dev.gentoo.org/~dberkholz/eselect-20061008-fix-opengl-nondefault-root.patch as of <=app-admin/eselect-opengl-1.0.4. ltsp sudo gcc-config 1 ltsp sudo eselect opengl set xorg-x11 If you're testing this in VMWare, do this. /opt/ltsp/i386/etc/make.conf: VIDEO_CARDS="vmware none" ltsp emva xf86-video-vmware -1 Otherwise, set VIDEO_CARDS to the cards you'll be using. The profiles have reasonable default values. Then, do this to autoinstall the drivers. ltsp emva --onlydeps xorg-server Enable XDMCP on the server. How to do this depends on the display manager. This example uses GDM. /etc/X11/gdm/gdm.conf: [xdmcp] Enable=true # NOTE: This command will restart all of your server's X sessions sudo /etc/init.d/xdm restart Set up a root password on the client. To do this, you need to chroot from the server, since booting from the client results in a tmpfs overlay of /. chroot /opt/ltsp/i386 /bin/bash . /etc/profile passwd Boot the client, and broadcast for a running XDMCP server. Alternately, if the server's address is known, you can use the -query argument instead. X -broadcast Making it a bit closer to a true LTSP setup: mount -o bind /usr/src/linux /opt/ltsp/i386/usr/src/linux ltsp emva ltspfs emva ltspfs Yes, you have to install ltspfs to both places. The FUSE module and the daemon are in the same package, but the module needs to be on the server and the daemon on the client.