Personal tools
You are here: Home Fedora Solved Network Solutions Vncserver Setup

Vncserver Setup

by L0cKd0wN last modified Feb 06, 2008 07:39 AM
— filed under:

This article will describe how to setup and configure vncserver within your home LAN, from a Windows XP machine (client side) to Fedora Core (remote side). New users adjusting to Fedora Core distributions for the first time will find this invaluable. The setup will be done completely through SSH in the terminal.

Requirements:

You will need a computer running Fedora Core with an active internet connection configured for your home network. This is the machine we will be "VNC-ing" into. Since many users come from a Windows XP environment, I'll be using software called RealVNC to test the setup. RealVNC is freely available here. The router that keeps all my devices talking happens to be a Netgear, so for the purpose of this tutorial my Windows machine will be 192.168.0.2 and my FC5 will be 192.168.0.3 . This tutorial assumes you know how the IP addresses of your two devices, you have sshd running on your FC machine, and that you know how to SSH from Windows, using a program called Putty.

Finally, you'll need the package vncserver available on your FC machine. This package is available through yum if it was not included in your default installation:
su -c 'yum install vnc-server'
You will be prompted for your root password.

Doing the work:

  1. Enable vncserver in system services:
    su -c 'setup'
    Scroll to "System Services". Press [Enter]. You will be brought to a screen with the heading "What services should be automatically started?" Scroll all the way down and enable vncserver if it's not selected. Press [Tab] then select "Ok" and "Quit". You should be back at the prompt.
  2. Open ports so the box can get VNC requests. We'll open 5900 to 5905 to allow a few instances:
    su -c '/sbin/iptables -I INPUT -p tcp --destination-port 5900:5905 -j ACCEPT'
  3. Save the rule:
    su -c '/sbin/iptables-save > /etc/sysconfig/iptables'
  4. Confirm the additions went through:
    su -c '/sbin/iptables -L'
    You should get the following:

    Chain INPUT (policy ACCEPT)
    ACCEPT tcp -- anywhere anywhere tcp dpts:5900:5905

  5. Start vncserver for the first time as normal user, not root:
    vncserver
    You will be prompted for a password to access your desktops. Enter a password. The default configuration will be run. You should get something like the following:

    xauth: creating new authority file /home/testuser/.Xauthority
    New 'localhost.localdomain:1 (testuser)' desktop is localhost.localdomain:1
    Creating default startup script /home/testuser/.vnc/xstartup
    Starting applications specified in /home/testuser/.vnc/xstartup
    Log file is /home/testuser/.vnc/localhost.localdomain:1.log
    [testuser@localhost /]$

  6. Stop the VNC service so we can further configure it:
    service vncserver stop
  7. Edit the xstartup config so we are greeted with the gnome desktop manager:
    nano -w /home/~user/.vnc/xstartup

    "~user" will be the name of your user account on your system. Comment out (with a #) twm & at the bottom of the config. Make a new line and type 'gnome-session &' (no quotation marks). It should now look like the following:

    (...)
    xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    #twm &
    gnome-session &

    Save your changes.

  8. Restart vncserver.
    vncserver

    You will be given display information on which "screen" is currently available for VNC:

    New 'localhost.localdomain:1 (testuser)' desktop is localhost.localdomain:1

    Screen information becomes important when you have multiple users or devices on your network available.

  9. Now to your Windows XP machine. With RealVNC installed, start the program and type the IP of your FC box followed by the screen number. My FC box is 192.168.0.3 so:
    192.168.0.3:1

    You will be prompted for the password you supplied earlier in step five (5.). You should now see gnome! Voila!

Troubleshooting


Common problems and fixes

  1. I've found that sometimes normal user levels have trouble stopping the vncserver service to further configure xstartup. You may have to manually kill the process so your changes can go through. Example:

    [testuser@localhost /]$ service vncserver status
    Xvnc (pid 3037) is running...
    [testuser@localhost /]$ kill 3037
    [testuser@localhost /]$ service vncserver status
    Xvnc is stopped

More Information

Disclaimer

This is my first article! But I really hope it helps you out. Come find me in #fedora on irc.freenode.net and I'll do what I can to assist!
Document Actions
Log in


Forgot your password?
New user?