Difference between revisions of "NX inside VE"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Troubleshooting)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
You can run full graphical remote desktop inside container using [http://en.wikipedia.org/wiki/NX_technology NX technology]. This is handy for when you work from home and you wish to run a web browser on your work's internal network to access local resources. You can use NX client to connect to remote NX server.
 
You can run full graphical remote desktop inside container using [http://en.wikipedia.org/wiki/NX_technology NX technology]. This is handy for when you work from home and you wish to run a web browser on your work's internal network to access local resources. You can use NX client to connect to remote NX server.
 +
 +
[http://www.x2go.org/ x2go] is a related project that uses a fork of the NX3 GPL'ed libraries and works fairly well and doesn't have the limitations that the free (gratis) version of NX from NoMachine has.  x2goserver and x2goclient packages are available as stock packages in several distros including Fedora 19 and 20, as well as being available for RHEL6/clones via the EPEL repository.  If you can't find x2go packages in your distro's stock repository, check the x2go website for packages.  x2go is actually easier to setup.  Just install the desired GUI desktop inside of your container, install x2goserver, enable the x2gocleansessions service, make sure sshd is enabled... and connect as a user account over ssh via the x2goclient from the desired remote machine making sure to select the appropriate settings in the client.
 +
  
 
= Fedora =
 
= Fedora =
Line 51: Line 54:
 
Install X and XDM
 
Install X and XDM
 
<pre>apt-get install xorg xdm</pre>
 
<pre>apt-get install xorg xdm</pre>
Then add this 3rd party repo to sources.list
+
Then add this 3rd party repo to sources.list.  (Warning: the datakeylive.com repository below is obsolete!  No ubuntu repository offers freenx at the moment)
<pre>
+
 
deb http://www.datakeylive.com/ubuntu gutsy main
+
<tt>deb <s>http://www.datakeylive.com/ubuntu</s> gutsy main<br>
deb-src http://www.datakeylive.com/ubuntu gutsy main
+
deb-src <s>http://www.datakeylive.com/ubuntu</s> gutsy main<br>
</pre>
+
</tt>
Install the repo keys and update:
+
Install the repo keys and update:<br>
<pre>
+
<tt>
wget http://www.datakeylive.com/ubuntu/dists/gutsy/wjeremy.key -O - | apt-key add -
+
wget <s>http://www.datakeylive.com/ubuntu/dists/gutsy/wjeremy.key</s> -O - | apt-key add -<br>
wget http://www.datakeylive.com/ubuntu/dists/gutsy/alivesoftware.key -O - | apt-key add -
+
wget <s>http://www.datakeylive.com/ubuntu/dists/gutsy/alivesoftware.key</s> -O - | apt-key add -<br>
 
sudo apt-get update
 
sudo apt-get update
</pre>
+
</tt>
 
Install FreeNX (*)
 
Install FreeNX (*)
 
<pre>
 
<pre>

Latest revision as of 22:19, 2 January 2014

You can run full graphical remote desktop inside container using NX technology. This is handy for when you work from home and you wish to run a web browser on your work's internal network to access local resources. You can use NX client to connect to remote NX server.

x2go is a related project that uses a fork of the NX3 GPL'ed libraries and works fairly well and doesn't have the limitations that the free (gratis) version of NX from NoMachine has. x2goserver and x2goclient packages are available as stock packages in several distros including Fedora 19 and 20, as well as being available for RHEL6/clones via the EPEL repository. If you can't find x2go packages in your distro's stock repository, check the x2go website for packages. x2go is actually easier to setup. Just install the desired GUI desktop inside of your container, install x2goserver, enable the x2gocleansessions service, make sure sshd is enabled... and connect as a user account over ssh via the x2goclient from the desired remote machine making sure to select the appropriate settings in the client.


Fedora[edit]

Connecting remotely with NX Client to Fedora inside OpenVZ container.
  • Use fedora template to create new container and install desktop of your choice:

GNOME:

yum groupinstall "GNOME Desktop Environment"

KDE:

yum groupinstall "KDE (K Desktop Environment)"

XFce:

yum groupinstall "XFCE"


  • You may need to install additional package audiofile:
yum install audiofile


  • Download installation RPM packages for server from site www.nomachine.com. Choose right architecture i386 or x86_64.

Example:

wget http://64.34.161.181/download/3.4.0/Linux/nxclient-3.4.0-5.i386.rpm
wget http://64.34.161.181/download/3.4.0/Linux/nxnode-3.4.0-6.i386.rpm
wget http://64.34.161.181/download/3.4.0/Linux/FE/nxserver-3.4.0-8.i386.rpm


  • Do simple manual installation of RPM packages.

Example:

rpm -ivh nxclient-3.4.0-5.i386.rpm
rpm -ivh nxnode-3.4.0-6.i386.rpm
rpm -ivh nxserver-3.4.0-8.i386.rpm


  • Done. You can now connect from NX client to your server.


Ubuntu[edit]

Installation[edit]

Create a new container using the gutsy template. Edit /etc/apt/sources.list and enable the "multiverse" repository. Install X and XDM

apt-get install xorg xdm

Then add this 3rd party repo to sources.list. (Warning: the datakeylive.com repository below is obsolete! No ubuntu repository offers freenx at the moment)

deb http://www.datakeylive.com/ubuntu gutsy main
deb-src http://www.datakeylive.com/ubuntu gutsy main
Install the repo keys and update:
wget http://www.datakeylive.com/ubuntu/dists/gutsy/wjeremy.key -O - | apt-key add -
wget http://www.datakeylive.com/ubuntu/dists/gutsy/alivesoftware.key -O - | apt-key add -
sudo apt-get update
Install FreeNX (*)

apt-get install expect openssh-server tcl8.4 libxcomp2 libxcompext2 libxcompshad nxlibs nxagent nxproxy nxclient freenx openssl

For Ubuntu 8.04 :

apt-get install expect openssh-server tcl8.4 libxcomp3 libxcompext3 libxcompshad nxlibs nxagent nxproxy nxclient freenx-server openssl

Finally install XFCE

apt-get install xfce4

Configuration[edit]

Configuring X[edit]

In /etc/X11/xdm/xdm-config, comment out the line where it says DisplayManager.requestPort: 0

In /etc/X11/xdm/Xservers, comment out the line :0 local /usr/bin/X :0 vt7 (this starts a local X server, which will fail)

In /etc/X11/xdm/Xaccess, uncomment the line with * #any host can get a login window (Please keep in mind the security implications by the above line. Read the comments found in the file and set it appropriately)

Configure NX Server[edit]

Edit /etc/X11/xorg.conf. Ensure that the files section looks similar to this:

Section "Files"

        # path to defoma fonts
        FontPath     "/usr/share/fonts/X11/misc"
        FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/Type1"
        FontPath     "/usr/share/fonts/X11/100dpi"
        FontPath     "/usr/share/fonts/X11/75dpi"
EndSection

Now create a local user account:

useradd -m <username>

Now add this user to nxserver:

nxserver --adduser <username>

Configure NX client[edit]

Setup the Host/Port. In the desktop section select Unix and Custom. In Settings, select "Run the default X client script on server" and select "New virtual Desktop".

Now try to connect. You should get the XFCE desktop.

Thanks to dantalizing for the feedback.

Troubleshooting[edit]

(*) If you get any errors like:

dpkg: error processing /var/cache/apt/archives/libxcomp3_3.1.0-6-2_i386.deb (--unpack):
trying to overwrite `/usr/lib/libXcomp.so.3.1.0', which is also in package libxcomp2

while installing the libxcomp package, just force-install the libxcomp package:

# cd /var/cache/apt/archives
# dpkg --force-all -i libxcomp3_3.1.0-6-2_i386.deb
# apt-get -f install

You can't print from VE to client PC easily because printing in NX is realized via samba-mount of shared client's printer and CIFS isn't virtualized yet.