Enable VNC server on RHEL 7 or OEL 7

Spread the love
  • 4
    Shares


 

Please install the following package.

 

# yum install tigervnc-server

 

Then copy the service file to systemd location.

# cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:2.service


 

The browse to the directory vi /etc/systemd/system/vncsever@:2.service

Make the following changes

 

[Service]

Type=forking

# Clean any existing files in /tmp/.X11-unix environment

ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’

ExecStart=/usr/sbin/runuser -l root -c “/usr/bin/vncserver %i”

PIDFile=/root/.vnc/%H%i.pid

ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’

 

Change the VNC password

vncpasswd

Password- 12345

Retype password- 12345

 

 

Then run the following commands

systemctl daemon-reload

systemctl start vncserver@:2.service

 

Disable firewall

systemctl disable firewalld.service

systemctl stop firewalld.service

 

Connect on VNC viewer with the following credentials.

Ip address:3

 

 

 

 

 

Leave a Reply

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