VirtualNET @ CSE - Graphical desktop inside your VM

Work in progress. Incomplete. What you read here may not work for you. Needs proofreading.

Introduction

When you start up a VirtualNET VM, it doesn't have anything installed to let you run things graphically inside it. In other words, there's no graphical interface and if you want to do stuff in your VM, you have to do it via the command line. You can't use graphical editors like gedit, and you can't use graphical programs like gimp, firefox, wireshark or graphical file browsers.

It doesn't haven't to stay like this.

You can easily set up a graphical environment in your VirtualNET VM. Keep in mind though, that your VirtualNET VMs are not hugely powerful and don't have a lot of memory, so doing amazing things might best be done inside a normal VLAB session instead.

What I'll show you here is how to set up your own VNC server in your VM, not unlike the one you connect to in VLAB. This means that you'll be able to use a VNC viewer to connect to and do things graphically in your VM.

Caveats
  1. Because you can only connect to a VM from the VLAB host from which it was started, this means you'll have to run the VNC viewer in your VLAB session.
  2. The graphical environment you may be used to on CSE lab computers and other computers you might use is likely to be quite rich — containing a great variety of graphical applications, tools and even games. After you have set up the graphical environment presented here, most of the applications, etc., you might expect won't be there. You'll need to install the ones you want separately. This is typically quite easy using pacman.
Installing and configuring

These instructions are for Arch Linux and will install fvwm and xfce4 window managers and desktops.

  1. Log on to your VM as root.
  2. Run pacman to install the packages:
    pacman -S vncserver xterm fvwm xfce4
  3. Log out as root and log in as yourself.
  4. If you don't already have a
    .vnc
    subdirectory in your home directory, create one:
    mkdir .vnc
  5. If you want to run fvwm2 as your window manager/desktop, create the file .vnc/xstartup containing:
    exec fvwm2
  6. If you want to run xfce4 as your window manager/desktop, create the file .vnc/xstartup containing:
    exec xfce4
  7. Run the following command to start the graphical environment:
    exec vncserver <BLAH>

    If this is the first time you have started vncserver, you will be prompted to create a password for this and future VNC sessions with your VMs. Make it a good/hard-to-guess one to prevent other users getting access to your new graphical environment.

  8. Absent any error messages telling you something catastrophic has gone wrong, you should be able to start a vncviewer in your VLAB session (not inside your VM) like this to access your new VM graphical environment:
    vncviewer 172.Q.X.Y:<num>

    Notes:

    • <num> is usually “1”, but if you already have another vncserver running, or there's one left over that you started earlier <num> may be different. When you start vncserver it outputs a number of diagnostic messages which include the actual <num> value you should use.
    • Replace “172.Q.X.Y” with the address you used when SSH'ing into the VM where you started vncserver.
Installing additional software

Installing additional graphical software can be done with pacman. You'll need to decide what you want yourself. Here's how to install gimp and firefox (run as root in the VM):

pacman -S gimp firefox