gb
  English
Phone:  +1 (217) 636-4164
Skype:  onegbits
  1. Home
  2. Blog
  3. How to Install VNC on Ubuntu 16.04

How to Install VNC on Ubuntu 16.04

How to Install VNC on Ubuntu 16.04

26

Sep, 16

109

How to Install VNC on Ubuntu 16.04 What is VNC? VNC, or "Virtual Network Computing", is a connection system that allows you to use your keyboard and mouse to interact with a graphical desktop environment on a remote server. It makes managing files, software, and settings on a remote server easier for users who are not yet comfortable with the command line. In this guide, we will be setting up VNC on a Ubuntu 16.04 server and connecting to it securely through an SSH tunnel. The VNC server we will be using is TightVNC, a fast and lightweight remote control package. This choice will ensure that our VNC connection will be smooth and stable even on slower internet connections.

How to Install VNC on Ubuntu 16.04

Before installing the VNC server, let us install Xfce desktop.
$ sudo apt-get update
$ sudo apt-get install xfce4 xfce4-*
Install the VNC server using the following command.
$ sudo apt-get install vnc4server
VNC server listens on port 5900, but if you plan to setup port-offset in VNC; we can run a VNC service on a sub-port of the default port 5900. For example, if we configure VNC for port 5, the desktop will be accessible on port 5905. To connect, you can use the standard format ipaddress:sub-port (192.168.2.109:5 or 192.168.2.109:5905)
$ sudo nano /etc/systemd/system/[email protected]:5.service
Replace <raj> with your real user.
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=raj
PAMName=login
PIDFile=/home/raj/.vnc/%H%i.pid
#ExecStartPre=/usr/bin/vncserver -kill %i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1024x768 %i
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target
Reload the systemctl daemon as root
$ sudo systemctl daemon-reload
Start VNC server as user “raj”
[email protected]:~$ vncserver
Set the password
You will require a password to access your desktops.

Password:
Verify:
xauth: file /home/raj/.Xauthority does not exist

New 'server.itzgeek.local:1 (raj)' desktop is server.itzgeek.local:1

Creating default startup script /home/raj/.vnc/xstartup
Starting applications specified in /home/raj/.vnc/xstartup
Log file is /home/raj/.vnc/server.itzgeek.local:1.log
Now, Edit the xstartup file to start Xfce desktop in VNC.
[email protected]:~$ nano /home/raj/.vnc/xstartup
Delete all the existing entries and place the below lines into the file.
#!/bin/sh
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
startxfce4 &
Start the VNC service as root.
$ sudo systemctl start [email protected]:5.service
Enable it on system startup as root.
$ sudo systemctl enable [email protected]:5.service
Congratulation’s! You have successfully installed VNC. Save
Leave A Comment
We are with you

24 X 7 X 365

+1 (217) 636-4164

©2017 1Gbits. All rights reserved