Creating an Ubuntu VM to distribute

While this question is somewhat opinion based to a degree:

Yes this procedure is viable - I believe that it would accomplish what you are looking for and it is something I have done in the past with other linux distributions.

The only real pitfall is around disk spacing... make sure that your students machines have sufficient disk space to handle the size of the Virtual Disk. Also, ensure that you keep a copy offline on at least one machine so that you can use the template/reference disk to quickly recreate a disk when a student kills their machine.

The disadvantages to a dynamic disk is that the host OS has to keep allocating more and more disk space as the VM grows with data/updates. This has a performance overhead which can be a headache at times - especially if you are running on a low powered VM (Host machine power minus power being used to expand a disk does tend to make VMs lag a bit).. it also potentially makes then unportable (not all machines in your lab may have 100GB+ once a student has messed with their VM)

Guest addons aren't machine specific.. they're pretty much a driver set. When you import the VM into a new host, the VM drivers will detect and tweak your hardware to work on the new host.

Elegant user creation - not sure, maybe a script which runs on first launch and asks a user to create a new account before the script self destructs? I'll do some digging and get back to you when I have 5 mins to spare.

Hope this at least partly helps.

Answering your question exactly, if you need to tailor the VM and hand them a deliverable VirtualBox VM, I recommend using Packer to prepackage the VM with all the required dependencies. It is built for just this purpose and allows you to spin up an image from an ISO, perform any provisioning you want against that image, and then creates a deliverable VirtualBox VM image. This is good for you too because it documents exactly what was done to the deliverable in case you ever want to reproduce it/add something to it. Also, you can check the project into a source control system and make changes. Here's an example of that being done to get you started.

However, if you want them to get running quickly, I recommend using Vagrant and distributing to your students a Vagrantfile that performs the desired provisioning you require on a standard Ubuntu image. This has several advantages:

  • Vagrant works out of the box with VirtualBox and will handle all the hard parts for the students such as setting up shared folders so they can copy files easily between the VM and host machine, configuring networking so as to allow internet access to the box for them, etc. This also saves you the time of having to document/debug VirtualBox setup issues for them.
  • A Vagrantfile is much smaller than a deliverable VM. If you want to change/add something to the VM half way through the course you don't have to rebuild a new VM, just give them an updated Vagrantfile.
  • If they mess something up beyond their ability to repair it, they can painlessly destroy/redeploy the VM again
  • A Vagrantfile will show your students exactly what was done to the VM so that when the get to the point where they understand enough, they can see what's going on under the hood and possibly learn from that too.

Here's an example Vagrantfile showing how to do some provisioning on a Ubuntu 14.04 image.

Perfectly feasible. The alternative would be Vagrant, Puppet, Chef or something similar to build the VM's from scratch but that is a lot of work to setup.

The development team on one of my sites does the same to get new developers quickly up and running.
1 pre-set account (with sudo-rights) in the image and a short instruction-document with the steps they must take to create their on personal account.

Please note: You most likely need network/internet access inside the VM. That can be either bridged or NATted onto the host. Regardless which you choose, you will have to instruct your students how to configure the host side of this. Just setup the NIC inside the VM as DHCP device. That is a safe starting point for most configurations, even if the user later must manually configure a static IP address.
Putting a static IP address in the VM is really asking for trouble. It is bound the be in use already by another VM getting online on the same LAN...