1. Install the VNC Server.
# yum install tigervnc-server
2. Create a new configuration file for each of the display numbers you want to enable. In the following case, I am setting up the display number ":3". Notice how the display number is included in the configuration file name.
# cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:3.service
3. Edit the new configuration file, amending the user and startup arguments as necessary. An example of the changed lines is shown below. All other lines should be unmodified. The geometry is set below, but this line doesn't have to be modified if the default geometry of "1280x1024" is acceptable.
User=oracle
ExecStart=/usr/bin/vncserver %i -geometry 1440x1080
PIDFile=/home/oracle/.vnc/%H%i.pid
4. Run the following command.
# systemctl daemon-reload
5. Run the following command.
# vncserver :2 -geometry 1280x720
6. Set the VNC password for the user defined in the new configuration file.
# su - oracle
$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
$ exit
logout
7. Enable the service for autostart and start the service.
# systemctl enable vncserver@:3.service
# systemctl start vncserver@:3.service
8. You should now be able to use a VNC viewer to connect to system using the display number and password defined. Use the following commands to stop the service and disable autostart.
# systemctl stop vncserver@:3.service
# systemctl disable vncserver@:3.service