How can I install a specific older version of Firefox and keep it from automatically updating?

11,466

You should not do this, because versions of Firefox past the 3.6-series do not remain supported, even with security updates, when new versions come out. (This is why Firefox 8 is in Lucid now.) Continuing to run Firefox 7.0.1 means you are running a version that has known security vulnerabilities that are not and never will be patched--it puts you (and your customers/clients, if applicable) at risk.

Install the upstream binaries manually

Unless you can get one of the above techniques to work, the easiest way would probably be to make your script download the upstream Firefox 7.0.1 binary distribution, unpack it, and install it as root:

[ -d /opt ] || sudo mkdir -m  755 /opt
cd /opt
if [ `uname -m` = x86_64 ]
then
    sudo wget http://mirror.dacentec.com/mozilla/firefox/releases/7.0.1/linux-x86_64/en-US/firefox-7.0.1.tar.bz2
else
    sudo wget http://mirror.dacentec.com/mozilla/firefox/releases/7.0.1/linux-i686/en-US/firefox-7.0.1.tar.bz2
fi
sudo tar xjf firefox-7.0.1.tar.bz2
sudo apt-get purge firefox # removes firefox; comment out if definitely uninstalled
ln -s /opt/firefox/firefox /usr/bin/firefox

A few considerations:

  1. As explained above, you should not do this at all! (This technique is useful for other purposes, which is the main reason I'm posting about it.)

  2. The script above doesn't check to see whether or not commands completed successfully before proceeding. It assumes that /opt exists with reasonable permissions or that it doesn't exist and can be created (which is pretty safe), that the download succeeds (which is not particularly safe), and that the archive successfully unpacks (which is somewhat safe, if the download succeeded). It also assumes that if you don't have a 64-bit PC (or Intel Mac), then you have a 32-bit PC (or Intel Mac), since the script would fail anyway for other architectures since binary builds are not provided upstream for them (you can still build from source for them though); while this is safe in the sense that it doesn't increase the risk of failure, it doesn't give any useful error message when the architecture is unsupported. It creates a symbolic link to the newly installed Firefox 7.0.1 binary in /usr/bin, which will fail if you still had another version of Firefox installed, but you would want it to fail in that situation.

  3. There is no reason to think the download mirror I have used in the script is the best one for you. You might want to change it, or implement the script to figure out a reasonable mirror to download from. (If you apply this technique as I am recommending--that is, only to a similar but different problem where the software you're installing is still supported with security updates--then you'll be installing a different program and will thus have to change the argument to wget anyway.)

  4. Using this method, you don't have to hold the firefox package, because the firefox package is not what is providing Firefox 7.0.1. (No package is providing it; it's installed manually without the package manager.)

Share:
11,466

Related videos on Youtube

Matt V.
Author by

Matt V.

Updated on September 18, 2022

Comments

  • Matt V.
    Matt V. over 1 year

    I wrote a bash script to configure a suite of tools for continuous integration on top of Ubuntu 10.04.2. The script recently stopped working and I tracked the problem down to the newer version of Firefox that was just released. The image of Ubuntu that I'm starting with already has Firefox installed, but I need a version in between what it comes with and the latest.

    Here's the code I was using:

    sudo add-apt-repository ppa:mozillateam/firefox-stable 
    sudo apt-get update
    echo "y" | sudo apt-get install firefox
    

    How can I instead install Firefox 7.0.1 and keep it from automatically upgrading to the latest version?

    If I can, I'd like to avoid installing Firefox manually, so I can more easily use apt-get later, once the issue I'm running into gets resolved.

    • Lekensteyn
      Lekensteyn over 12 years
      Aside: you can use sudo apt-get install -y firefox to accept the installation.
    • Caesium
      Caesium over 12 years
      Possible duplicate of askubuntu.com/questions/18654/…
    • Lekensteyn
      Lekensteyn over 12 years
      @Caesium while that may technically answer the question, it's not suitable for hlding a package at a certain version before installation.
    • david6
      david6 over 12 years
      So you need: (a.) a 10.04 LTS only PPA, with Firefox 7.0.x, or (b.) to resolve the scripting issue. Can you describe the script problem in more detail.
    • Matt V.
      Matt V. over 12 years
      @david6 I've added a link to the script above. The problem is that PHPUnit/Selenium tests stopped running properly when Firefox released the 8.x version. Selenium opens Firefox, but the tests don't run. Manually uninstalling Firefox 8.0.1 and then manually installing Firefox 7.0.1 fixes the problem. I'm just looking for the best way to specify an older version to be installed in the script, until the Firefox/Selenium/PHPUnit issue gets resolved.
    • Eliah Kagan
      Eliah Kagan over 12 years
      I've edited my answer to include information about how you'd try to download and install the old Firefox 7.0.1 from the firefox-stable PPA. I don't expect this to work, which is why I've kept the description of how to install from the official upstream binary, which I think you'll probably have to do.
    • Eliah Kagan
      Eliah Kagan over 12 years
      If you're only going to be using Firefox to view web pages for testing that were created by trusted authors, and only for a very short time, then it might be reasonable for you to continue using Firefox 7.0.1 (though, as an unsupported browser, it's by no means ideal for testing!). Still, I'm leaving in my strong caveats about security; the security issues should not be ignored, and other users will likely come upon this question and consider using the techniques I've presented.
    • Eliah Kagan
      Eliah Kagan almost 12 years
      Did my answer work for you? If it does answer the question to your satisfaction, have you considered accepting it?