I’ve been doing a good amount of Ruby development lately and I really wanted to have a dedicated box to use as an internal (w/in my house) CI box… and possibly a staging server to host some Rails apps I was playing with. Anyhow, I had an old, unused box sitting in the basement – perfect!
I installed the latest Ubuntu bits, 8.04 (Hardy Heron) and had the box up and running in no time. However, as I intended to keep this box in the basement, without a monitor, keyboard, or mouse, I needed to be able to access and administer it remotely.
Granted, most of the work I’d need to do could be accomplished via SSH, but there were a few things I was going to need a GUI for – I needed remote desktop! Or just VNC. :)
Going headless
Ubuntu does support VNC out of the box, but you need to have an active X-Windows (Gnome, KDE, etc…) session already running before you fire up the VNC server.
But this was going to be a headless box! So short of hauling a monitor and keyboard to the basement every time I needed to bounce the box, which is rare, I had no way to get an X session started.
VNC Server, to the rescue!
To enable full GUI remote login you need a VNC server instance running on the box, and you need to launch an x session – I’m a Gnome guy myself, so we’ll go that route.
- SSH into the box and install TightVNCServer
sudo apt-get install tightvncserver
- Set Gnome to start when your VNC session starts
- Start the VNC Server
vncserver –geometry widthxheight –depth 24
- You will probably be prompted to enter a password that you'll use later to connect to this VNC session... so enter one!
- Start your VNC client on the remote machine, enter the password from step 3, and enjoy!
One side note. After logging into my VNC session I noticed that my keyboard mappings were all jacked-up. For example, typing asdf would result in abfh. After some searching, this appears to be an issue w/Gnome, but luckily I also found a workaround.
Oh… and you should probably be connecting to your VNC session via an SSH tunnel, but that’s a topic for another blog post… or use your Google-fu!
Technorati Tags:
ubuntu,
vnc,
ssh