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
[REMOTE-sREPO]
name = Redhat EP 7 Local repo
baseurl = http://192.168.20.241/RHEL7-Patch_06112018
enabled=1
gpgcheck=0

wq!

# 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: rsmd-lx-v02.sces.mil:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server rsmd-lx-v02.sces.mil:1


New 'rsmd-lx-v02.sces.mil:2 (samrat)' desktop is rsmd-lx-v02.sces.mil:2

Starting applications specified in /home/samrat/.vnc/xstartup
Log file is /home/samrat/.vnc/rsmd-lx-v02.sces.mil:2.log

[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 192.168.10.20:2


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

[root@rsmd-lx-v02 html]# telnet 192.168.20.239 5902
Trying 192.168.20.239...
telnet: connect to address 192.168.20.239: 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 192.168.20.239 5902
Trying 192.168.20.239...
Connected to 192.168.20.239.
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