Table of Contents

Build X2GoServer for GNU/Linux

… esp. applies to installation on the Linux-From-Scratch distribution.

General Information

Make sure you have read these wiki pages / installed recommended software / development libraries:

Note: X2GoServer is not dependent on perl-suid anymore (as Perl SUID has been removed from Perl >=5.12.x).

Installation: For an insight in basic post-installation procedures please take a look at the INSTALL file in the base directory of the x2goserver code project. The latest version of this INSTALL file can be found in our Git repository.

Deinstallation: For deinstallation please refer to the UNINSTALL file in the base directory of the x2goserver code project. The latest version of this UNINSTALL file can also be found in our Git repository.

Build Recipes

Run the following commands as a regular, non-root user. You'll need the root password to install them.

1. Create the necessary group and user

Make sure you already have a group called fuse
$ su -c "groupadd --system x2gouser && groupadd --system x2goprint &&
useradd --system --no-create-home --shell /bin/false --home /var/lib/x2go -g x2gouser x2gouser &&
usermod -a -G fuse <each user who'll connect to this x2go server>"

2. Install makepasswd

$ wget http://people.defora.org/~khorben/projects/makepasswd-0.5.0.tar.gz
$ tar xf makepasswd-0.5.0.tar.gz
$ cd makepasswd-0.5.0
$ make
$ su -c "make PREFIX=/usr install"

3. Install man2html

$ wget http://dcssrv1.oit.uci.edu/indiv/ehood/tar/man2html3.0.1.tar.gz
$ tar xf man2html3.0.1.tar.gz
$ cd man2html3.0.1
$ su -c "sed 's,/local,,g' man2html > /usr/bin/man2html &&
sed 's,/local,,g' man.cgi > /usr/bin/man.cgi &&
cp doc/man2html.1 /usr/share/man/man1/ &&
chown root:root /usr/bin/man2html /usr/bin/man.cgi /usr/share/man/man1/man2html.1 &&
chmod 755 /usr/bin/man2html /usr/bin/man.cgi"

4. Install perl module Config-Simple

$ wget http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-4.59.tar.gz
$ tar xf Config-Simple-4.59.tar.gz
$ cd Config-Simple-4.59
$ perl Makefile.PL
$ make
$ su -c "make install"

5. Install perl module DBI

$ wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.615.tar.gz
$ tar xf DBI-1.615.tar.gz
$ cd DBI-1.615
$ perl Makefile.PL
$ make
$ su -c "make install"
Here you need to decide if you need a single-server or multiple-server setup.

If you pick a single-server setup, you need to install sqlite. Follow the installation instructions at BLFS.

If you pick a multiple-server setup, you need to install postgresql. Follow the installation instructions at BLFS.

6. Install perl module DBD-SQLite (for a single-server setup)

$ wget http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK/DBD-SQLite-1.33.tar.gz
$ tar xf DBD-SQLite-1.33.tar.gz
$ cd DBD-SQLite-1.33
$ perl Makefile.PL
$ make
$ su -c "make install"

7. Install perl module DBD-Pg (for a multiple-server setup) (TODO: Someone please verify this)

$ wget http://search.cpan.org/CPAN/authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz
$ tar xf DBD-Pg-2.18.1.tar.gz
$ cd DBD-Pg-2.18.1
$ perl Makefile.PL
$ make
$ su -c "make install"

8. Install NoMachine's NX libraries, described here.

9. Install x2goagent from git

$ su -c "rm -fr /usr/lib/x2go &&
mkdir -p /usr/lib/x2go"
$ git clone git://code.x2go.org/x2goagent
$ cd x2goagent
$ make World
$ su -c "cp -a lib/Xext/libXext.so* /usr/lib/x2go/ &&
cp -a lib/X11/libX11.so* /usr/lib/x2go/ &&
cp -a lib/Xpm/libXpm.so* /usr/lib/x2go/ &&
cp -a lib/Xrender/libXrender.so* /usr/lib/x2go/ &&
cp -a lib/Xfixes/libXfixes.so* /usr/lib/x2go/ &&
cp -a lib/Xtst/libXtst.so* /usr/lib/x2go/ &&
cp -a lib/Xdamage/libXdamage.so* /usr/lib/x2go/ &&
cp -a lib/Xrandr/libXrandr.so* /usr/lib/x2go/ &&
cp -a lib/Xcomposite/libXcomposite.so* /usr/lib/x2go/ &&
chown -R root:root /usr/lib/x2go &&
install -m755 programs/Xserver/x2goagent /usr/bin/x2goagent.original"
Use make -j <number of cpus> World to speed up the build

Now create a wrapper to call the actual x2goagent binary with the correct LD_LIBRARY_PATH

$ su -c "echo '#\!/bin/bash' | sed 's,\\\,,g' > /usr/bin/x2goagent &&
echo 'X2GO_LIBS=/usr/lib/x2go LD_LIBRARY_PATH=/usr/lib/x2go exec /usr/bin/x2goagent.original \$@' >> /usr/bin/x2goagent &&
chmod 755 /usr/bin/x2goagent"

12. Install x2goserver from git

$ git clone git://code.x2go.org/x2goserver
$ cd x2goserver
$ sed -i "s,/local,,g" x2goserver-compat/Makefile
$ sed -i "s,/local,,g" x2goserver-extensions/Makefile
$ sed -i "s,/local,,g" x2goserver/Makefile
$ make
$ su -c "make install &&
chown root:x2gouser /usr/lib/x2go/x2gosqlitewrapper &&
chmod 2755 /usr/lib/x2go/x2gosqlitewrapper
rm -fr /var/lib/x2go/x2go_sessions &&
/usr/sbin/x2godbadmin --createdb"

13. Install a boot script

Copy this text into /etc/rc.d/init.d/x2goserver:

#!/bin/sh

. /etc/sysconfig/rc
. ${rc_functions}

case "${1}" in
        start)
                boot_mesg "Starting x2go server..."
                /usr/sbin/x2gocleansessions
                evaluate_retval
                ;;

        stop)
                boot_mesg "Stopping x2go server..."
                killall x2gocleansessions
                evaluate_retval
                ;;

        restart)
                boot_mesg "Restarting x2go server..."
                ${0} stop
                sleep 1
                ${0} start
                ;;

        status)
                boot_mesg "Checking x2go status..."
                statusproc /usr/sbin/x2gocleansessions
                evaluate_retval
                ;;

        *)
                echo "Usage: ${0} {start|stop|restart|status}"
                exit 1
                ;;
esac

# End $rc_base/init.d/x2goserver



su -c "chmod 755 /etc/rc.d/init.d/x2goserver &&
ln -sf ../init.d/x2goserver /etc/rc.d/rcsysinit.d/S92x2goserver &&
ln -sf ../init.d/x2goserver /etc/rc.d/rc0.d/K28x2goserver &&
ln -sf ../init.d/x2goserver /etc/rc.d/rc6.d/K28x2goserver"