Hey guys, in this article we’ll see how we can set up a Tiger VNC server on a Fedora 27 PC. To start off, TigerVNC is a free and open source high performance and platform-neutral virtual networking utility tool that allows users to interact with the Desktop environment and graphical applications on remote machines / remote boxes. In a VNC setup, we have the VNC server which is set up on the target machine to be accessed and the VNC client application which is used to access the desktop environment of the target machine. Let’s see how we can install TigerVNC on Fedora 27.
Installation of Desktop environments on Fedora 27 Minimal
The first step is to install desktop environments on our minimal installation. We are going to install GNOME, MATE and XFCE
Installing GNOME Desktop
To install GNOME desktop, run the command below in your terminal.
dnf group install -y gnome-desktop base-x
Installing Xfce Desktop environment
To install the latest Xfce Desktop environment, run the command below in your terminal
dnf install -y “Xfce Desktop”
Installing MATE Desktop environment
To install the latest MATE Desktop environment, run the command below in your terminal
dnf install -y “MATE Desktop”
Installing TigerVNC server
After completion of installation of Desktop environments, we're going to install TigerVNC server. Run the command below.
dnf install tigervnc-server

Creating a VNC User
After successful installation of TigerVNC server, create a VNC user.
To create a user, run the command below
useradd vncuser
Setting Password for the VNC user
After creating the user, we need to set up a strong password. Run the command below and follow the prompt. Type the desired password and confirm.
passwd vncuser
Changing password for user vncuser.
New password:
Retype new password:
passwd: all authentication tokens updated successfully
Configuration of VNC server
A file called /etc/systemd/system/vncserver@:1.service is needed.
Copy /lib/systemd/system/vncserver@.service as shown below
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
Edit /etc/systemd/system/vncserver@.service, substituting the <USER> flag with the
username of the vncuser. The remaining lines should be left unmodified.

To effect the changes type the command below to notify systemd of the changes made.
systemctl daemon-reload
Setting up a VNC password
Next, we need to set up a VNC password for the vnc user. This is the password we'll require to login remotely to our desktop environment. To create a vnc password, log in as the vnc user we created.
su - vncuser
configure the vncpasswd
vncpasswd
Password:
Verify:
Follow the prompt. Type the password and confirm.

Configuring the Desktop environment
We are going to run the server to ensure that all configuration files are generated. To do this, we need to login to user vncuser and start the vnc service using systemd.
systemctl start vncserver@:1
After the configuration files have been generated, we need to stop the service and make changes to the xstartup file. To stop the vnc service using systemd, run the command below
systemctl stop vncserver@:1
Configuration of xstartup file
We'll configure the xstartup file in accordance with the desktop environment we installed.
vi ~/.vnc/xstartup
Append the following config files according to the desktop environments installed.
GNOME
!/bin/sh
#
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# exec /etc/X11/xinit/xinitrc
#
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
MATE
#!/bin/sh
#
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# exec /etc/X11/xinit/xinitrc
#
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
mate-session &
XFCE
#!/bin/sh
#
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# exec /etc/X11/xinit/xinitrc
#
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
xfce4-session &
Starting VNC Server
After appending the necessary configuration files, we'll start the VNC server using systemd.
systemctl start vncserver@:1
Enable the service so that it starts on boot up
systemctl enable vncserver@:1
To allow inbound connections, you'll be required to add the tiger-vnc server service to the firewall. Let's see how we can do this.
Adding the tiger-vnc service to the firewall
Type the command below
firewall-cmd --add-service=vnc-server –-permanent
Alternatively, you can choose to add the port associated with tiger-vnc server
firewall-cmd --add-port=5901/tcp --zone=public --permanent
Reload the firewall settings for the changes to take effect
firewall-cmd --reload
Check whether vnc server is running
netstat -pnltu | grep “5901”

Tunneling VNC server connection to SSH
VNC connections are considered unsafe connection as they are not encrypted. In the final step, we'll tunnel the VNC connection to SSH to encrypt and secure the vnc traffic. To perform the tunnel, we'll need the login user, port and password of the user. Run the command below:
ssh -L 5901:127.0.0.1:5901 -N -f -l vncuser 10.200.21.77
The password will be asked to perform the tunnel. Please note that its the password for the SSH login or the user login not of the VNC password. And the port that needs to be tunneled is 5901 as shown above. The above command is to be entered in the VNC client's machine.
Connecting to the vnc server
Download and install vnc viewer in your PC. Launch it and type the server's ip address followed by port number as shown below

Click 'Connect' to Access your Server.
Read Also
How to Install and Configure TigerVNC on Arch Linux
How to Configure TigerVNC Server on Fedora 22
Wrapping up
VNC server comes in handy when you have a VPS or a server in a remote location running Fedora 27 as operating system and need to access the desktop environment. In this way, we save a lot of time in installing virtual machines in our physical machine. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents.
x-terminal-emulator doesn't exist in fedora-27 ; dnf search x-terminal-emulator doesn't return a match .