how to install and update mozilla firefox in linux

Installing Mozilla Firefox on your system is the first step towards using it as your everyday browser. Almost all of the major Linux distribution comes installed with a version of Firefox and every Linux distribution has its own different way of installing softwares, which means the method of installing and updating will vary.

The package manager associated with your distro will usually have the latest released or stable version of Firefox. In order to use the package manager refer to the documentation for the distribution you are using. Using the package manager usually allows you to have only a single (and stable) version of the browser, which means you cannot install the latest and greatest or multiple versions. Also, package managers do take some time to update the repository after the release date.

Mozilla Firefox is “released” in four different channels, each in different stages of development and each more unstable than the other.

  • Release Channel: This is the most stable of all. These include the quality tested and stable features which are for general release.
  • Beta Channel: These are broadly tested for stability and includes all the upcoming features which are more or less stable.
  • Aurora Channel: Not as stable as the Beta channel but the features are farther along in their development and you can use and test many of the features.
  • Nightly ChannelThese are as-is. Most unstable of all with no guarantee to work at all.

If you want to try out any of the channels other than the release channel, then you will have to download and install the software manually. Here are the steps you have to follow to do the same

  1. Download the appropriate Firefox build from the desired channel to a temporary folder, eg: ~/downloads/firefox-<version>.tar.bz2 
  2. Open a command prompt or Terminal.
  3. Extract the downloaded software to the appropriate location using the tar command. eg: tar xvjf ~/downloads/firefox-<version>.tar.bz2 -C /opt/firefox-testing/. This command will extract the downloaded file into a folder in /opt/firefox-testing/firefox.
  4. Run the firefox script in the extracted folder. eg: /opt/firefox-testing/firefox/firefox

The above steps are pretty straight forward and simple. If you are on the nightly or the aurora channel then updating the build manually every day can get pretty cumbersome. Once you have installed the software you can also use the update feature of Firefox to update the latest from the channel.

In order to use the auto update feature, Open Preferences and go to Advanced -> Update tab. You can also update by going to Help -> About Nightly  dialog in the menu.

Update Firefox Automatically in the background

You can also create a shell script to automate the process. Let us go through the steps to download and install the nightly channel and automate them.

First create a shell script file named update-firefox.sh or with any name you prefer.

You can use either wget or the curl command to download the appropriate build. All the builds are available on the ftp server (ftp://ftp.mozilla.org/pub/mozilla.org/firefox/) in addition to the links mentioned above. This makes it easier to download them using the curl command.

curl -o /tmp/firefox.zip ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-18.0a1.en-US.linux-i686.tar.bz2

The shell script which can be used to download and install the latest version looks like this. See the comments in the file for more information. You can modify the script to suit your needs.

#!/bin/bash
# Create a temp folder in /tmp everytime, so that we
# donot overwrite or pickup remains from an earlier run. 
TMPDIR=$(mktemp -d /tmp/firefox.XXXX) 
# Download firefox from the ftp server 
curl -o ${TMPDIR}/firefox.zip ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-18.0a1.en-US.linux-i686.tar.bz2 
# Extract the file into the same folder 
tar xjf ${TMPDIR}/firefox.zip -C ${TMPDIR} 
# Remove the earlier install 
rm -fr /opt/firefox-nightly 
# create a folder in /opt/ and install firefox
mkdir /opt/firefox-nightly 
mv ${TMPDIR}/firefox /opt/firefox-nightly

You can run this script at any time to download and install the latest version of firefox. You can also run the script as a cron job, so that it fetches the latest version every morning.

As you can see the shell script is not exactly fool-proof. You can do some checking/testing before writing and installing the new version so that you do not delete the exisiting install or keep a backup of it to revert back.