Thursday, November 20, 2008

VNC set up in Fedora

[1] http://fedoranews.org/tchung/vnc/
[2] http://bobpeers.com/linux/vnc
[3] http://forums.fedoraforum.org/showthread.php?t=188625&page=2
[4] http://www.rpmfind.net/linux/rpm2html/search.php?query=selinux-policy&submit=Search+...
[5] http://linux.derkeiler.com/Mailing-Lists/Fedora/2008-07/msg01106.html
[6] http://rpm.pbone.net/index.php3/stat/26/dist/64/size/615728/name/vnc-4.1.3-1.fc9.src.rpm


BUG FIX VNC NOT RESPONDING CONTINUOUS KEY PRESS
-----------------------------------------------
See [5], need to upgrade Vnc package.
This has been resolved since installing vnc-server-4.1.2-31 from
Fedora-Updates. This coincided with an update to the xorg-x11-* packages,
so those updates could have been responsible for the fix, too. In any case,
I'm very grateful this has been corrected! :)

Download vnc-server-4.1.3-1.fc9.i386.rpm from [6]


HOW VNC SERVER PORT NUMBER IS DERIVED
-----------------------------------------
vnc port number is 5900+userDesktopIndexNumber

$vncviewer 10.1.1.10:2
Then in firewall, 5900+2 = 5902 must be enabled. [2]


BUG FIX WHY ONLY GET GREY SCREEN WHEN CONNECT VNC DESKTOP
------------------------------------------------------
Fixed bug in .vnc/localhost:localdomain:2.log
".......failed to execute message bus daemon /bin/dbus-daemon...."

Solution refer to web link [3]
upgrade selinux-policy, it solved the bug.

Details as below:

root@localhost q.yang]# rpm -q selinux-policy
selinux-policy-3.3.1-42.fc9.noarch
[root@localhost q.yang]# rpm -e selinux-policy
[root@localhost q.yang]# rpm -ivh /home/q.yang/Download/selinux-policy-3.3.1-132.fc9.noarch.rpm

Then

[root@localhost q.yang]# /sbin/service vncserver restart

[root@localhost q.yang]# vncviewer 10.1.1.5:2

Finally see the VNC desktop.

[root@localhost q.yang]# cat /home/q.yang/.vnc/xstartup
#!/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 &
#startkde &
[root@localhost q.yang]#
[q.yang@localhost ~]$


------------------------------------------------


1. check whether VNC installed.
[tchung@tchung101 tchung]$ rpm -q vnc vnc-server
vnc-4.0-0.beta4.3.2
vnc-server-4.0-0.beta4.3.2


If not installed, use yum install vnc

[root@QuentinFedora12 Documents]# yum install vnc-server
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.i686 0:1.0.1-1.fc12 set to be updated
--> Processing Dependency: xorg-x11-fonts-misc for package: tigervnc-server-1.0.1-1.fc12.i686
--> Running transaction check
---> Package xorg-x11-fonts-misc.noarch 0:7.2-9.fc12 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch         Version             Repository     Size
================================================================================
Installing:
 tigervnc-server           i686         1.0.1-1.fc12        updates       1.1 M
Installing for dependencies:
 xorg-x11-fonts-misc       noarch       7.2-9.fc12          fedora        5.7 M

Transaction Summary
================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 6.8 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
http://ga13.files.bigpond.com:4040/fedora/linux/releases/12/Everything/i386/os/repodata/521b16256b03f708faa16735faeb724df48eb2562ba044c595add16e23288979-prestodelta.xml.gz: [Errno 14] PYCURL ERROR 7 - ""
Trying other mirror.
fedora/prestodelta                                       | 1.3 kB     00:00
updates/prestodelta                                      | 9.0 kB     00:00
Processing delta metadata
Package(s) data still to download: 6.8 M
(1/2): tigervnc-server-1.0.1-1.fc12.i686.rpm             | 1.1 MB     00:02
(2/2): xorg-x11-fonts-misc-7.2-9.fc12.noarch.rpm                          | 5.7 MB     00:12
-------------------------------------------------------------------------------------------------
Total                                                            459 kB/s | 6.8 MB     00:15
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 signature: NOKEY, key ID 57bbccba
fedora/gpgkey                                                             | 3.2 kB     00:00 ...
Importing GPG key 0x57BBCCBA "Fedora (12) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : xorg-x11-fonts-misc-7.2-9.fc12.noarch                                                                1/2
  Installing     : tigervnc-server-1.0.1-1.fc12.i686                                                                    2/2

Installed:
  tigervnc-server.i686 0:1.0.1-1.fc12

Dependency Installed:
  xorg-x11-fonts-misc.noarch 0:7.2-9.fc12

Complete!




2. change setting

[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/vncservers

VNCSERVERS="1:q.yang 2:m.xie"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1024x768"


3. pwd
[tchung@tchung101 tchung]$ vncpasswd
Password:

4. restart vnc service

[tchung@tchung101 tchung]$ sudo /sbin/service vncserver start
Starting VNC server: 1:tchung                              [  OK  ]


[tchung@tchung101 tchung]$

Verify:


5. edit ~/.vnc/xstartup
[q.yang@QuentinFedora12 Documents]$ cat ~/.vnc/xstartup 
#!/bin/sh

vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
  case "$WINDOWMANAGER" in
    *gnome*)
      if [ -e /etc/SuSE-release ]; then
        PATH=$PATH:/opt/gnome/bin
        export PATH
      fi
      ;;
  esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
  exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
  exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
#startkde &





6. restart vnc service

7. change firewall to allow vnc  

NOTE: Please use GUI to do firewall settings for fedora 12 as 'iptables' has different format for fedora 9 and fedora 12. Below is iptables setting for fedora 9 ONLY.

tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/iptables

# Firewall configuration written by redhat-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

[tchung@tchung101 tchung]$ sudo /sbin/service iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
[tchung@tchung101 tchung]$
8. want auto restart when linux reboot
To make VNC server to start on boot:
# chkconfig vncserver on

relevant link: http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/

No comments: