Introduction
Most of the time as a system administrator you are managing your servers over the network.
It is very rare that you will need to have a physical access to any of your managed servers.
In most cases all you need is to SSH remotely to do your administration tasks.
In this article we will configure a GUI alternative to a remote access to your RHEL server,
which is VNC. VNC allows you to open a remote GUI session to your server and thus providing you with a full graphical interface accessible from any remote location.
Installation of VNC server
In order to enable an access to our Redhat Linux system using VNC we first need to install it. Make sure that you have your repository enabled and execute the command:
# yum install tigervnc-server
The above command will install the VNC server on your system.
Configuring VNC Server Access on a Redhat Linux5.8
I will show how to configure VNC server on Red Hat server and using VNC Viewer connect the server remotely from Windows XP.
Prerequisite:-
Disable Selinux.
[root@sujeet ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
How to Disable the Firewall for Oracle Linux or Red Hat Enterprise Linux
To disable the firewall, run the following commands.
# service iptables stop
# chkconfig iptables off
1. Introduction
VNC allows you to open a remote GUI session to your
server and thus providing you with a full graphical
interface accessible from any remote location.
VNC allows you to open a remote GUI session to your
server and thus providing you with a full graphical interface accessible from any remote location.
2. Configure steps:-
Edit /etc/sysconfig/vncservers, and add the following to the end of the file.Hear my port=4
VNC User=root
save it.
[root@sujeet]# vi /etc/sysconfig/vncservers
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
VNCSERVERS="4:root"
VNCSERVERARGS[4]="-geometry 1600x1200"
or
If you want multiple VNC session than you can use below lines add /etc/sysconfig/vncservers file.
VNCSERVERARGS[1]="-geometry 640x480"
VNCSERVERARGS[2]="-geometry 640x480"
VNCSERVERARGS[3]="-geometry 800x600"
3. Reset VNC User password.
Use below command-
[root@sujeet]# vncpasswd
Password: XXXXX
Verify: XXXXX
This password you can use connection time.
4. firewall setting
If you have firewall enable on Red Hat, be sure that your firewall
configuration won’t block connection from remote computer by open port
TCP 5901 for remote access. Open Applications -> System Settings
-> Security Level. Add ’5901:tcp’ on Other ports.
Note: VNC uses TCP protocol on port 5901.
5. start the vncserver.
[root@sujeet]#
service vncserver start
[root@sujeet]#
service vncserver stop
[root@sujeet]#
service vncserver status
service vncserver restart
Now you can connect Red Hat server from remote computer. On my
Windows XP computer, open VNC Viewer on Windows XP, type IP Address of
Red Hat server with number as a username specify. In this
example, I want to remote to Red Hat server as ‘root’ user which I
assign as number 2 in step 2 and my Red Hat server is
10.110.141.220. So I type ’10.110.141.220:1′.
- Note: You can download VNC Viewer for free at Download VNC® Viewer
- Type your password for ‘root’ user which has been assign in step 3.
Now you have connect to Red Hat server remotely. But you’ll see that the
interface looks different. You have to do a little thing more.
6. If You want to execs Server Desktop Than do next steps.
On Red Hat server, open terminal and type ‘vi /home/username/.vnc/xstartup’.
In this example,
I type ‘vi /home/admin/.vnc/xstartup’.
Note: If you going to enable remote access for user ‘root’, the file would be at ‘/root/.vnc/xstartup’.
[root@sujeet ~]# vi /root/.vnc/xstartup
UN-commit below 2 lines after that save it.
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
7. Restart VNCSERVER
[root@sujeet ~]# service vncserver restart
Shutting down VNC server: 4:root [ OK ]
Starting VNC server: 4:root
New 'sonu.oracle.com:4 (root)' desktop is sujeet.oracle.com:4
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/chintels.chintels.com:4.log [ OK ]
8. Now you can connect Red Hat server from remote computer. On my
Windows XP computer, open VNC Viewer on Windows XP, type IP Address of
Red Hat server with number as a username specify. In this
example, I want to remote to Red Hat server as ‘root’ user which I
assign as number 2 in step 2 and my Red Hat server is
10.110.141.220. So I type ’10.110.141.220:1′.
- Note: You can download VNC Viewer for free at Download VNC® Viewer
- Type your password for ‘root’ user which has been assign in step 3.
Find vnc processes id.
[root@sujeet]# ps -ef | grep vnc | grep root