Setting up FreeNX for VNC on CentOS 5 and 6

For some people, the command line is just too much, and they find that it is too hard to maneuver and use as a whole. So, a lot prefer to install a VNC client so they can see and use the VPS or dedicated server as if it were their own desktop PC. If you are one of these people, that hate using commands for everything, and prefer a GUI (Graphical User Interface) over it, then this tutorial will help you do that on CentOS 5 and 6.


First we will need to install some modules to get everything running smoothly.


sudo yum update && sudo yum upgrade

After that has run.

Centos 5

sudo yum groupinstall 'GNOME Desktop Environment' 'X Window System'

Centos 6

sudo yum groupinstall 'Desktop' 'X Window System'


The next part is for Centos 5.x only, doing this on Centos 6.x could result in not being able to connect VIA SSH on your VPS.

FreeNX needs to make a SSH connection on the localhost. We need to check to make sure that SSH is available at the localhost (your server).


netstat -an |grep 22

You should see something along the lines of:

tcp    0   0*         LISTEN 
tcp    0   0 :::22*              LISTEN 

If you see something similar to this, we're good to go!

Now we need to install the actual FreeNX server on our server. Execute the following:

sudo yum install nx freenx 

This will install FreeNX onto our server, and is the stepping stone to our GUI friend.

Now we need to set up our newly installed software.

The NX software uses SSH to connect to the service. If you are using a key authentication, you will need to add the username to the FreeNX user list. (If you don't use key based authentication, you can move on from this).


nano /etc/nxserver/node.conf

Make sure that that file contains the following line and that it is active (Not with the “#” symbol beside it)


Now we need to add ourselves to the NX database. Execute:

sudo nxserver –adduser YOURUSERNAME

Which should output something along the lines of:

NX> 100 NXSERVER - Version 1.5.0-60 OS (GPL) 
NX> 1000 NXNODE - Version 1.5.0-60 OS (GPL) 
NX> 716 Public key added to: /home/YOURUSERNAME/.ssh/authorized_keys2 
NX> 1001 Bye. 
NX> 999 Bye 

Now we shall add a password for our newly created user. Execute:

sudo nxserver –passwd YOURUSERNAME

And that command should spit out something like this:

NX> 100 NXSERVER - Version 1.5.0-60 OS (GPL) 
New password: 
Password changed.
NX> 999 Bye 

Now, we have our new user made, we have his or her password created, our machine is now ready to accept NX clients to login with.

Installing NX Client

Now for this you have 2 options. You can install the Nxclient from nomachine here or you can use the open source alternative (which I recommend because…it's open source) called opennx, available here.

I will be assuming that you are using windows for your device that you will be accessing your remote desktop from, but if not, the procedure is relatively the same on all devices/Operating systems.

Open the NX connection wizard. Enter a name that you find fit. I usually name it by my machines “hostname”. Then for “Host” put in your hostname or your servers IP address. The port number you an leave as is (22 is usually the default). If you are running on a fast internet connection, throw the speed dial/bar up to the max. Otherwise just put it where you think it would fit.

Click “Next”. Now you will be prompted to set the type and size of your remote desktop. Unix, Gnome, and whatever size you want your remote desktop to be. I find anywhere between the ranges of W800xH600 to W1024xH768 to be sufficient. But it is up to you.

Click “next” and now we should be prompted with our final wizard page, I check both boxes. So it is up to you if you do as well.

Once we are done this, we still have a little bit more configuring to do.

In the “advanced” window, under the “general” tab, you should see somewhere there a “Key..” button. Click the button, and keep this windows open for a second.

Now if you have closed out of your SSH session, re-open it, if you haven’t, you will need to do a few things.

cd /etc/nxserver/

Now execute:


This will show us the directory’s files it contains. Find the file named client.id_dsa.key and execute the following:

sudo bash

Type in your root password, then:

nano client.id_dsa.key

You will see something akin to a PGP key here. Copy all of the text, including the header and footer. Paste that key into the client we just opened on our PC, overwriting all of the text that is there in the Key management section. Then hit save.

After that is saved, click “OK” and we are pretty much done!

If you are using NoMachines NX client opposed to our openNX client, the process is almost identical. So I am sure you will get it.

You should now be able to VNC into your VPS or Dedicated server easily. Congratulations!

How to

QR Code
QR Code setting_up_freenx_as_vnc_on_centos_5_and_6 (generated for current page)