IBM Support

How to configure VNC server in Red Hat Enterprise Linux 8

How To


From the /usr/share/doc/tigervnc/ file: The previous tigervnc versions had a wrapper script called `vncserver` which could be run as a user manually to start *Xvnc* process.

Tigervnc server is now using *systemd* and the setup has completely changed. There is a new way how this all is supposed to work.


To provide detailed steps on how to install, configure and run tigervnc server on RHEL 8 systems using the new *systemd* implementation.


OS version Red Hat Enterprise Linux release 8.3 (Ootpa)


1- To install the required packages, run the following command as root:
[root@vncserver ~]# yum -y install tigervnc-server tigervnc
2- You will need the X Windows System installed and the system is started in for tigervnc to work.
If a graphical desktop environment is not already installed, the following package groups need to be installed to boot a RHEL system into a graphical desktop environment:
[root@vncserver ~]# yum -y group install GNOME base-x
[root@vncserver ~]# yum groupinstall "Server with GUI"
3- Set the system to boot directly into the GUI then switch to
[root@vncserver ~]# systemctl set-default
        Removed /etc/systemd/system/
        Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/
[root@vncserver ~]# systemctl isolate
4- Create a VNC user account (if it doesn't already exist) for specific user(s) that will need to access the system via VNC:
[root@vncserver ~]# useradd vncuser1
[root@vncserver ~]# passwd vncuser1
5- After that login as the user and create a vncpassword:
[root@vncserver ~]# su - vncuser1
[vncuser1@vncserver ~]$ vncpasswd
6- Configure Xvnc options, the user has its own configuration in $HOME/.vnc/config:
[vncuser1@vncserver ~]$ echo 'session=gnome' > ~/.vnc/config
  • The only required parameter here is session=. It should match the name of a session desktop file from /usr/share/xsessions directory. The default option here for supported deployments will be session=gnome.
7- Add a user mapping in /etc/tigervnc/vncserver.users:
[root@vncserver ~]# echo ':1=vncuser1' >> /etc/tigervnc/vncserver.users
  • Each user defined in this file will have a corresponding port on which its session will run. The number in the file corresponds to a TCP port. By default, :1 is TCP port 5901 (5900+1). If another parallel VNC connection is needed, a second instance can run on the next highest, free port, i.e 5902 (5900+2).
  • Red Hat Enterprise Linux only supports one unique user per GUI session per unique system. Therefore, use one vnc session per user. Do not configure multiple vnc sessions for single user.
8- Create systemd unit for VNC server@:1
[root@vncserver ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
9- Configure firewall to accept incoming connections for VNC.
[root@vncserver ~]# firewall-cmd --permanent --zone=public --add-port 5901/tcp
[root@vncserver ~]# firewall-cmd  --reload
10- Enable the vnc service:
[root@vncserver ~]# systemctl enable vncserver@:1.service
Created symlink /etc/systemd/system/ → /etc/systemd/system/vncserver@:1.service.
[root@vncserver ~]# systemctl start vncserver@:1.service
11- Verify the vncserver status:
[root@vncserver ~]# systemctl status vncserver@\:1.service
    ● vncserver@:1.service - Remote desktop service (VNC)
       Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
       Active: active (running) since Sat 2021-02-20 06:04:03 PST; 1min ago
      Process: 920 ExecStart=/usr/libexec/vncsession-start :1 (code=exited, status=0/SUCCESS)
     Main PID: 938 (vncsession)
        Tasks: 1 (limit: 11392)
       Memory: 2.3M
       CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
               ‣ 938 /usr/sbin/vncsession vncuser1 :1
    Feb 20 06:04:00 systemd[1]: Starting Remote desktop service (VNC)...
    Feb 20 06:04:03 systemd[1]: Started Remote desktop service (VNC).

[root@vncserver ~]# ss -atp | grep 5901
    LISTEN   0         5            *        users:(("Xvnc",pid=1308,fd=6))                                                 
    LISTEN   0         5                     [::]:5901                 [::]:*        users:(("Xvnc",pid=1308,fd=7))

Additional Information

Please read /usr/share/doc/tigervnc/ for more information.

Document Location


[{"Line of Business":{"code":"LOB26","label":"Storage"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SGMV157","label":"IBM Support for Red Hat Enterprise Linux Server"},"ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

Modified date:
22 February 2021