Introduction
Before VNC, we may use Xming or XWin32 to connect to a proper configured X-Windows Server. This requires few X-Windows Server setup to get it done.
Since Fedora 7, there is a new service to connect to X Windows Server much easily. This service is VNCServer.
Installation
Using yum to query and install for vnc-server rpm packages:
# yum list vnc-server
Installed Packages
vnc-server.i386 4.1.2-23.fc8 installed
# yum install vnc-server.i386
VNC Server Configuration
- Define VNC server instances in /etc/sysconfig/vncservers:
VNCSERVERS="1:myuser"
VNCSERVERSARGS[1]="-geometry 1024x768 -nohttpd" - Each VNC server instance listens on port 5900 plus the display number on which the server runs. In our case, myuser’s vnc server would listen on port 5901 (5900 + 1).
- You may setup multiple vnc instance as well:
VNCSERVERS="1:myuser 2:user01 3:user02"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"
VNCSERVERARGS[2]="-geometry 800x600 -depth 8"
VNCSERVERARGS[3]="-geometry 1024x768 -depth 16" - In this case, the vnc server would listen on port 5901, 5902 and 5903 respectively.
- In myuser's account, setup vnc password for the user:
# vncpasswd - Start VNC Server:
# service vncserver restart
# chkconfig vncserver on - Define a new Firewall rule (/etc/sysconfig/iptables):
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
More User Configuration
Once vncserver has startup for the first time, it will create a default xstartup config file. You may define your own startup script:
# vi /home/myuser/.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 &
Connect to VNC Server
You may use any vesion of vncviewer to connect to the VNC Server. For example, download TightVNC viewer for Windows. The connection string is something like:
myhost:5901
Enter password and you may connect to your X windows service remotely.
Reference:
No comments:
Post a Comment