VNC Server Configuringon Linux 7.1

Install & Configure VNC Server in RHEL 7

VNC (Virtual Network Computing) Server allows the remote Desktop sharing using remote VNC clients like VNC viewer.
In RHEL 7 package named “tigervnc-server” needs to be installed in order to setup the VNC server.

[root@sujeet /]# yum install tigervnc-server

Step:1 
Make Sure the Desktop Packages are installed

In order to setup VNC server first we make sure that Desktop is installed ,in My case i am using Gnome Desktop.
 If Gnome Desktop is not installed on your Linux machine then use the below command to install.

[root@sujeet /]# yum groupinstall GNOME Desktop


Step:2
Install Tigervnc and other dependency Package.

[root@sujeet /]# yum install tigervnc-server xorg-x11-fonts-Type1


Step:3
 Setup VNC Server Configuration File.

Copy the VNC config file “/lib/systemd/system/vncserver@.service” to the “/etc/systemd/system/vncserver@:<Port_Number>.service”.

While Copying the VNC config file we can mention the port number on which we want VNC service to be listen.
In my case i am using port 8 , it means VNC will listen on “5908”.

So while Connecting to the VNC server We can specify port number as <IP_Address_VNC_Server:8> or <IP_Address_VNC_Server:5908>


[root@sujeet /]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:8.service

Step:4 
Update the User’s Information in the Config File

[root@sujeet ~]# vi /etc/systemd/system/vncserver@:8.service

ExecStart=/usr/sbin/runuser -l oracle -c "/usr/bin/vncserver %i"
PIDFile=/home/oracle/.vnc/%H%i.pid

Replace the “oracle” user as per your requirement.
In my case oracle user will able to control and manage its desktop session using remote VNC clients.


Set the Firewall Rule if firewall is enabled on your linux box.

[root@sujeet~]# firewall-cmd --permanent --zone=public --add-port=5908/tcp
success
[root@sujeet ~]# firewall-cmd --reload
success

Step:5 
Set the VNC password for the User.
login with oracle User after that reset VNCSERVER password.

[oracle@sujeet ~]# vncpasswd
Password:******

Start and Enable the VNC Service at boot.

Execute below commands as root only.

[root@sujeet/]# systemctl daemon-reload
[root@sujeet /]# systemctl start vncserver@:8.service
[root@sujeet /]# systemctl enable vncserver@:8.service

[root@sujeet /]# ln -s '/etc/systemd/system/vncserver@:8.service' '/etc/systemd/system/multi-user.target.wants/vncserver@:8.service'
ln: failed to create symbolic link ‘/etc/systemd/system/multi-user.target.wants/vncserver@:3.service’: File exists

[root@sujeet/]# systemctl status vncserver@:8.service

Open VNC port using iptables:
[root@sujeet sysconfig]# iptables -I INPUT -p tcp --dport 5908 -j ACCEPT

[root@sujeet sysconfig]# firewall-cmd --add-rich-rule='rule family="ipv4" service name=vnc-server accept'

FirewallD is not running


Step:6
 Access Remote Desktop Session.


Now let's use netstat to check what ports VNC is listening on.

[root@sujeet ~]# netstat -tulp | grep vnc


Terminating a VNC Session

Similarly to enabling the vncserver service, you can disable the automatic start of the service at system start:
~]# systemctl disable vncserver@:8.service

Or, when your system is running, you can stop the service by issuing the following command as root:

~]# systemctl stop vncserver@:8.service


How to check whether particular port is open or closed on UNIX?
Login with root user.

[opc@b0f67e ~]$ lsof -i -P
and grep the output for the port you are looking for.

For example to check for port 80 do

[opc@b0f67e ~]$ lsof -i -P | grep :80

[opc@b0f67e ~]$ netstat -ano|grep 5908|grep LISTEN
[opc@b0f67e ~]$ lsof -i -P | grep :5908



No comments:

ORA-00059: Maximum Number Of DB_FILES Exceeded in 19C database

When I am adding datafile to my 19C database facing the below error. SQL> alter tablespace DATA  add datafile '/u01/data/data15.dbf...