This tutorial is about, how to install a graphical environment (GUI) on Linux VPS and VNC server to let you connect to your VPS GUI desktop from your computer via browser based noVNC client and to use VPS server as a desktop computer, run Firefox, OpenOffice and other programs.
We are going to install Lubuntu Desktop on an Ubuntu 18.04 VPS server. Then setup TightVNC server on it. After that install and configure noVNC so that you’ll be able to access the Lubuntu desktop using the browser based VNC client, noVNC.
Latter part of this tutorial discuss about, how to access Lubuntu desktop with another software (Real VNC Viewer) rather than browser based noVNC.
Note: I am using a 5$ – Ubuntu 18.04 x64 – Vultr VPS for this tutorial.
Lubuntu Desktop Installation
Login to your VPS server as root via SSH.
Firstly, update system packages by issuing following command:
Then Install the Lubuntu Desktop:
apt-get install lubuntu-desktop
It may take about 10 -15 minutes for the installation. After the installation, you’ll have a full-fledged desktop environment with some handy applications like AbiWord for docs and Firefox for web browsing.
Then reboot your server for changes to be take effect:
Install and Setup TightVNC Server
Now we are going to install TightVNC server so that we can access our Lubuntu desktop using a VNC client.
Issue following command to install TightVNC server:
apt-get install tightvncserver
Then install xfonts-base:
apt-get install xfonts-base
After that start the VNC server:
Here you’ll prompt to enter a password to access the VPS server. If you like your can setup a view/read – only password also. (In this tutorial, I am not setting up a view-only password)
Now your VNC server is up and running but you need to do some extra configurations in order to access the desktop with a VNC client.
Make the VNC configuration file executable:
sudo chmod +x ~/.vnc/xstartup
Edit the VNC configuration file:
Remove all the content and replace with following lines.
#!/bin/sh xsetroot -solid grey export XKL_XMODMAP_DISABLE=1 #autocutsel -fork openbox & /usr/bin/lxsession -s Lubuntu &
Finally your configuration file should look as follows.
Save and close the configuration file:
Ctrl + X
Stop the previous VNC server:
vncserver -kill :1
Start the VNC server with new configurations:
Install and Configure noVNC
Now it’s time to install noVNC so that we can access our Lubuntu desktop via web-browser.
Firstly lets’ install some essential packages:
apt -y install novnc websockify python-numpy
Then create a SSL certificate with openSSL:
cd /etc/ssl openssl req -x509 -nodes -newkey rsa:2048 -keyout novnc.pem -out novnc.pem -days 365
Provide required details appropriately.
Setup permission for the certificate file:
chmod 644 novnc.pem
Start Websockify with the user who run VNC server and proxy localhost:5901 on port 6080:
websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/novnc.pem 6080 localhost:5901
Then you’ll get an output as follows:
Connect with noVNC
Access to the [http://SERVER_IP_ADDRESS:6080/vnc.html] from your client web browser, and then noVNC form is displayed like follows, Login with VNC password.
Now you have successfully access to your Lubuntu desktop.
Note: If you are unsatisfied with the default dimensions of Lubuntu desktop in noVNC (scroll bars may be bothering you etc.), you can easily change the dimensions by following these steps.
- Stop the VNC server
vncserver -kill :1
- Start the VNC server again by specifying custom dimensions.
I have specified 1024×768 as my dimensions.
vncserver :1 -geometry 1024x768 -depth 16 -pixelformat rgb565
Alternative Connection: Real VNC Viewer
Rather than using your browser to access Lubuntu Desktop, you can use a VNC Viewer like RealVNC.
Download the VNC Viewer appropriate to your platform: Click Here
Install the Viewer and run it.
Then you’ll obtain a window like below.
Type the SERVER_IP_ADDRESS:5901 in the “VNC Server Address” text box and press “Enter”.
Then you’ll prompted with a security warning, Accept it. After that you’ll be asked for the VNC password. Enter the password and proceed forward.
Now you have successfully accessed the Lubuntu Desktop with Real VNC Viewer.
If you are not satisfy with the quality of display in Viewer, you can easily change it by going to Properties and increasing Picture quality to High.
Thank you 🙂