Monday, September 17, 2012

Installation of VNC Server on CentOS 5.x

 I honestly thought I documented this already, but I searched the blog and was unable to locate it.

This covers installation and quick configuration of VNC on a server, in the event that Desktop access is needed on a remote server. In some cases, the CLI is not enough, and I've found this very useful.

On to the entry:

1. Login as root (or su)

2. Install required packages:
yum  -y install vnc-server

3. Secure the VNC server:
vncpasswd
Set mypassword
cd ~/.vnc
ls

the passwd folder should be listed

4. Configure the server:
nano /etc/sysconfig/vncservers
add to end of file:
VNCSERVERS="3:myusername"
VNCSERVERARGS [3] = "-geometry 1024x768"

5. Start the VNC service and configure service to autostart on boot:
service vncserver start
chkconfig vncserver on


6. Further configuration:
cd ~/.vnc
nano xstartup

add under the line "# Add the foll..."
(while true ; do xterm ; done) &
remove comments(#) from
#unset SESSION_MANAGER
#exec /etc/x11/xinit/xinitrc
7. Restart the vnc service
Service vncserver restart

8. Configure firewall to allow VNC server traffic
system-config-securitylevel-tui
add 5903:tcp to exceptions list

9. Open VNC client from remote peer and connect to VNC Server:
server: 192.168.x.x:3
username myusername
password: mypassword (as set in Step 3)


finito
-noveck

4 comments:

  1. Thank you so much!
    This was the simplest guide I could find for enabling ports in the firewall for VNC traffic.
    -Mahmud

    ReplyDelete
  2. I was wondering if it was possible for me to keep a VNC server running even after my computer was completely powered down. Is their any way to do this, I would love to access my files from anywhere even if I am on a long trip and cannot leave my computer in sleep mode. I am running a TightVNC server on Windows Vista. Thanks noveck.

    ReplyDelete
    Replies
    1. I'm not familiar with TightVNC on MS VIsta, but it sounds like you need the functionality of Wake-on-Lan.
      This post may help point you in the right direction: http://www.tuxradar.com/answers/584

      Delete