This guide is for installing and setting up a VNC-Server on the servers installed with Centos 7.
1. Log in to the server as root
2. Run the following commands:
yum update -y
yum groupinstall "GNOME Desktop" -y
yum install tigervnc-server -y
3. Once the above packages are fully installed, we need to add a normal user for using VNC
You need to use your own username here.
4. In CentOS 7 OS there is a change in the vncserver configuration file and its location. In Centos 6 OS, it was /etc/sysconfig/vncservers and now it has been changed to /lib/systemd/system/[email protected]. Next, we need to copy the original file and create a new configuration file as shown below:
cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
5. Edit the file as below:
Remember to replace the username with your own.
If you wish to add more users you can simply create a new user and then add a new vncserver@:#.service file and change the <USER> string to the new users accordingly.
6. Do the following firewall settings:
firewall-cmd --permanent --zone=public --add-service vnc-server
7. Switch to the VNC user and start the vnc server as below:
# su - jack
You will get a result as below:
[jack@server1 ~]$ vncserver
You will require a password to access your desktops.
Provide a password for VNC.
8. Now make the service enabled on after every reboot with root credentials:
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service
Now you are done with the server side setup and you will be able to connect to the server with the default port 5901.
Provide the VNC username and password to access the same.