Configuring VNC Server for GUI remote access
VNC or Virtual Network Computing is graphical desktop sharing tool. VNC server provides a duplicate of server display for the clients attached to it. A number of clients can be connected to using VNC.
In RHEL/CentOS 7, we use a package named “tigervnc-server” to setup VNC server. We will now start with installation but before we do that make sure that we have graphical version of OS installed. If that’s not the case, we will first install the graphical desktop,
If you already have graphical packages installed, skip this step & move onto installation of VNC-server.
We can install vnc server using the yum,
Once the required packages have been installed, we will move to configuration part,
Configuration file for VNC is /lib/systemd/system/[email protected]. We need to copy /lib/systemd/system/[email protected] to /etc/systemd/system/[email protected]:1.service, where :1 is used to denote port number 5901 . We can also assign it different port number like :2 or :3 (for 5902, 5903).
Next, we will add user information in the configuration file. So we will add a user named ‘vncuser’ for accessing vnc
Now open /etc/systemd/system/[email protected]:1.service, & add user information (see screenshot)
Next, we will assign a password to access the VNC server,
You will be asked to enter a password & then confirm it & some files will be created after that.
Our VNC server is now ready to be used, we will restart service & enable it , so it can restart on every reboot,
Note:- If you are getting an error while starting vnc service, reboot your system & try starting service then.
Testing the server
To test the vnc server, we require VNC-viewer to installed on the testing machine. I am using a Windows 10 machine with vnc-viewer installed.
Open vnc –viewer & enter the server address with port number
Next, you will get a warning if you are using an unencrypted connection, press “continue”
You will now be asked VNC password, enter the password to connect the session & you can see the display of the server.
If you want to add more user, repeat the whole process but change the port number from /etc/systemd/system/[email protected]:1.service to /etc/systemd/system/[email protected]:2.service or /etc/systemd/system/[email protected]:3.service & so on.
This concludes our tutorial on setting up VNC server on CentOS/RHEL 7. We will be back with more tutorials. Leave your comments/suggestions down below in the comment box.