How to configure VNC on CentOS/RedHat/Fedora
- May 31st, 2008
- Posted in Documentation
- Write comment
Configure VNC to run at startup
vi /etc/sysconfig/vncservers
…
VNCSERVERS=”1:username”
VNCSERVERARGS[1]=”-geometry 1024×768″
…
Use ntsysv to configure vncserver to run at startup.
Configure vnc session to use GNOME
su – username # if necessary
cd .vnc
cp -p xstartup xstartup.orig
vi xstartup
###Begin file###
#!/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” &
startx &
###End file###
Note: Make sure there is not blank line after the startx line.
service vncserver restart
Use your vnc client to connect to hostname:1.
In CentOS6, you install tigervnc-server, instead of vnc-server. Also, you do not need to create the xstartup script. However, you do need to set the password.
Logged in as the user:
$ cd ~/.vnc
$ vncpasswd
…
$ ls
passwd