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
useradd jack
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:
vi /etc/systemd/system/vncserver@:1.service
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
firewall-cmd --reload
7. Switch to the VNC user and start the vnc server as below:
# su - jack
# vncserver
You will get a result as below:
[jack@server1 ~]$ vncserver
You will require a password to access your desktops.
Password:<--yourvncpassword
Verify:<--yourvncpassword
Provide a password for VNC.
8. Now make the service enabled on after every reboot with root credentials:
su -
systemctl daemon-reload
systemctl enable vncserver@:1.service
reboot
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.
eg: 192.168.1.17:5901
Provide the VNC username and password to access the same.