VNC configuration on RHEL 7
1st install prerequisite package on server.
- tigervnc
- tigervnc-server
[root@feenixdv77 system]# yum install tigervnc tigervnc-server –y
Create user for remote access.
[root@feenixdv77 ~]# adduser vncuser
[root@feenixdv77 ~]# passwd vncuser
Changing password for user vncuser.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
Create service daemon for display 1 becaue in rhel 7 you can’t export display 0.
[root@feenixdv77 ~]# cd /usr/lib/systemd/system
[root@feenixdv77 system]# ll vnc*
-rw-r–r– 1 root root 1744 Jun 10 2014 vncserver@.service
[root@feenixdv77 system]# cp vncserver@.service vncserver@\:1.service
Modify display file and replace <USER> tab with username “vncuser”
[root@feenixdv77 system]# vi vncserver@\:1.service
Before modification:-
After modification:-
Reload service daemon which is created for display 1.
[root@feenixdv77 system]# systemctl daemon-reload
Set vnc password for “vncuser”. Must be 1st switch in “vncuser” after change password.
[root@feenixdv77 system]# su – vncuser
ABRT has detected 1 problem(s). For more info run: abrt-cli list
[vncuser@feenixdv77 ~]$ vncpasswd
Password:
Verify:
Now start service and check status.
[root@feenixdv77 system]# systemctl start vncserver@\:1.service
[root@feenixdv77 system]# systemctl status vncserver@\:1.service
vncserver@:1.service – Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver@:1.service; disabled)
Active: active (running) since Thu 2016-12-15 20:06:13 EST; 7s ago
Process: 30982 ExecStart=/sbin/runuser -l vncuser -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Allow connection on firewall.
[root@feenixdv77 system]# firewall-cmd –permanent –add-service=vnc-server
success
[root@feenixdv77 system]# firewall-cmd –reload
Success
Now use “vnc viewer” for connect remote server.