Wednesday, June 13, 2018

RHEL7 - A Quick Way to Use Vncserver Redhat 7

1. Make sure you have working yum repo

# vi /etc/yum.repos.d/local.repo
name = Redhat EP 7 Local repo
baseurl =


# yum clean all
# yum repolist
# yum list
# ps -ef | grep vnc
# rpm -qa | grep vnc

2. Check if you have vnc software package

# yum list | grep -i vnc
# yum install tigervnc-server.x86_64
# which vncserver

3. Login as a user and run vncserver command. It will create x-server session.
# su - samrat
[samrat@rsmd-lx-v02 ~]$ vncserver

Warning: is taken because of /tmp/.X1-lock
Remove this file if there is no X server

New ' (samrat)' desktop is

Starting applications specified in /home/samrat/.vnc/xstartup
Log file is /home/samrat/.vnc/

[samrat@rsmd-lx-v02 ~]$

4. Now, download VNC-Viewer. I use real-vnc viewer.
you can use tight-vnc or any other of your choice.

When you open the application, you specify the remote host info : supply ipaddress of server
port specify the session info such as hostname:1 or :2

Review the output of command vncserver.

remote host can be like host_ip:post or

5. If you can't connect, make sure port is added to firewall

[root@rsmd-lx-v02 html]# telnet 5902
telnet: connect to address Connection refused

# ps -ef | grep vnc
# firewall-cmd --permanent --zone=public --add-port=5902/tcp
# systemctl status firewalld
# firewall-cmd --reload

6. Verify you can connect now,

[root@rsmd-lx-v02 html]# telnet 5902
Connected to
Escape character is '^]'.
RFB 003.008
telnet> q
Connection closed.
[root@rsmd-lx-v02 html]#

7. Now, try connecting, you should be able to login to the server.
If not review all the steps before.

8. Once your work is done, kill the vnc session
$ vncserver -kill :2

[samrat@rsmd-lx-v02 ~]$

No comments:

Post a Comment