I’m sure you’ve heard of Remote Desktop Connection on Windows. It can be used to access remote windows PC over the internet. Same can be achieved for remote Ubuntu servers with VNC. VNC enables you to access remote Ubuntu servers with a graphical user interface on your local windows machine. I’m going to show you how to configure VNC on Ubuntu 14.04 droplet from DigitalOcean.
Ubuntu 16.04 LTS is out now. My Ubuntu 16.04 Remote Desktop tutorial includes a video howto. Setting up VNC for remote desktop connection on Ubuntu 16.04 is easier than on Ubuntu 14.04. So you might want to follow that tutorial instead.
A couple of days back, I had posted a tutorial that will help you turn Ubuntu 14.04 server to a Seedbox with Transmission. It’s a great way to download torrents. But if you want more than that, let’s say you’re uploading downloaded files to a file-host like Depositfiles to make some money. Then you’ll probably need to RAR your files, create thumbnail of videos, add some additional files etc… Although all of these can be done with command line, it’ll be a difficult task for even experienced sys admins due to file paths. It takes some time to type file-names with spaces on them on CLI. It’s really confusing and time-consuming. So the solution would be to access the Ubuntu desktop remotely. This is how I configured my VPS to enable remote desktop access.
Install Ubuntu Desktop
Let’s start by updating apt cache,
apt-get update
Following command will install Ubuntu desktop on your Ubuntu 14.04 server,
apt-get install ubuntu-desktop
Install VNC Server
Following command will install gnome packages that are required by VNC Server,
apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
Since the server is now ready for VNC, let’s install it by running below command,
apt-get install vnc4server
Now open vncserver config file with nano,
nano /usr/bin/vncserver
Look for the following line (Ctrl+W),
"# exec /etc/X11/xinit/xinitrc\n\n".
Paste following lines after that,
"gnome-panel &\n". "gnome-settings-daemon &\n". "metacity &\n". "nautilus &\n". "gnome-terminal &\n".
File should look like this after changes,
Start a VNC session with following command,
vncserver
It’ll ask you to create a password that will be used to access your desktop. Setting up VNC on remote server is now completed. But you’ll need a VNC viewer installed on your PC to access it. I use RealVNC. It’s free for personal use.
Install VNC Viewer on your PC and you’ll see following window when you open it.
Type your server’s ip address followed by :1 and then click Connect. You’ll be asked for the password you created earlier. Entering correct password will open your Ubuntu 14.04 server’s desktop in a new window. Now if you’re familiar with Ubuntu, you’ll know what to do. If not take some time and get used it.