In this tutorial, we will install and setup a GUI/VNC server on an Ubuntu VPN package. We recommend using at least our Professional (2GB RAM) VPS package as VNC server requires more storage and RAM.
Setting up the VNC server
Run the commands below to install all required packages. In the installation process, you will be asked to select your Keyboard layout. Select the layout of the Keyboard accordingly.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
Now, run the command below to install the VNC server.
sudo apt-get install -y vnc4server
Start the VNC server by running this command. This will ask you to enter a password for VNC. You will be required to enter this command when we connect to the VNC later.
Run the command below.
echo "gnome-panel & gnome-settings-daemon & metacity & nautilus &" >> ~/.vnc/xstartup
Restart the VNC server by running:
vncserver -kill :1 && vncserver :1
Now run the command below to automatically start VNC server on reboot.
(crontab -l ; echo "@reboot /usr/bin/vncserver :1") | crontab -
You may see this error "no crontab for root" this can be ignored.
Installing VNC client
There are many VNC clients that you can use to connect to your server. We recommend using the RealVNC program. It can be downloaded for free here.
Once downloaded, run the program and install it on your computer.
Open the RealVNC program. You will see a text area where you can enter the server hostname (IP address). Enter your IP address with port 5901. For example: 18.104.22.168:5901. Now Press Enter to connect to the server. You will have to enter the password that we used earlier. You may receive an error saying the connection is not encrypted. This message can be ignored.