2009年3月5日 星期四

Installing VNC on Fedora

Installing VNC on Fedora:

1.Open a Terminal Window, and type the following to install the VNC Server Package, if NOT already installed:

su -c 'yum -y install vnc-server」

Setting the VNC Password:

1.Type the following command to set the password for your user. This must be repeated for each user in which you would like to provide access for:

vncpasswd

2.You will now be prompted for a password, enter your desired password, then press . You will now be prompted to verify the password you just entered. Verify, then press to move one.

3.After you enter the password for your user, it will create the default configuration files and place them in the /home//.vnc directory. It will also start the VNC Server for your user for the first time. We are NOT ready to log in yet, so type the following to terminate the VNC Server for your user.

vncserver -kill : // Desktop Number will most likely be 「1」

vncserver -kill :1


Customizing VNC Start-up (To Start KDE or Gnome Desktop, instead of default Grey 「rootweave」 Desktop):

NOTE: The VNC Server allows the user to configure various settings specific to them through the use 「xstartup」 file located in the 「.vnc」 directory found in the user's home directory.

1.Change directory to $HOME/.vnc/

2.Open the 「xstartup」 file using the VI editor (my preference) or whatever editor you prefer.

3.Jump to the end of the file. Here you will notice a line similar to the following:

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

*** Here you MUST replace the 「twm」 with either 「startkde」 or 「gnome-session」, to start the GUI Desktop that you are use to.

like this

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &


Add more user for VNC connection:

su - user1
vncserver :1 -geometry 1024x768
Password: xxxxx


Desktop Selection

Default desktop being GNOME.

To change desktop used to KDE, create or edit /etc/sysconfig/desktop:

DESKTOP=GNOME
# DESKTOP=KDE



Make sure xstartup access mode is -rwxr-xr-x (755), if not

chmod 755 ~/.vnc/xstartup

Configuring your Firewall to Allow Access:


1.The following command will open port 5901 (:1) only for access. This is typically the 1st VNCDESKTOP number that gets setup.

su -c '/sbin/iptables -I INPUT -p tcp --destination-port 5901 -j ACCEPT'

This command would open the port range 5901 to 5903 (To allow the first 3 VNCDESKTOP's):

su -c '/sbin/iptables -I INPUT -p tcp --destination-port 5900:5903 -j ACCEPT'

*** If you are unsure which port(s) your VNC Servers are listening on, type the following command; (Assumes Defaults were in place)

netstat -lnt | grep 590* //This will check ports 5900-5901

If all goes well, and you have VNC Server's listening, you should see a response similar to the following:


$ netstat -lnt | grep 590*
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN

*** This tells me ports 5901 and 5902 are listening.

2.Next, save the new rules with the following command:

su -c '/sbin/iptables-save > /etc/sysconfig/iptables'

3.Confirm the settings were successful with the following command:

su -c '/sbin/iptables -L'

*** You should see an output line similar to the following:

ACCEPT tcp -- anywhere anywhere tcp dpts:5900:5903


Manually Starting VNC Desktops:

This is a very simple step, once you have configured the desired settings for your user. Type the following:

vncserver

*** You should now get a response, telling you which Desktop Number you just started. Be Careful that you don't start Multiple Desktops by accident. This can be done very easily, if you don't properly kill old desktops before opening new ones.


Automating VNC on Startup:


1.The following command is used to start VNC Server at system boot, for runlevel 5 (Multi-User X);

su -c 'chkconfig --level 5 vncserver on'

*** The default VNC start-up file can be found in the following location, and can be opened/edited with VI or your favorite editor:

/etc/init.d/vncserver

*** However if you are simply wanting to add which VNC Desktops you would like started, edit the following file:

/etc/sysconfig/vncservers

沒有留言: