First of all, install SSH (sudo apt-get install ssh) on both the client and server machines, then follow this procedure for the server machine: (for the client machine, you only need install the client)

Visit the nomachine.com download page

Download and install the .deb files in the following order - client, node, server

Check that nxserver is running

sudo /usr/NX/bin/nxserver --status

and start it if it isn’t

sudo /usr/NX/bin/nxserver --start

Now start the nxclient

/usr/NX/bin/nxclient

NX Session Management

To see running NX sessions on the server:

sudo /usr/NX/bin/nxserver --list

Once you know the users online, and/or the session id, you can kill or suspend someone’s session on the server: Kill Session:

sudo /usr/NX/bin/nxserver --terminate [//SESSION-ID/USERNAME//]

Suspend Session, Can be resumed by re-running NX Client against the server:

sudo /usr/NX/bin/nxserver --suspend [//SESSION-ID/USERNAME//]