Posted by Steve on Sun 1 Jan 2006 at 15:46
Xen, the virtualisation system, is a great tool for running fresh copies of an operating system. However it doesn't allow you to run X11 programs. Here we can fix that with the help of VNC.
VNC is the "virtual network computer", a simple tool which allows you to share a graphical display to other hosts. We introduced using VNC to graphically administer remote computers last year.
If we have a virtual installation of Debian running within Xen we can use the VNC server to export the graphical display to all machines upon the LAN - this is perfect for running programs such as Firefox which require a display.
(The other approach is to use X11 forwarding via SSH. That will work nicely for many programs, but if you're wanting an actual desktop it isn't so hot.)
To setup the export of the display is relatively simple. We just need to install the X11 packages upon the virtual instance, and any programs we might wish to run, and then make a minor tweak to export the display.
Upon the virtual image run:
apt-get update apt-get install xserver-xfree86 vncserver xfonts-100dpi xfonts-75dpi xfonts-base rxvt
This will give your instance almost everything it needs. The only things you're missing is a window manager and a login manager. We'll come back to those shortly.
Once the installation has finished you'll be prompted to configure your X server - you may simply select all the default answers. The system should default to a Vesa video server and this is sufficient for our needs.
The next step is to configure a login manager, so far I've tested xdm and gdm and both work nicely. (If you can get kdm to work I'd appreciate a comment with details.)
The login manager is the thing that we'll need to update to export the display via VNC. We'll also need to install a window manager, or desktop manager for to run.
I'm a fan of the simplicity of IceWM, so we'll use that:
apt-get install icewm-experimental
Now we choose the login manager. xdm is simple and basic, gdm has the useful advantage of having a "shutdown" and "reboot" button - so you might prefer that. (No matter if you're not running GNOME!)
XDM SetupGDM SetupXDM setup is very simple, you can install it and configure it to use the VNC server to export its display with:
apt-get install xdm echo ':0 /usr/bin/Xvnc /usr/bin/Xvnc -geometry 1024x768 -depth 24' \ > /usr/X11R6/lib/X11/xdm/XserversOnce this has been done start the manager with:
/etc/init.d/xdm stop /etc/init.d/xdm start
GDM setup is also pretty painless once it has been installed. We just need to make a change to the configuration file /etc/X11/gdm/gdm.conf, and add a new section.
Install gdm as follows:
apt-get install gdmNow we add a new section to end of the configuration file:
cat <<EOF >> /etc/X11/gdm/gdm.conf [server-VNC] name=VNC server command=/usr/bin/Xvnc -geometry 800x600 -depth 24 flexible=true EOFFinally we make that section the active server:
perl -pi.bak -e 's/^0=Standard/0=VNC/g' /etc/X11/gdm/gdm.confOnce this has been done we can restart the server as follows:
/etc/init.d/gdm stop /etc/init.d/gdm start
Once you've setup the login manager you should be able to connect from the host to the virtual server just by running:
xvncviewer xx.xxx.xx.xx
Where xx.xx.xx.xx is the IP address of your virtual server. Login and you should have complete control over the desktop - just as if it were a real machine in front of you.
(If you don't have it installed upon the host already you can fetch it with "apt-get install xvncviewer".)
You might want to experiment with different sizes for the display the defaults shown above of 800x600 can be changed to, say, 1024x768, if you have the screen space for it!
The only obvious drawback of using this approach is that the VNC server may be connected to without any password by anybody upon your LAN.
Firewalling is the order of the day here..
From the article:
The next step is to configure a login manager, so far I've tested xdm and gdm and both work nicely. (If you can get kdm to work I'd appreciate a comment with details.)
Feel free to try it yourself, and let us know what you had to do to get it working ..
[ Parent ]
[ Parent ]
Strange I don't see that on my system - using a real host rather than VMWare.
[ Parent ]
[ Parent ]
Yes you can use "ssh -X", or "ssh -Y", and that works as expected. The problem is you cannot run a real X server since there is no graphical window to display the output in - if that makes sense?
[ Parent ]
[ Parent ]
[ Parent ]
Hard to say without more details.
Is the GDM/XDM manager running? (Which did you install?)
Is there firewalling rules preventing external connections?
Are you running "vncviewer xx.xx.xx.xx:1", or "vncviewer xx.xx.xx.xx" ? (Assuming you have networking setup and xx.xx.xx.xx is the correct addresss.)
What have you tried to debug the situation?
[ Parent ]
[ Parent ]
I think all your vnc problems are probably network related, so posting the the xen-users list is definitely the best thing to do.
Once they've helped sort out your problem you'll probably find VNC works properly too.
[ Parent ]
[ Parent ]
Look at /var/log/gdm/ to see which logfiles are produced and see what messages they contain - it could be there are errors in your setup which make gdm die prematurely.
[ Parent ]
[ Parent ]
[ Parent ]
After installation edit /etc/gdm/gdm.conf:apt-get install gdm
Then restart gdm:[servers] #We do NOT want to start any local X-Server here #0=Standard [xdmcp] #We need to ENABLE XDMCP here Enable=true
That was it. You should now be able to start a gdmXnestchooser on your workstation and connect to the displayless machine vi xdmcp. If you do not see the host in the list, add it's IP address manually. Next you need to set up whatever X should do.invoke-rc gdm restart
[ Parent ]
[ Parent ]
[ Parent ]
vnc1024 5901 /tcp # normal
vnc1024 stre am tcp nowait nobody /usr/bin/Xvnc Xvnc -inetd -query 127.0.0.1 -once -depth 16 -geometry&nbs p;1024x768
[ Parent ]
[ Parent ]
[ Parent ]