I’m posting this article to document the setup and configuration of vncserver on my Fedora Core 4 desktop. I’ve had a hard time finding the right documentation online. So, I’m making this document available to anyone who might be looking for help configuring the vncserver on the Fedora Core 4 and 5 platform. And now, Fedora 6 as well. Let’s get started.
1. If you haven’t installed the vncserver yet, type in the following commands from the bash console to start the installation process.
yum -install vnc-server |
2. The following commands takes you to your home directory and starts the vncserver configuration. You’ll be prompted to enter your vncserver password twice. Vncserver will then create several files in the .vnc directory underneath your home directory.
cd
vncserver |
3. Change directory to .vnc directory and edit the xstartup file and remove the “#” uncommenting the following lines:
unset SESSION MANAGER
exec /etc/X11/xinit/xinitrc
cd .vnc vi xstartup |
Save the file by typing “:wq”
4. If the firewall is NOT installed, skip the next two steps. Otherwise, login as root. Change directory to /etc/sysconfig. Edit the iptables firewall.
su cd /etc/sysconfig vi iptables |
Add the following rules:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901:5909 -j ACCEPT |
Save the file by typing “:wq”
5. Restart the firewall.
/sbin/service iptables restart |
6. Start the vncserver with the following options. If successful, you will see a message stating the server has been started.
vncserver -geometry 1024x768 -depth 16 :1 |
7. Now access the vncserver from another machine, using either a Windows or Linux machine. You can use the vncviewer program which is available for both Windows and Linux platforms.
From Linux, enter the following command:
vncviewer hostname:1 |
From Windows, start vncserver application and type hostname:1 in the dialog box.
Enter your vncserver password!
Addendum:
8. Perform the following commands to make the vncserver server start at boot time. Login as root. Change directory to /etc/sysconfig.
su cd /etc/sysconfig vi vncservers |
Edit the vncservers file and type in the following:
VNCSERVERS="1:user1 2:user2" VNCSERVERARGS[1]="-geometry 1276x968 -depth 16" VNCSERVERARGS[2]="-geometry 1024x768 -depth 16" |
Save the file and reboot. I tried restarting vncserver via Services without rebooting, but it didn’t work for me. So, a reboot is necessary. The vncserver should start automatically after each reboot.
9. Finally, if you like to run the vncserver on several runlevels other than the default 5, perform the following commands.
Check status of vncserver:
chkconfig --list vncserver |
If you like to activate vncserver on different runlevels, for example 3, 4 and 5.
chkconfig --level 345 vncserver on |
10. That’s it.