Fist make sure that you have a recent Ubuntu version installed, and OpenFOAM installed in it. Note that your username and password will remain in the bootable version, so you may consider changing those to something general.
Use Systemback to create an iso-image of the current Ubuntu operating system (Link to info on Systemback)
Installation (add the repository, that is not part of Ubuntu):
sudo add-apt-repository -y ppa:nemh/systemback
sudo apt-get update
sudo apt-get install systemback
Don't use sudo, which gives "Unsafe X Window authorization! please do not use sudo command" (link). Do:
/usr/lib/systemback/sbsustart systemback
Make sure that you do this on a freshly installed Ubuntu system that doesn't have too many packages installed, since there is a file system size limit of 4GB on the iso. Include the user files to include the OpenFOAM installation(s), but first remove the intermediate compilation files. Make sure to keep the lnInclude directories if it should be possible to compile developoments. E.g. run the wcleanAll script after commenting out the parts relating to the platforms and lnInclude directories. I kept only one OpenFOAM version Opt+Debug.
Click on "Live system create", keeping the rest as default.
Give a "Name of the live system".
Tick "Include user data files".
Click "Create new". This will take some hours, and gives a *.sblive file in the "Storage directory".
From the "Created Live Images" window, select the image you want to convert, and then click "Convert to ISO". This will take some hours, and gives a *.iso file in the "Storage directory".
There was a problem burning the iso from Ubuntu in VirtualBox. Therefore the process is first described for Windows 7:
In Windows 7
Transfer the iso-file to Windows.
Insert a 4GB usb stick.
Right-click on it and choose format with default settings.
Install Rufus. (See other alternatives)
Run the Rufus exe-file.
Choose the "Device" to burn on, i.e. the USB stick.
Edit the "New volume Label".
Choose "Create a bootable disk using ISO image" and click the icon to browse for the iso-file.
Keep the rest of the default values and click on "Start". This took me 20min.
In Ubuntu
I managed to get this to work for one USB-stick, but not for the rest for some reason. After a while it complained that it could not write to the USB stick. It is proably related to the fact that I was doing this with Ubuntu installed in VirtualBox.
First make sure that the 4GB USB stick is formatted (FAT32 ok) and empty (see the Windows section above).
Follow the official Ubuntu description:
Insert the USB stick (see below if you are doing this through VirtualBox).
Open the dash and search for Startup Disk Creator.
Select the Startup Disk Creator to launch the app.
Click 'Other' to choose the downloaded ISO file.
Select the file and click 'Open'.
Select the USB stick in the bottom box and click 'Make Startup Disk'.
The first thing you need to do is install Virtualbox from Oracle’s website. It is different than Virtualbox OSE which is included in the Ubuntu repositories because the Virtualbox from Oracle includes proprietary software which allows you to mount USB devices inside you VM among other things. If you already have Virtualbox OSE installed from the Ubuntu repositories, uninstall it before installing the .deb file from Oracle’s website.
Start your Ubuntu virtual machine.
At the top of the VirtualBox window, click on "Devices/USB Devices/" and choose the USB stick. If that is not possible you may have to do some steps first that are described here. It seems like that is needed if your base operating system is Ubuntu, so it worked without this for my Windows 7 installation.