09 November 2016
So this will explain you how I managed to get two versions of Firefox installed on Ubuntu. One old version used for testing and one updated used as my default browser.
First we will remove our current Firefox version. We will do this to ensure that we start from scratch but you can try to skip this if you already have an updated version of firefox running and go ahead with the testing version setup.
To uninstall your current firefox:
sudo apt-get purge firefox
We will now download the versions we want to install locally. Mozilla publishes all the versions in their FTP:
So just go there and select which versions do you want to install. In my case I have a 64bits version and I selected the spanish versions of Firefox v47.0.2 (for testing) and Firefox v49.0.2 (for standard usage).
So the files I downloaded are:
- v47.0.2: http://ftp.mozilla.org/pub/firefox/releases/47.0.2/linux-x86_64/es-ES/firefox-47.0.2.tar.bz2
- v49.0.2: http://ftp.mozilla.org/pub/firefox/releases/49.0.2/linux-x86_64/es-ES/firefox-49.0.2.tar.bz2
I did that in my downloads folder but where you do it is not revelant while you remember where files are :)
Now enter in the selected folder, extract both files and move them into subfolders in
# enter the folder where you downloaded files
# extract v47.0.2. This will create a firefox folder in your current folder
tar -xjf firefox-47.0.2.tar.bz2
# move v47 to its location inside /opt folder. Note that we are using a different folder name
sudo mv firefox /opt/firefox-47.0.2
# extract v49.0.2. This will create a firefox folder in your current folder
tar -xjf firefox-49.0.2.tar.bz2
# move v49 to its location inside /opt folder. Note that we are using the SAME folder name
sudo mv firefox /opt/firefox
If all went ok now we have two versions of firefox in our /opt folder:
- /opt/firefox-47.0.2 (for testing)
- /opt/firefox (for standard usage)
Now it's time to create the symbolic link into our /usr/bin folder. This is the key here as we will replace it depending on the version of firefox we want to use. For now let's create the standard usage link:
# ensure that we remove any older link
sudo rm /usr/bin/firefox
# create the new link
sudo ln -s /opt/firefox/firefox /usr/bin/firefox
That let's our system ready for standard firefox usage. If you run firefox it should show you the v49.0.2 version.
When we want to use v47.0.2 for testing we only have to replace the symbolic link in /usr/bin/firefox with something like:
sudo rm /usr/bin/firefox && sudo ln -s /opt/firefox-47.0.2/firefox /usr/bin/firefox
And then run tests. When we are finished testing we have to restore the old symbolic link:
sudo rm /usr/bin/firefox && sudo ln -s /opt/firefox/firefox /usr/bin/firefox
I don't think that's very comfortable so I created two bash aliases in my ~/.bash_aliases file:
alias ffox-test='sudo rm /usr/bin/firefox && sudo ln -s /opt/firefox-47.0.2/firefox /usr/bin/firefox'
alias ffox-std='sudo rm /usr/bin/firefox && sudo ln -s /opt/firefox/firefox /usr/bin/firefox'
So when I want to test I only have to run
ffox-test and the active firefox version becomes v47.0.2. When I finished running tests I run
ffox-std and the active firefox version becomes v49.0.2.
Remember that when you add new aliases they don't become active until you restart the bash session so you may need to execute
bash in command line to get the new aliases working. When you restart they will be there for you.