VNC X11 session on Ubuntu 12.04 server without monitor or graphics card
In doing so I felt there was no need to put a graphics card in the system. But I still wanted to vnc into the system, get a remote X11 session. Without any graphics card whatsoever you need vnc4server for that (or an NX server, but for internal purposes VNC would do just fine)
Start by becoming root
sudo -s
Now we'll install the server itself
apt-get install vnc4server
We also need a window manager, I'll choose for XFCE's. That might be a little too heavy for you, so you can choose something else like openbox or ratpoison. As long as you've got a window and session manager
apt-get install xfwm4 xfce4-session
I prefer the service to start automatically, so we'll create an upstart script for that.
nano /etc/init/vnc-server.conf
And pase this content in it. Replace "skerit" with your own username. Replace "1024x768" with your preferred resolution.
# vnc-server.conf
start on runlevel [2345]
stop on runlevel [016]
post-start script
su skerit -c '/usr/bin/vnc4server :0 -geometry 1024x768'
end script
post-stop script
su skerit -c '/usr/bin/vnc4server -kill :0'
end script
#End of File
Before actually starting this script, we have to run it ourselves in order to set up the password.
Unfortunately, this password must be at least 6 and at most 8 characters long.
Again: replace "skerit" with your own username.
su skerit -c 'vnc4server :0 -geometry 1024x768'
After this it'll tell you it has created several files that we'll need to edit:
New 'barabas:0 (skerit)' desktop is barabas:0
Creating default startup script /home/skerit/.vnc/xstartup
Starting applications specified in /home/skerit/.vnc/xstartup
Log file is /home/skerit/.vnc/barabas:0.log
Now we need to add something to that newly created xstartup script in order for it to actually start xfce4.
This should be the new content of xstartup:
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
startxfce4 &
Now all you need to do is start the newly created service:
start vnc-server
And now you can connect to it form your favorite vnc client.
Comments
meo
G0bble
lepo
demetri
Roman
Andy