Thursday, March 03, 2011

Configuring vnc on CentOS

It was a pain, as most of the latest linux distros come with out-of-box vnc support,
but I finally found a good reference on CentOS site:


To make your centOS server vnc ready, you just need to :
  1. Create your VNC users.
  2. Set your users' VNC passwords.
  3. Edit the server configuration.
  4. Customize xstartup scripts.
$ su -
$ useradd vncuser

$ cd .vnc
$ vncpasswd

$ vi /etc/sysconfig/vncservers
VNCSERVERS="1:vncuser" VNCSERVERARGS[1]="-geometry 800x600"
$/sbin/service vncserver start
$/sbin/service vncserver stop

$ cd .vnc
$ vi 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 80x24+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. Note that in the likely reduced resolution and color depth of a VNC window the full desktop will be rather cramped and a look bit odd. If you do not uncomment the two lines you will get a gray speckled background to the VNC window.

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

Start the vncserver as root.
$ /sbin/service vncserver start

and that's it ! Use vncviewer to connect ot it
$ vncviewer host_ip:1

4 comments:

Anonymous said...

I’m not that much of a internet reader to be honest
but your sites really nice, keep it up! I'll go ahead and bookmark your website to come back later on. All the best

Also visit my site ... s2000 spoiler

Anonymous said...

Link exchange is nothing else except it is just placing
the other person's webpage link on your page at appropriate place and other person will also do similar in favor of you.

Here is my webpage :: stability balls

Anonymous said...

When I initially left a comment I appear to have clicked on the -Notify
me when new comments are added- checkbox and from now on whenever a comment is added I recieve four emails with the exact same comment.
Is there a way you are able to remove me from that service?

Appreciate it!

Also visit my webpage: hand pole saw prunner

Anonymous said...

Hi! This is kind of off topic but I need some help from an established blog.
Is it very hard to set up your own blog? I'm not very techincal but I can figure things out pretty quick. I'm thinking about making my own
but I'm not sure where to begin. Do you have any points or suggestions? Thank you

Feel free to visit my blog ... catholic

My Blog List