Difference between revisions of "Install NX Server on Raspberry Pi"

From TIAO's Wiki
Jump to: navigation, search

10 PCS, 10cm x 10cm, 2 layers prototype for $38.80 shipped!
(Setting up the NX environment)
(Prepare the build and runtime environment)
Line 38: Line 38:
 
</pre>
 
</pre>
  
NX server also requires CUPS, thus you need to install it as well:
+
NX server also requires CUPS and x11-xserver-utils, thus you need to install it as well:
  
 
<pre>
 
<pre>
 
sudo apt-get install cups
 
sudo apt-get install cups
 +
sudo apt-get install x11-xserver-utils
 
</pre>
 
</pre>
  

Revision as of 21:13, 13 September 2012








Buy Game Console Adapters from http://www.easymg.com or http://www.diygadget.com

What is Raspberry Pi

Why you need NX server

How to install NX server on Raspberry Pi

Prepare the build and runtime environment

You need the following packages to build NX server. Use apt-get to install them on your pi:

  • xutils-dev
  • expect
  • xorg-dev
  • libjpeg8-dev
  • libpng12-dev

Before you use apt-get, try to run update command first, otherwise you may encounter some 404 not found errors.

sudo apt-get update

Command:

sudo apt-get install xutils-dev expect xorg-dev libjpeg8-dev libpng12-dev

NX server also requires CUPS and x11-xserver-utils, thus you need to install it as well:

sudo apt-get install cups
sudo apt-get install x11-xserver-utils

Compiling NX components

NoMachine has released the component source here. There is also a official guide to compiling the components and it is a good source of information. The components you need to build the NX servers are (as of Sept 13/2012, you may see a different version, but component name won't change):

  • nxproxy-3.5.0-1
  • nxcomp-3.5.0-2
  • nxcompext-3.5.0-1
  • nxcompshad-3.5.0-2
  • nx-X11-3.5.0-2
  • nxauth-3.5.0-1
  • nxagent-3.5.0-9
  • nxscripts-3.5.0-1


You can SSH to your Pi and use "wget" to download the files.

Now you should have total 8 files:

pi@raspberrypi /work/nx $ ls -l
total 22180
-rw-r--r-- 1 pi pi  1510400 Jul 12 16:40 nxagent-3.5.0-9.tar.gz
-rw-r--r-- 1 pi pi    30671 Jul 12 16:39 nxauth-3.5.0-1.tar.gz
-rw-r--r-- 1 pi pi   532999 Jul 12 16:40 nxcomp-3.5.0-2.tar.gz
-rw-r--r-- 1 pi pi    91725 Jul 12 16:40 nxcompext-3.5.0-1.tar.gz
-rw-r--r-- 1 pi pi    77293 Jul 12 16:39 nxcompshad-3.5.0-2.tar.gz
-rw-r--r-- 1 pi pi    80194 Jul 12 16:39 nxproxy-3.5.0-1.tar.gz
-rw-r--r-- 1 pi pi    25664 Jul 12 16:39 nxscripts-3.5.0-1.tar.gz
-rw-r--r-- 1 pi pi 20345475 Jul 12 16:39 nx-X11-3.5.0-2.tar.gz
pi@raspberrypi /work/nx $

Unpack all files (use "tar -xzvf <filename>" command), you should have the following directories (I moved gz files to a different directory):

pi@raspberrypi /work/nx $ ls -l
total 32
drwxr-xr-x  2 pi pi 12288 Jun 15  2011 nxcomp
drwxr-xr-x  2 pi pi  4096 May  9  2011 nxcompext
drwxr-xr-x  2 pi pi  4096 May  9  2011 nxcompshad
drwxr-xr-x  3 pi pi  4096 May  9  2011 nxproxy
drwxr-xr-x  2 pi pi  4096 May  9  2011 nxscripts
drwxr-xr-x 10 pi pi  4096 Aug  5  2011 nx-X11
pi@raspberrypi /work/nx $

Now compile individual components, it may take a while, so go grab a cup of coffee and relax:

cd nxcomp
./configure
make

cd nxcompext
./configure
make

cd nxcompshad
./configure
make

cd nxproxy
./configure
make

cd nx-X11
make World

Compiling FreeNX Server

The FreeNX Server source can be downloaded from http://freenx.berlios.de/download.php. The last version is freenx-server-0.7.3. (updated in 2008). Unpack the source and patch it with the gentoo-nomachine.diff patch file that is also packaged in the source file:

pi@raspberrypi /work/nxserver/freenx-server-0.7.3 $ ls
AUTHORS                nxcheckload.sample  nxserver
ChangeLog              nxcups-gethost      nxserver-helper
CONTRIB                nxdesktop_helper    nxserver-suid
COPYING                nxdialog            nxserver-usermode
gentoo-nomachine.diff  nxkeygen            nx-session-launcher
init.d                 nxloadconfig        nxsetup
INSTALL                nxnode              nxshadowacl.sample
Makefile               nxnode-login        nxviewer_helper
node.conf.sample       nxprint             nxviewer-passwd
nxacl.sample           nxredir
pi@raspberrypi /work/nxserver/freenx-server-0.7.3 $ patch < gentoo-nomachine.diff
patching file nxloadconfig
pi@raspberrypi /work/nxserver/freenx-server-0.7.3 $

Now, create a new patch file, e.g. nx_3.5.0.patch with the following context:

--- nxloadconfig.orig   2009-05-26 16:13:02.000000000 -1000
+++ nxloadconfig        2009-05-26 16:13:22.000000000 -1000
@@ -606,8 +606,8 @@
        [ -z $(echo "$ENABLE_ROOTLESS_MODE" | egrep "^[0|1]$") ] && \
                ERROR="yes" && echo "Error: Invalid value \"ENABLE_ROOTLESS_MODE=$ENABLE_ROOTLESS_MODE\""

-       [ -z "$(strings $PATH_BIN/nxagent | egrep 'NXAGENT - Version 1.5.0|NXAGENT - Version 2.[01].0|NXAGENT - Version 3.[012].0')" ] && \
-               WARNING="yes" && echo "Error: Could not find 1.5.0 or 2.[01].0 or 3.[01].0 version string in nxagent. NX 1.5.0 or 2.[01].0 or 3.[012].0 backend is needed for this version of FreeNX."
+       [ -z "$(strings $PATH_BIN/nxagent | egrep 'NXAGENT - Version 1.5.0|NXAGENT - Version 2.[01].0|NXAGENT - Version 3.[012345].0')" ] && \
+               WARNING="yes" && echo "Error: Could not find 1.5.0 or 2.[01].0 or 3.[012345].0 version string in nxagent. NX 1.5.0 or 2.[01].0 or 3.[012345].0 backend is needed for this version of FreeNX."

        [ -z $(echo "$ENABLE_USESSION" | egrep "^[0|1]$") ] && \
                ERROR="yes" && echo "Error: Invalid value \"ENABLE_USESSION=$ENABLE_USESSION\""

And run the patch:

pi@raspberrypi /work/nxserver/freenx-server-0.7.3 $ patch < nx_3.5.0.patch
patching file nxloadconfig

And

make

and

sudo make install


Setting up the NX environment

Now copy the library files and binaries compiled in the above steps to the correct locations.

cd /work/nx
sudo cp -a nx-X11/lib/X11/libX11.so* /usr/NX/lib
sudo cp -a nx-X11/lib/Xext/libXext.so* /usr/NX/lib
sudo cp -a nx-X11/lib/Xrender/libXrender.so* /usr/NX/lib
sudo cp -a nxcomp/libXcomp.so* /usr/NX/lib
sudo cp -a nxcompext/libXcompext.so* /usr/NX/lib
sudo cp -a nxcompshad/libXcompshad.so* /usr/NX/lib 
sudo cp -a nx-X11/programs/Xserver/nxagent /usr/NX/bin
sudo cp -a nxproxy/nxproxy /usr/NX/bin

freeNX server expects to have the file libXrender.so.1.2 but the NX components we compiled has a newer version of libXrender.so.1.2.2 so you need to create a soft link that the installer can follow:

sudo ln -s /usr/NX/lib/libXrender.so.1.2.2 /usr/NX/lib/libXrender.so.1.2

Now, install the NX Server:

sudo /usr/NX/bin/nxsetup --install

You will get some warnings, but you shouldn't get any errors. The test output looks like this:

----> Testing your nxserver configuration ...
Warning: Could not find nxdesktop in /usr/NX/bin. RDP sessions won't work.
Warning: Could not find nxviewer in /usr/NX/bin. VNC sessions won't work.
Warning: Invalid value "CUPS_ETC=/etc/cups/"
         Users will not be able to enable printing.
Warning: Invalid value "DEFAULT_X_SESSION=/etc/X11/xdm/Xsession"
         Users might not be able to request a default X session.
Warning: Invalid value "COMMAND_START_KDE=startkde"
         Users will not be able to request a KDE session.
Warning: Invalid value "COMMAND_START_GNOME=gnome-session"
         Users will not be able to request a Gnome session.
Warning: Invalid value "COMMAND_START_CDE=cdwm"
         Users will not be able to request a CDE session.
Warning: Invalid value "COMMAND_XTERM=xterm"
         Users will not be able to request an xterm session.
Warning: Invalid value "COMMAND_SMBMOUNT=smbmount". You'll not be able to use SA                                                                                                             MBA.
Warning: Invalid value "COMMAND_SMBUMOUNT=smbumount". You'll not be able to use                                                                                                              SAMBA.
Warning: Invalid cupsd version of "/usr/sbin/cupsd". Need version 1.2.
         Users will not be able to enable printing.
Warning: Invalid value "COMMAND_SESSREG=sessreg"
         Logged in users will not be registered with sessreg.

  Warnings occured during config check.
  To enable these features please correct the configuration file.

<---- done

----> Testing your nxserver connection ...
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is c8:4b:0f:7b:72:65:da:4a:5d:f9:c4:9d:f7:5a:46:6f.
Are you sure you want to continue connecting (yes/no)?
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
Fatal error: Could not connect to NX Server.

Please check your ssh setup:

The following are _examples_ of what you might need to check.

        - Make sure "nx" is one of the AllowUsers in sshd_config.
    (or that the line is outcommented/not there)
        - Make sure "nx" is one of the AllowGroups in sshd_config.
    (or that the line is outcommented/not there)
        - Make sure your sshd allows public key authentication.
        - Make sure your sshd is really running on port 22.
        - Make sure your sshd_config AuthorizedKeysFile in sshd_config is set to                                                                                                              authorized_keys2.
    (this should be a filename not a pathname+filename)
  - Make sure you allow ssh on localhost, this could come from some
    restriction of:
      -the tcp wrapper. Then add in /etc/hosts.allow: ALL:localhost
      -the iptables. add to it:
         $ iptables -A INPUT  -i lo -j ACCEPT
         $ iptables -A OUTPUT -o lo -j ACCEPT
pi@raspberrypi /usr/NX/bin $


Buy Game Console Adapters from http://www.easymg.com or http://www.diygadget.com

</span>



10 PCS, 10cm x 10cm, 2 layers prototype for $38.80 shipped!