I would like to run multiple versions of QGIS on Ubuntu 12.04. Can I do that, and how if so?
Yes you can do that, but it is more than likely going to require you building your own version in conjunction with you installing one from the package repository.
This post on here has some of that information in the comments of the highest answer.
I also googled around and found this:
which also is along the same line. Basically it is not going to be easy if you are not really familiar with building from source and managing installation of custom software under linux.
One can install NextGIS QGIS (2.18.21) using this PPA (https://launchpad.net/~nextgis/+archive/ubuntu/ppa/+packages)
sudo add-apt-repository ppa:nextgis/ppa sudo apt update sudo apt install ngqgis
But be careful with python-ngqgis package as it overwrite python-qgis to work qgis plugins (make sense only for two QGIS 2.x, for QGIS 3.x and NextGIS QGIS will be fine).