Linux:How to install vncserver

Ref: http://wiki.centos.org/HowTos/VNC-Server

(a)Install vnc-server packages

yum install vnc-server

(b)Create your VNC users

useradd user1

(c)Set your users’ VNC passwords:
Login to each user, and run vncpasswd. This will create a .vnc directory.

vncpasswd

(d)Edit the server configuration
Edit /etc/sysconfig/vncservers, and add the following to the end of the file.

VNCSERVERS="2:root 3:user1"
VNCSERVERARGS[2]="-geometry 640x480"
VNCSERVERARGS[3]="-geometry 640x480"

(e)Create xstartup scripts/ Starting the server

 /sbin/service vncserver start

(g) Edit xstartup
Login each user’s home directory and Edit xstartup file

cd /root/.vnc
 vi xstartup
Uncomment bellow 2 lines 
 unset SESSION_MANAGER
 exec /etc/X11/xinit/xinitrc

xstartup file should be like this

#!/bin/sh
( 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 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

(g) Restart vnserver again

service restart vncserver

Leave a Reply

*