Installing VNC Server on Ubuntu Server

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

dpkg-reconfigure xserver-xorg

Start GDM

/etc/init.d/gdm start

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;

nano ~/.vnc/xstartup

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

And xinitrc.

chmod +x /etc/X11/xinit/xinitrc

Reboot the server.

reboot

Now we can start the VNC Server.

vncserver :1

:# 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)

VNC Viewer

To kill the vncserver, use vncserver -kill :1

Advertisements

7 thoughts on “Installing VNC Server on Ubuntu Server

  1. hello odinhg, thanks for the wonderful tutorial. it saves me from lots of headache! Now I am also running a vnc and gui with openvpn on my vps on mosso. keep it up!

    Like

  2. Hi odinhg,
    my name is harry. I have 2 questions to you.
    1. Do you have also such a fine tutorial for the use of UltraVNC ?
    2. In case of using tightvncserver or perhaps UltraVNC, what I have to do that the VNC-Server starts automaticly after reboot?

    Thans for your help
    Kind regards
    Harry

    Like

  3. Pingback: Installing VNC on an Ubuntu Server « Mark Alan Evans

  4. Pingback: Permissions on the VNC Server xstartup File | Embedded Software Engineer's IT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s