From a user’s perspective, having to use an old beta version of Firefox in my primary desktop, while, at the same time, a final stable release of the browser has been released, is a bit annoying. But, the fact that this happens due to technical issues makes it partially acceptable. The following article aims to provide step-by-step instructions about how to use the alternatives system to set a custom Firefox release, downloaded from mozilla.org, to be the system’s default. Using this method the user is relieved from having to go through all the firefox launchers and menu entries in order to edit the paths to the firefox executable. Moreover, this post should also be a good example of how to use the alternatives system in the Linux distributions that support it.
Update: Firefox 3.0 final has become available from the official fedora updates repository. It seems that the technical issues of the past do not exist any more! Kudos! This tutorial will still give you an idea though about how to quickly and easily switch between the default and custom versions of the same software in your system.
Fedora 9 has been used as the desktop system for this article. The provided information will certainly work in CentOS and RHEL, but might also work for other linux distributions which use the alternatives system, such as Debian, Ubuntu, OpenSUSE etc. As far as I know, Gentoo and its derivatives use their own system.
In order to check if “alternatives” is available in your system, try one of the following commands:
which alternatives which update-alternatives
First of all, we install a precompiled (binary) Firefox distribution, downloaded from mozilla.org, in the /opt directory. All the following commands should be issued by ‘
root‘ or by your regular user using ‘
Change to the /opt directory, download and extract the firefox package:
cd /opt/ wget ftp://ftp.mozilla.org/pub/firefox/releases/3.0/linux-i686/en-US/firefox-3.0.tar.bz2 tar -xjf firefox-3.0.tar.bz2
Now change to the /opt/firefox/ directory, delete the plugins/ subdirectory and create a symlink to the system’s directory containing the firefox plugins (
/usr/lib/mozilla/plugins/ in Fedora).
cd firefox/ rm -fr plugins ln -s /usr/lib/mozilla/plugins/ plugins
The installation of the custom Firefox version is complete.
Set the system-wide default Firefox version
In this section we will use the alternatives system in order to provide us with two options:
- Use Fedora’s default Firefox release. This means that /usr/bin/firefox should be executed whenever we issue the ‘
- Set our custom Firefox release as the system’s default. This means that /opt/firefox/firefox should be executed whenever we issue the ‘
Note: Describing the details of the alternatives system is out of the scope of this article, so it is highly recommended that you study the alternatives manual page (
man 8 alternatives)
In the following steps we will add a group, named “firefox“, of alternative options for the location of the firefox executable. These options are actually filesystem locations which will be linked by the /usr/local/bin/firefox symlink. Note that we use the /usr/local/bin/… path for our symlink, because /usr/bin/firefox is occupied by fedora’s firefox executable. The latter will not be called directly any more, as the executables located in /usr/local/bin/ override the ones located in /usr/bin/, so whenever the command ‘
firefox‘ is invoked, /usr/local/bin/firefox will actually be used. The latter is a symlink, which links to either fedora’s firefox executable or our custom firefox executable.
So, we add the ‘firefox‘ group of options:
/usr/sbin/alternatives --install /usr/local/bin/firefox firefox /usr/bin/firefox 10 /usr/sbin/alternatives --install /usr/local/bin/firefox firefox /opt/firefox/firefox 20
Now we can manually set which firefox executable to use as the system’s default. In other words, the following command links /usr/local/bin/firefox to the desired executable (/opt/firefox/firefox in our case):
/usr/sbin/alternatives --set firefox /opt/firefox/firefox
Instead of the
--set option as shown above, we can use the –config option, so that a list of the available alternatives is displayed and we are prompted to make a selection:
# /usr/sbin/alternatives --config firefox There are 2 programs which provide 'firefox'. Selection Command ----------------------------------------------- 1 /usr/bin/firefox *+ 2 /opt/firefox/firefox Enter to keep the current selection[+], or type selection number: 2
Finally, we can issue the following command to get an overview of our current configuration for the group ‘firefox‘:
# /usr/sbin/alternatives --display firefox firefox - status is manual. link currently points to /opt/firefox/firefox /usr/bin/firefox - priority 10 /opt/firefox/firefox - priority 20 Current `best' version is /opt/firefox/firefox.
Revert to the original state
If for any reason you need to revert things back to the default state, all you have to do in order to remove all the “alternatives” we had configured in the previous section is the following:
/usr/sbin/alternatives --remove firefox /opt/firefox/firefox /usr/sbin/alternatives --remove firefox /usr/bin/firefox
No other configuration is required. From now on, whenever the ‘
firefox‘ command is invoked, fedora’s old /usr/bin/firefox is executed.
Technical issues in the linux distribution preparation process might limit the user to certain software versions. The alternatives system provides users with the choice to configure the system in a way that it is extremely easy to switch between default and custom versions of the same software.
Use the Alternatives System to switch to a custom Firefox release by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2008 - Some Rights Reserved