2,253
edits
Changes
m
Robot: Automated text replacement (-VE +container)
There are several ways to run X applications inside your [[VEcontainer]].
== X forwarding ==
=== Single application ===
To run an X application inside a [[VEcontainer]], one need simply to connect to a VE container with '''ssh -X''':
<pre>
host# ssh -2 -c blowfish -X user@address
</pre>
After login to VE container check that <code>$DISPLAY</code> variable is set and X11 forwarding is enabled:
<pre>
ve# echo $DISPLAY
</pre>
In case <code>$DISPLAY</code> is not set, make sure that X forwarding is enabled in <code>sshd</code> config inside VEcontainer. In most Linux distros sshd configuration is stored in <code>/etc/ssh/sshd_config</code>. You should set parameter <code>X11Forwarding</code> to <code>yes</code>. Also VE container should contain <code>xauth</code> package, thus install <code>xauth</code> if it is missing (in Debian this is part of the xbase-clients package). After that, restart your sshd daemon:
<pre>
ve# /etc/init.d/sshd restart
{{Note|Don't forget to reconnect after this}}
Now you can run X applications from your VEcontainer:
<pre>
ve# firefox
== VNC for X desktop ==
First, one need to run '''Xvnc''' server inside VEcontainer. The easiest way for this is to run
'''vncserver''' script. This scripts starts all the required services
and small http daemon which provides graphical web access to your desktop (via Java applet).
using '''vncviewer''' command:
<pre>
host# vncviewer <VE_IPcontainer_IP>:1
</pre>
=== Starting KDE desktop with VNC ===
To start KDE desktop instead of default twm one replace <code>twm &</code> line with <code>startkde &</code> in user's
<code>~/.vnc/xstartup</code> file on the VEcontainer.
=== Connecting with VNC from firewalled network ===
This method will give you a graphical login prompt remotely similar to VNC, but with some differences. Most notably, XDMCP is faster than VNC (due to the way each deals with screen handling) and but you CANNOT connect to existing sessions like you can with VNC. Each time you logout, your programs are closed. XDMCP is better suited in situations where you don't have a local display (or dumb terminals/clients) but want to run X11 programs
=== VE container Configuration ===
Install your desktop environment as you'd like (kde/gnome/xfce/etc) and ensure you install at least XDM. You can opt to use GDM/KDM as they also do the same job as XDM. The configuration for KDM/GDM is different than XDM's and I was only able to find one link on configuring GDM (more below).
(Please keep in mind the security implications by the above line. Read the comments found in the file and set it appropriately)
To provide the possibility to run sound applications from VEcontainer, /dev/dsp device file needs to be exported in VEcontainer:
<pre>
vzctl set 221 --devnodes dsp:rw --save
</pre>
Finally, if you intend to make xdm invoking a heavy desktop like kde, it is reasonable to increase the amount of memory available for allocation inside this VEcontainer:
<pre>
vzctl set 221 --privvmpages 500M:600M --save
For light desktop like icewm this is not needed.
Once these changes have been made, start your xdm server by the appropriate startup script (typically similar to /etc/init.d/xdm start). That concludes the XDM setup in the VEcontainer.
===== GDM =====
=== Client/Host Configuration ===
On the Client/Host (whatever machine you are connecting from to the VEcontainer), you need to install ONLY a bare Xserver as per your OS instructions (use yum, emerge, apt, whatever). A desktop environment like XFCE/GNOME/KDE is entirely optional on the client, but keep in mind that it won't be used while you're connecting to the desktop on the VEcontainer.
To get access to the XDM server, just start an Xserver with '''X -query <remote IP> :0''' (where :0 is the local display...set to :1 if you already have an X session running, or use Xnest)
=== Errata ===
On a side note, as of December 2007, I was never able to successfully get an Xserver to run inside a VE container and have the display output onto virtual-terminal 7 (the Xserver default), However, you can get an Xserver running on the hostnode to display output on virtual-terminal 7 without any special configuration (as the hostnode has direct access to all necessary devices).
== See also ==
* [[NX inside VEcontainer]]
== External links ==