Saturday, May 27, 2017

How to configure and start vncserver on Linux 7


The procedure to enable vncserver and startup automatically upon server reboot has been changed in Red Hat compatible linux operating systems such as Red Hat Linux 7.x, Oracle Enterprise Linux 7.x and CentOS etc. If your operating system has version 6.x, then please follow this article instead.


1) Login as root operating system user.
2) rm -rf  /tmp/.X11-unix/
3) cd  /lib/systemd/system
4) Make a copy of vncserver@.service
5) Edit vncserver@.service and replace <USER>  with the actual operating system user name that owns the vnc service. Leave the remaining lines of the file unmodified.
6) systemctl  daemon-reload
7) systemctl  enable  vncserver@:1.service
8) systemctl  start  vncserver@:1.service
9) Edit /etc/rc.d/rc.local and add the line service iptables restart
10) chmod  +x  /etc/rc.d/rc.local
11) Optionally, sudo su - <USER>  and then execute the vncpasswd command to change the vncserver password.
12) Reboot the server.

If the vncserver program is still not getting started automatically, then add the below lines directly in the /etc/rc.d/rc.local file.

rm -rf  /tmp/.X11-unix/
systemctl  daemon-reload
systemctl  enable  vncserver@:1.service
systemctl  start  vncserver@:1.service
service iptables restart


1) Launch TigerVNC Viewer
2) IP address:5901 

It should prompt for Password and then it should connect successfully

No comments:

Related Posts Plugin for WordPress, Blogger...