How to install and configure VNC in Fedora 12

Open up your terminal and install tigervnc via yum.
Type this command in your terminal:

yum -y install tigervnc tigervnc-server

Edit the VNC configuration file

vi /etc/sysconfig/vncservers

and append these lines:

VNCSERVERS="1:user"
VNCSERVERARGS[1]="-geometry 800x600 -depth 16"

Where VNCSERVERS= is for configuring the username.
The "1:user" tells the vnc server that the username user is map to display 1, so the port number to access this user via vnc is 5901.

Note: "By default, VNC uses ports numbered 5900 plus the display number. In
this example, the display is 1, so the port number is 5901.

Please make sure the username to match your linux login name.

The VNCSERVERARGS[1]= refers to the argument for "1:user". The -geometry sets the size of the VNC desktop while -depth sets the pixel depth.

If you want to allow more than one users to access VNC, your config should be like this:

VNCSERVERS="1:user 2:user2"
VNCSERVERARGS[1]="-geometry 800x600 -depth 16"
VNCSERVERARGS[2]="-geometry 800x600 -depth 16"

but we will stick to our example which is using one user only.

Create password for your VNC user by typing this command:

su user -c vncpasswd user

Then edit the vnc startup scrtipt in .vnc folder inside your users home directory.

vi .vnc/xstartup

This line should be commented because it will break your desktop, trust me.

#twm &

And append this line instead:

metacity &

Now start your vnc server and configure it to run automatically at system boot.

service vncserver start
chkconfig vncserver on

Last but not the least, allow the vnc packet through your firewall.

iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
service iptables save

To access your server from your other Fedora system using vnc, use this command:

vncviewer ip_address:5901