HOWTO setup a small server

FreeNX/NoMachine NX


This page describes how to setup FreeNX 0.7.3 with the NoMachine 3.4.0 OSS components (or compatible versions). For the clients the closed-source packages provided by NoMachine will be used. The server part will be built from the open-source packages by NoMachine and the FreeNX project. The installation of the server does only make sense on a computer with typical desktop setup (KDE/Gnome).

Original websites of the projects:

Client Installation

Get an appropriate NoMachine 3.4.0 client package from NoMachine (typically nxclient_3.4.0-XXX_i386.deb or nxclient_3.4.0-XXX_x86_64.deb) and install it:

# dpkg -i nxclient_3.4.0-XXX_YYY.deb

Client Configuration

The configuration is quite simple: A dialog pops up at first start of nxclient and few questions must be answered. I recomment to encrypt all traffic (no checkmark in checkbox “Disable encryption of all traffic”).

If the nx user at the server is not configured to use the NoMachine default key, you will have to add his private key to your client's configuration. Click “Configure” and then “Key” (in the “General” tab). You can replace the key in the window popping up with the key from the server.

Server Pre-Build

Prerequisit: OpenSSH The following packages (and maybe others) are required by FreeNX:

# apt-get install expect netcat

I prefer to install the NX server stuff to /opt/freenx. This makes a deinstallation at a later time very easy, because only one directory must be deleted. Only few steps must be performed as root (lines begining with #); building should be done as ordinary user (e.g., user, lines begining with $):

# NX_DIR=/opt/freenx
# mkdir "${NX_DIR}"
# chown user: "${NX_DIR}"

Build of NoMachine Components

The following NoMachine 3.4.0 OSS packages are required. Get them from NoMachine:

  • nxagent-3.4.0-XXX.tar.gz
  • nxauth-3.4.0-XXX.tar.gz
  • nxcomp-3.4.0-XXX.tar.gz
  • nxcompext-3.4.0-XXX.tar.gz
  • nxcompshad-3.4.0-XXX.tar.gz
  • nxproxy-3.4.0-XXX.tar.gz
  • nx-X11-3.4.0-XXX.tar.gz

Untar the packages in a separate subdirectory, e.g., named build:

$ mkdir build
$ cd build
$ for I in ../nx*.tar.gz; do tar xzf "${I}"; done

Now you can build the packages by running make in only two of the directories which have been created by unpacking the sources. The sources in the other directories will be automatically built as well:

$ cd nx-X11
$ make World
$ cd ..
$ cd nxproxy
$ ./configure
$ make
$ cd ..

Build and Installation of FreeNX

Get FreeNX 0.7.3 (freenx-server-0.7.3.tar.gz), untar it and apply the patch that enables NoMachine 3.4.0 and changes the installation directories. Afterwards, build and install FreeNX:

$ cd build
$ tar xzf ../freenx-server-0.7.3.tar.gz
$ cd freenx-server-0.7.3
$ patch -p1 < ../../freenx-server-0.7.3_install-dir.patch
$ make
$ make install
$ cd ..

Installation of NoMachine Components

Create the destination directories for the NoMachine binaries:

$ NX_DIR=/opt/freenx
$ mkdir "${NX_DIR}/bin" "${NX_DIR}/lib"

The NoMachine components contain two executables that must be installed:

$ cp -a nxproxy/nxproxy "${NX_DIR}/bin"
$ cp -a nx-X11/programs/Xserver/nxagent "${NX_DIR}/bin"

Additionally, these shared libraries are required:

$ cp -a nxcomp/* "${NX_DIR}/lib"
$ cp -a nxcompext/* "${NX_DIR}/lib"
$ cp -a nxcompshad/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/X11/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xext/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xrender/* "${NX_DIR}/lib"

The following libraries are also built and may be installed, but in most cases they are already installed on your Linux system and are not required. If you experience problems with the libraries of your Linux distribution or just want to use the new ones, you can install them with:

$ cp -a nx-X11/lib/freetype2/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xpm/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xfixes/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xtst/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xdamage/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xrandr/* "${NX_DIR}/lib"
$ cp -a nx-X11/lib/Xcomposite/* "${NX_DIR}/lib"

Note: The libraries listed above are required, because the nxagent binary is dynamically linked against them. For newer versions of NoMachine NX the list might be incomplete. To check the list you can filter out the newly built libraries in the shared library dependencies of nxagent:

$ ldd nx-X11/programs/Xserver/nxagent | \
  awk '{ gsub("([0-9.])*$","",$1); print $1; }' | \
  while read I; do
    find nx-X11/lib nxcomp*/ -name "$I*"

Server Post-Installation

These steps must be performed as root. Change the owner/group of the newly installed files to protect them from the users:

# NX_DIR=/opt/freenx
# chown -R root: "${NX_DIR}"

Finally, the NX server must be setup. Just answer the questions according to your needs. I highly recommend to create a new OpenSSH key for the nx user instead of using the NoMachine default key, although this requires to distribute the private part of the key (not the public key) to all clients.

# "${NX_DIR}/bin/nxsetup" --install

In order to enable/disable the NX server, run:

# "${NX_DIR}/bin/nxserver" --start|--stop

At this point, your NX server should work and you should be able to login.

Some aspects (e.g., logging) can be configured in "${NX_DIR}/etc/node.conf". You can use "${NX_DIR}/etc/node.conf.sample" as a starting point.

Back to index.