Install and Configure VNC Server in CentOS 7 and RHEL 7
VNC (Virtual Network Computing) Server allows the remote Desktop sharing using remote VNC clients like VNC viewer. In CentOS 7 & RHEL 7 package named “tigervnc-server” needs to be installed in order to setup the VNC server.
In this article we will go through the installation and configuration of VNC Server on CentOS 7 / RHEL 7.
Step:1 Make Sure the Desktop Packages are installed
In order to setup VNC server first we make sure that Desktop is installed ,in My case i am using Gnome Desktop. If Gnome Desktop is not installed on your Linux machine then use the below command to install.
[[email protected] ~]# yum groupinstall "GNOME Desktop"
Step:2 Install Tigervnc and other dependency Package.
[[email protected] ~]# yum install tigervnc-server xorg-x11-fonts-Type1
Step:3 Setup VNC Server Configuration File.
While Copying the VNC config file we can mention the port number on which we want VNC service to be listen. In my case i am using port 3 , it means VNC will listen on “5903”. So while Connecting to the VNC server We can specify port number as <IP_Address_VNC_Server:3> or <IP_Address_VNC_Server:5903>
[[email protected] ~]# cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:3.service
Step:4 Update the User’s Information in the Config File
Replace the “linuxtechi” user as per your requirement. In my case linuxtechi user will able to control and manage its desktop session using remote VNC clients.
Set the Firewall Rule if firewall is enabled on your linux box.
[[email protected] ~]# firewall-cmd --permanent --zone=public --add-port=5903/tcp success [[email protected]linuxtechi ~]# firewall-cmd --reload success [[email protected] ~]#
Step:5 Set the VNC password for the User.
Switch to the user (linuxtechi) and run vncserver command to set the password as shown below :
Start and Enable the VNC Service at boot.
Execute below commands as root only.
[[email protected] ~]# systemctl daemon-reload [[email protected] ~]# systemctl start [email protected]:3.service [[email protected] ~]# systemctl enable [email protected]:3.service ln -s '/etc/systemd/system/[email protected]:3.service' '/etc/systemd/system/multi-user.target.wants/[email protected]:3.service' [[email protected] ~]#
Step:6 Access Remote Desktop Session.
From Ubuntu Machine :
[email protected]:~$ vncviewer 192.168.1.15:3
Enter the VNC password that we have set in above step, after validating the authentication Remote Desktop session will start.
From Windows Machine Using VNC Viewer
Enter the VNC Server IP Address and Port Number and then Click on OK
Enter the VNC Password & then click on OK.
Desktop Session Will start after authentication.