CIS-2230 Lab #8: Xfce

In this lab you will experiment with remote GUI access using the Xfce desktop environment.

Part 1: Installing Xfce

  1. Before getting started, it might be a good idea to ensure your system software is up to date. Do the following commands to download and install all system updates:

      $ sudo apt update
      $ sudo apt upgrade
      $ sudo apt autoremove
    

    Reboot your system after the update to ensure all updated software is being used, and there are no remaining older versions of that software still in memory.

  2. Next, take a snapshot of your system in case you want to revert any changes you make in this lab. This is because this lab entails installing significant software packages that have the potential to destabilize your configuration if things don't work well.

    The method for taking a snapshot depends on your virtualization software. If you are using VMware, click on the "VM" menu and select "Take Snapshot." It is best to do this while your virtual machine is off.

  3. Use the command sudo apt install xfce4 to install the Xfce desktop environment. Notice the large number of packages required to support the Xfce desktop (and Xfce is a "lightweight" desktop environment!).

    After installation, reboot your virtual machine. When you reboot your system, it will start in graphical mode. You can ignore that. Assume the machine's console is "far away" and not physically accessible to you. You should still be able to log in via SSH as before.

Part 2: X Windows

  1. Download and install the open source VcXsrv X server from its release page.

  2. When you start VcXsrv, select "Multiple windows" and "Start no client." You do not need to save the configuration at this time. Note that VcXsrv does not display any window at first since there is no client connected. However, it is running as an icon in the system tray.

  3. SSH to your virtual machine using the -X command line option. Start a GUI terminal program using the command xfce4-terminal &. You may need to install the terminal program (you will get instructions for doing so, if it is required). The terminal should appear on your Windows desktop. Other graphical programs that you run on the remote system (e.g., xeyes) will also appear on your Windows desktop.

  4. Exit from all graphical windows coming from the remote system and then close the X server (VcXsrv). The server should report "0 clients connected" in a dialog box just before you finalize closing it.

    Restart the X server, but select "Single window." As before, select "Start no client." This will cause a single, blank window to appear. Now, via your SSH session run startxfce4.

    You should see a full desktop appear in the previously blank window. In this mode of operation, the display handling is being done by your Windows system (specifically, by VcXsrv) and not by the remote Linux system. This reduces the load on the remote Linux system. Note that the console is still waiting for a graphical login while a desktop is projected onto your Windows system via the X protocol.

    Use "logout" to terminate the desktop environment (this does not log you out of your SSH session).

  5. Close and exit the VcXsrv server.

Part 3: VNC

  1. Install a VNC server on the remote system: sudo apt install tightvncserver

  2. Create the file ~/.vnc/xstartup. It should include the following:

    #!/bin/sh
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    exec startxfce4 &
    

    Be sure the file is executable (it's a script).

  3. On the remote host run (you might want to unset the DISPLAY environment variable first):

      $ vncserver :1 -geometry 1280x800 -depth 24 -name Xfce
    

    You will be asked to enter a password. This password will be used to authenticate connections to the VNC server. It does not need to be (and probably shouldn't be) the same as your usual password on the system.

  4. Connect to the remote system and create an SSH tunnel. For example:

      ssh -L 5901:localhost:5901 user@remote
    
  5. On your local system (Windows), connect to localhost:5901 using a VNC viewer such as TightVNC.

    Note that when you install TightVNC, it installs a VNC server on your Windows machine. It will ask you for a password for that server. Choose a high-quality password or else other people could view your Windows desktop using VNC! This is not the password you set on your remote Linux system.

    When you run the TightVNC client, it will ask you where to connect (the localhost address above), and then prompt you for the password needed to access the remote virtual display (the one you set when you launched the VNC server).

    There is a quirk that prevents terminal sessions from starting in Xfce. This is because of an incorrect terminal emulator setting. In Xfce go to Applications > Settings > Default Applications > Utilities > Terminal Emulator. Change the setting to "Xfce Terminal." The change should take effect immediately.

Submission

For this lab, submit a document that shows the commands you used in each part and any relevant observations. This lab is worth 20 points.


Last Revised: 2025-10-31
© Copyright 2025 by Peter Chapin <peter.chapin@vermontstate.edu>