Install x2go PXE

# server
http://www.panticz.de/node/370
 
 
# client
#echo "deb http://x2go.obviously-nice.de/deb/ lenny main" >>/opt/x2gothinclient/etc/apt/sources.list 
cat <<EOF> /etc/apt/sources.list.d/x2go.list
deb http://x2go.obviously-nice.de/deb/ lenny main
EOF
apt-get update
apt-get install -y --force-yes x2goclient-gtk
 
 
# install and configure pxe server
apt-get install -y tftpd-hpa syslinux openbsd-inetd nfs-kernel-server debootstrap
 
# configure pxe envirement
cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /usr/lib/syslinux/vesamenu.c32 /var/lib/tftpboot/
cp /usr/lib/syslinux/menu.c32 /var/lib/tftpboot/
cp /usr/lib/syslinux/memdisk /var/lib/tftpboot/
 
mkdir /opt/x2gothinclient
debootstrap --arch i386 lenny /opt/x2gothinclient/
 
#http://ftp2.de.debian.org/debian
 
cp /etc/resolv.conf /opt/x2gothinclient/etc/resolv.conf
 
cat <<EOF>> /opt/x2gothinclient/etc/network/interfaces
auto lo
iface lo inet loopback
EOF
 
echo x2gothinclient >> /opt/x2gothinclient/etc/hostname
echo "127.0.0.1 localhost" >> /opt/x2gothinclient/etc/hosts
echo "192.168.1.174 x2goserver.linux4afrika.local x2goserver" >> /opt/x2gothinclient/etc/hosts
echo "deb http://x2go.obviously-nice.de/deb/ lenny main" >>/opt/x2gothinclient/etc/apt/sources.list 
 
 
 
# create client
sudo ./mkTSClient.sh i386 karmic x2go
 
 
#################
chroot /opt/x2gothinclient /bin/bash 
 
PS1='(chroot) '$PS1 
 
mount -t proc none /proc
mount -t devpts none /dev/pts/
 
apt-get update
 
apt-get install debconf-utils
 
debconf-set-selections <<\EOF
linux-image-2.6.26-2-686 linux-image-2.6.26-2-686/preinst/bootloader-initrd-2.6.26-2-686 select false
linux-image-2.6.26-2-686 linux-image-2.6.26-2-686/postinst/create-kimage-link-2.6.26-2-686 select true
locales locales/locales_to_be_generated select de_DE ISO-8859-1
EOF
 
#apt-get install -y syslinux locales linux-image
apt-get install -y syslinux locales linux-image-2.6.26-2-686
 
dpkg-reconfigure locales 
sed -i 's|BOOT=local|BOOT=nfs|g' /etc/initramfs-tools/initramfs.conf
 
 
??? update-initramfs -u -v
##cat <<EOF> /etc/apt/sources.list
###deb http://archive.ubuntu.com/ubuntu jaunty main universe
##deb http://x2go.obviously-nice.de/deb/ lenny main
##deb http://archive.ubuntu.com/ubuntu intrepid main universe
##EOF
 
apt-get update
apt-get install -y --force-yes x2gothinclientsystem 
 
cd /usr/share/x2gothinclientsystem/script
./x2gothinclient_install.sh 
 
umount /proc/
umount /dev/pts/ 
exit
 
#nano /etc/default/atftpd
#USE_INETD=false
#OPTIONS="--daemon --port 69 --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 /tftpboot" 
 
#mkdir /tftpboot
#chmod 775 /tftpboot
 
### Disable tftp in inetd
#Edit /etc/inetd.conf
 
#/etc/init.d/openbsd-inetd restart
#/etc/init.d/atftpd restart
 
#ln -s /opt/x2gothinclient/vmlinuz /tftpboot/vmlinuz
cp /opt/x2gothinclient/boot/vmlinuz-*-686 /var/lib/tftpboot/vmlinuz
 
#ln -s /opt/x2gothinclient/initrd.img /tftpboot/initrd.img
cp /opt/x2gothinclient/boot/initrd.*-686 /var/lib/tftpboot/initrd.img
 
#mkdir /tftpboot/pxelinux.cfg
mkdir /var/lib/tftpboot/pxelinux.cfg
 
cat <<EOF> /var/lib/tftpboot/pxelinux.cfg/default
label linux
kernel vmlinuz
append root=/dev/nfs nfsroot=192.168.1.174:/opt/x2gothinclient ro initrd=initrd.img ip=dhcp
EOF
 
#cp /opt/x2gothinclient/usr/lib/syslinux/pxelinux.0 /tftpboot/
 
echo "/opt/x2gothinclient *(ro,async,no_root_squash,no_subtree_check)" >> /etc/exports
 
cp /opt/x2gothinclient/etc/default/x2gothinclient  /opt/x2gothinclient/etc/default/x2gothinclient.org
cat <<EOF> /opt/x2gothinclient/etc/default/x2gothinclient
x2goclient --pgp-card --external-login=/ramdrive/logins --maximize --link=lan --kbd-layout=de --kbd-type=pc105/de --set-kbd=1 --geometry=fullscreen --add-to-known-hosts --read-exports-from=/ramdrive/export --add-to-known-hosts
EOF
 
/etc/init.d/nfs-kernel-server restart
/etc/init.d/openbsd-inetd restart
 
 
# test, preselect session
#cat <<EOF> /opt/x2gothinclient/sessions
mkdir  /root/.x2goclient
cat <<EOF> /root/.x2goclient/sessions
[20091015105357295]
name=ts
icon=:icons/128x128/x2gosession.png
host=192.168.1.222
user=
key=
sshport=22
rootless=false
applications=WWWBROWSER, MAILCLIENT, OFFICE, TERMINAL
command=GNOME
rdpoptions=
rdpserver=
speed=4
pack=16m-jpeg
quality=9
fullscreen=true
width=800
height=600
usekbd=true
layout=de
type=pc105/de
sound=false
soundsystem=pulse
startsoundsystem=true
soundtunnel=true
fstunnel=true
defsndport=true
sndport=4713
print=true
export=
EOF
 
 
cat <<EOF> /home/ubuntu/.xsession
x2goclient --maximize --link=lan --kbd-layout=de --kbd-type=pc105/de --set-kbd=1 --geometry=fullscreen --add-to-known-hosts --read-exports-from=/ramdrive/export
EOF
 
cat <<EOF> /opt/x2gothinclient/etc/rc.local 
#!/bin/sh -e
chmod 777 /home/x2goclient
[ ! -d /home/x2goclient/.x2goclient ] &&  mkdir /home/x2goclient/.x2goclient
cp /sessions /home/x2goclient/.x2goclient
exit 0
EOF
 
 
# links
http://www.x2go.org/fileadmin/doc/de.installation.x2go.pdf
http://www.x2go.org/fileadmin/doc/installation_x2go_ubuntu_en.html