Install vnc server on CentOS 5

NOTE: CentOS 5 reached its End of Life on March 31, 2017. For installing VNC desktop on CentOS 7, see Install Xfce VNC remote desktop on CentOS 7

Install GUI on Sever

To find available desktop environments

yum grouplist

To install gnome

yum groupinstall "GNOME Desktop Environment"

For KDE

yum groupinstall "KDE (K Desktop Environment)"

For XFCE, install

yum groupinstall "XFCE"

XFCE file size in fedora 12 Total download size: 105 M, Installed size: 363 M

Install VNC Server

yum install vnc vnc-server

Start VNC Server

[root@pc7 ~]# vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  creating new authority file /root/.Xauthority

New 'pc7.localdomain:1 (root)' desktop is pc7.localdomain:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/pc7.localdomain:1.log

[root@pc7 ~]#

Now stop vnc server with

pkill -9 vnc
rm -rf /tmp/.X*

Set Password for VNC Server

vncpasswd /root/.vnc/passwd
[root@pc7 ~]# vncpasswd /root/.vnc/passwd
Password:
Verify:
[root@pc7 ~]#

Edit xstartup

vi  /root/.vnc/xstartup

Find

twm &

Replace it with

For Gnome

gnome-session &

For XFCE

startxfce4 &

For KDE

startkde &

For FVWM2

fvwm2 &

After change, it will look like

[root@pc7 ~]# cat /root/.vnc/xstartup
#!/bin/sh

vncconfig -iconic &
# 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
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
[root@pc7 ~]#

Create VNC Users

vi /etc/sysconfig/vncservers

Add

VNCSERVERS="1:flashwebhost"

Start VNC Server

[root@pc7 ~]# vncserver

New 'pc7.localdomain:1 (root)' desktop is pc7.localdomain:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/pc7.localdomain:1.log

[root@pc7 ~]#

Connecting

Start tightVNC Viewer, connect to IP-ADDR:1 to connect as user root.

See VNC server

Comments

Leave a Reply

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