In order to install VNC Server on Ubuntu 16.04 follow the next instructions (refer to https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-16-04 for more information)
Step 1 — Installing the Desktop Environment and VNC Server
By default, an Ubuntu 16.04 Droplet does not come with a graphical desktop environment or a VNC server installed, so we’ll begin by installing those. Specifically, we will install packages for the latest Xfce desktop environment and the TightVNC package available in the official Ubuntu repository.
On your server, install the Xfce and TightVNC packages.
sudo apt install xfce4 xfce4-goodies tightvncserver
To complete the VNC server’s initial configuration after installation, use the vncserver command to set up a secure password.
vncserver
You’ll be promoted to enter and verify a password, and also a view-only password. Users who log in with the view-only password will not be able to control the VNC instance with their mouse or keyboard. This is a helpful option if you want to demonstrate something to other people using your VNC server, but isn’t necessary.
Running vncserver completes the installation of VNC by creating default configuration files and connection information for our server to use. With these packages installed, you are now ready to configure your VNC server.
Step 2 — Configuring the VNC Server
First, we need to tell our VNC server what commands to perform when it starts up. These commands are located in a configuration file called xstartup in the .vnc folder under your home directory. The startup script was created when you ran the vncserver in the previous step, but we need modify some of the commands for the Xfce desktop.
When VNC is first set up, it launches a default server instance on port 5901. This port is called a display port, and is referred to by VNC as :1. VNC can launch multiple instances on other display ports, like :2,:3, etc. When working with VNC servers, remember that :X is a display port that refers to 5900+X.
Because we are going to be changing how the VNC server is configured, we’ll need to first stop the VNC server instance that is running on port 5901.
vncserver -kill :1
The output should look like this, with a different PID:
Output
Killing Xtightvnc process ID 17648
Before we begin configuring the new xstartup file, let’s back up the original.
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
Now create a new xstartup file with nano or your favorite text editor.
nano ~/.vnc/xstartup
Paste these commands into the file so that they are performed automatically whenever you start or restart the VNC server, then save and close the file.
~/.vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
The first command in the file, xrdb $HOME/.Xresources, tells VNC’s GUI framework to read the server user’s .Xresources file. .Xresources is where a user can make changes to certain settings of the graphical desktop, like terminal colors, cursor themes, and font rendering. The second command simply tells the server to launch Xfce, which is where you will find all of the graphical software that you need to comfortably manage your server.
To ensure that the VNC server will be able to use this new startup file properly, we’ll need to grant executable privileges to it.
sudo chmod +x ~/.vnc/xstartup
Now, restart the VNC server.
vncserver
The server should be started with an output similar to this:
Output
New ‘X’ desktop is fucci:1
Starting applications specified in /home/cciturria/.vnc/xstartup
Log file is /home/cciturria/.vnc/fucci:1.log
Now feel free to connect using your favourite VNC Viewer on port :1 (5901). Enter the password that you setup and that’s it, you should be able to see your graphical view:
In order to install VNC Server on OEL or a Fedora based OS, follow the next instructions:
-
If within the Oracle network, setup the Oracle proxy for YUM
vi /etc/yum.conf
As root, add line:
proxy=http://www-proxy.au.oracle.com:80
-
Install vnc and vncserver:
sudo yum install vnc
sudo yum install tigervnc-server
sudo yum install xinetd
vncpasswd
vncserver
If getting an error with missing libraries, try installing the following packages:
sudo yum install pixman pixman-devel
sudo yum install libXfont
Then repeat the steps:
vncpasswd
vncserver