NoMachine Support

Your questions answered

Knowledge Base

Searching in: Articles & FAQs
Filter the search results
Applies to:
Last update:
Searching in: Articles & FAQs
ID: AR10K00710
Applies to: NX Server Products
Added on: 2013-10-08
Last update: 2016-05-30
How to use NoMachine 4 (free) on a headless Linux server

This articles applies to NoMachine v. 4 only.


NoMachine v. 5 no longer requires to manually install a display server like Xvfb as described below: when the local X server cannot be found, NoMachine will use its own display service (that is an embedded X server) to let users connect seamlessly a physical desktop running in background on the remote machine.

Pre-requisite: Having a desktop environment installed.

For more technical details refer to the following feature request:

https://www.nomachine.com/FR10L02842

 


Manual procedure for NoMachine 4:

Pre-requisite: Having a desktop environment installed.

In order to use NoMachine version 4 on a headless Linux server (this also includes VMs running on, for example, Amazon EC2)  you will need to manually create a virtual display and start a desktop environment. This happens because the graphics hardware is often turned off on headless machines, making the X server unable to start.

You can use a display server like Xvfb for creating the virtual display and then run GNOME or another desktop environment. Examples below use 'display :0' .

If you want to set a different display, change the node.cfg key: #DisplayDefault :0 by replacing the '0' with the correct number.

Examples are for:

1) Debian/Ubuntu, tested on Ubuntu 12.04 LTS and Debian 6.

2) RHEL, tested on RHEL 6.

Note:

Commands below use the 'sudo' utility, if you don't have the sudo utility installed, log on as superuser ("root") and run the commands without sudo.

 

Example 1 - Debian/Ubuntu

Step 1: Install  Xvfb on your server host machine

$ sudo apt-get install xvfb

Step 2: Create a random cookie (a 16-hex-digit string)

$ COOKIE=`ps -ef | md5sum | cut -f 1 -d " "`

Step 3: Create the Xvfb authority file with the just-created cookie

$ AUTHFILE=$HOME/Xvfb-0.auth
$ xauth -f $AUTHFILE add :0 MIT-MAGIC-COOKIE-1 $COOKIE

If you want to use a different value for AUTHFILE specify an absolute path.

Don't worry if xauth says "file Xvfb-0.auth does not exist". The file will be created at that time.

Step 4: Add the cookie to the user's authority file

$ xauth add :0 MIT-MAGIC-COOKIE-1 $COOKIE

Step 5: Run Xvfb with 24-bit screen depth

$ Xvfb :0 -auth $AUTHFILE -screen 0 1024x768x24 &

Step 6: Run the desktop environment

$ DISPLAY=:0 nohup /etc/X11/Xsession default &


Example 2 - RHEL

Step 1: Install  Xvfb on your server host machine

$ sudo yum install xorg-x11-server-Xvfb
 

Note for RHEL 7 users:

This package is not in the standard RHEL 7 repositories, when you get message 'No package Xvfb available', it is likely you need to enable the optional content repositories.

 

Step 2: Create a random cookie (a 16-hex-digit string)

$ COOKIE=`ps -ef | md5sum | cut -f 1 -d " "`

Step 3: Create the Xvfb authority file with the just-created cookie

$ AUTHFILE=$HOME/Xvfb-0.auth
$ xauth -f $AUTHFILE add :0 MIT-MAGIC-COOKIE-1 $COOKIE

If you want to use a different value for AUTHFILE specify an absolute path.

Don't worry if xauth says "file Xvfb-0.auth does not exist". The file will be created at that time.

Step 4: Add the cookie to the user's authority file

$ xauth add :0 MIT-MAGIC-COOKIE-1 $COOKIE

Don't worry if xauth says "file .Xauthority does not exist". The file will be created at that time.

Step 5: Run Xvfb with 24-bit screen depth

$ Xvfb :0 -auth $AUTHFILE -screen 0 1024x768x24 &

Step 6: Run the desktop environment

If you don't have a desktop environment installed, please install it.

For example to install a gnome desktop environment run: 

$ sudo yum groupinstall 'X Window System' 'GNOME'

Once the desktop environment is installed, start it on display 0. In case of a gnome environment:

$ DISPLAY=:0 nohup /etc/gdm/Xsession gnome-session &

Step 7: Restart the NoMachine server

$ sudo /usr/NX/bin/nxserver --restart

 

Your NoMachine is now ready for connections. Run the client and connect to the desktop of your headless linux server.


 

Notes

NoMachine Workstation or any of the other products supporting virtual desktops will let you connect even if you don't have an X server running. When connecting to a Linux host which doesn't have an xserver running, you will be able to run "virtual desktop sessions".

See the following article for differences between NoMachine (free) and NoMachine Workstation:

https://www.nomachine.com/AR10K00702

and for differences between connections to the physical desktop and virtual desktops:

https://www.nomachine.com/AR10K00700