How to install VNC

How to install VNC :

VNC is used to display an X windows session running on another computer. This tutorial deals with setting up a machine for remote access. That is, other machines are able to access this machine through VNC. First, install a VNC server using the following command:

# yum install vnc-server

To install VNC client,

# yum install vnc

Open ports 5900 and 5901 on the firewall. Make sure to install a window manager in order to get a normal GUI desktop. You can use the command yum groupinstall “GNOME Desktop Environment” to install the Gnome Desktop.

Creare vnc users:

# adduser testuser1

# passwd testuser1

# adduser testuser2

# passwd testuser2

Login to each user, and run vncpasswd. This will create a .vnc directory

Edit the server configuration:

Edit /etc/sysconfig/vncservers, and add the following to the end of the file.

VNCSERVERS=”1:testuser1 2:testuser2″

VNCSERVERARGS[1]=”-geometry 640×480″

VNCSERVERARGS[2]=”-geometry 640×480″

Create xstartup scripts:

We will create the xstartup scripts by starting and stopping the vncserver as root.

# /sbin/service vncserver start

# /sbin/service vncserver stop

Login to each user and edit the xstartup script.

# cd .vnc

# ls

mymachine.localnet:1.log  passwd  xstartup

Edit xstartup. The original should look like:

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

twm &

Add the line indicated below to assure that an xterm is always present, and uncomment the two lines as directed if you wish to run the user’s normal desktop window manager in the VNC.

#!/bin/sh

# Add the following line to ensure you always have an xterm available.

( while true ; do xterm ; done ) &

# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER

exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

twm &

Now you are ready to start VNC server as root.

# service vncserver start

To make sure VNC starts up whenever the computer starts, do the following

# chkconfig vncserver on

It should give you an OK for all VNC sessions you added in /etc/sysconf/vncservers. You will connect using your VNC client using the following address:

you could use an IP address

192.168.xxx.xxx :1

Where :1 is the number chosen for the user in /etc/sysconf/vncservers. When asked, enter password for that user.

Was this answer helpful?

 Print this Article

Also Read

How to change the root password

How to change the root password Change root password: There are two kind of things we need to...

How to change mysql root password

MySQL Change root Password: Setting up mysql password is one of the essential tasks. By default...

How to install zend Optimizer

  How to install zend Optimizer How to install zend Optimizer by admin on Aug.17, 2010, under...

How to install nginx

  How to install nginx Installing nginx on centOS by admin on Aug.16, 2010, under How to...

How to install Lighttpd

nstalling Lighttpd : Lighttpd is available via the RPMForge repositories RPMForege i386 install...