I had SSH access to a VPS, but wanted to set up a VNC server since I’m not that comfortable with doing everything in terminal yet. So I wrote this HowTo if anyone wants to know how.
First I had to install a GUI, so i connected to the server through ssh, logged in as root and installed the ubuntu-desktop package.
apt-get install ubuntu-desktop
This might take some time.. Go make some coffee, tea or what ever you like while it’s downloading and installing.
Now you have to install the gnome display manager.
apt-get install gdm
Reconfigure X server
Now we’ve a GUI, and we’re ready to install VNC Server.
apt-get install tightvncserver
Now, open ~/.vnc/xstarup in a text editor. If you use nano;
Then use this config.
unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc xsetroot -solid grey vncconfig -iconic & xterm -geometry 1024x768 -ls -title "$VNCDESKTOP Desktop" & exec gnome-session
After starting vncserver, I tried to connect, but I got only a grey screen. I read the log file and foun the following line.
sh: ~/.vnc/xstartup: Permission denied
So I had to chmod xstartup.
chmod +x ~/.vnc/xstartup
chmod +x /etc/X11/xinit/xinitrc
Reboot the server.
Now we can start the VNC Server.
:# is the display number, usually you want to use 1. Use vncserver –help for more options.
We can now download VNC Viewer and connect to the server by using “serveraddress:5901” (590 + the display number)
To kill the vncserver, use vncserver -kill :1