VNC Server Configuration in Red hat Linux

VNC Server Configuration in Red hat Linux

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 graphical.target 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

Or

[root@vncserver ~]# yum groupinstall “Server with GUI”

3- Set the system to boot directly into the GUI then switch to graphical.target:

[root@vncserver ~]# systemctl set-default graphical.target

[root@vncserver ~]# systemctl isolate graphical.target

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

Note: 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

Note: 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/multi-user.target.wants/vncserver@:1.service → /etc/systemd/system/vncserver@:1.service.

[root@vncserver ~]# systemctl start vncserver@:1.service

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *