-
Does an existing version of firefox exist?
firefox --version
If not, skip to (3).
-
Install dependency
sudo apt-get install libgtk2.0-0
-
Download firefox version: FireFox's release archive can be found at https://ftp.mozilla.org/pub/firefox/releases/. You will need to use the appropriate version (typically
linux-x86_64
, but you can runarch
oruname -m
to check if your machine is 64 or 32 bit).wget https://ftp.mozilla.org/pub/firefox/releases/45.0.2/linux-x86_64/en-GB/firefox-45.0.2.tar.bz2 # Saving to: ‘firefox-45.0.2.tar.bz2’
-
Extract the binary
tar xvf firefox-45.0.2.tar.bz2
-
Backup existing firefox directory
If you have a firefox already installed, back-up the existing version:
sudo mv /usr/bin/firefox /usr/bin/firefox-backup
and remove the symbolic link
rm /usr/bin/firefox
-
Move the extracted firefox directory
sudo mv firefox/ /usr/lib/firefox
-
Create a symbolic link to the firefox binary
sudo ln -s /usr/lib/firefox /usr/bin/firefox
-
-
Save stephenharris/90bb468bf80e7f7b02e8b8afe694de4f to your computer and use it in GitHub Desktop.
If someone needs this for a Dockerfile, as October 2021, I did it this way:
ARG FIREFOX_VERSION="XX.YY.ZZ"
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install firefox \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&& wget --no-verbose -O /tmp/firefox.tar.bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2 \
&& apt-get -y purge firefox \
&& rm -rf /opt/firefox \
&& tar -C /opt -xjf /tmp/firefox.tar.bz2 \
&& rm /tmp/firefox.tar.bz2 \
&& mv /opt/firefox /opt/firefox-$FIREFOX_VERSION \
&& ln -fs /opt/firefox-$FIREFOX_VERSION/firefox /usr/bin/firefox
...taking inspiration on the Firefox installation part on the selenium/node-firefox Dockerfile.
It works smoothly with Firefox version 93.0
.
@AlessandroIudicone when I tried running your Dockerfile I got the error: E: Package 'firefox' has no installation candidate
. Are you using a specific source for this firefox package?
Hello @dryu99
I actually don't incur in this error neither using a specific package source.
Trying with an Ubuntu base image, the package is successfully found and installed (although I incur in other errors later through the execution of the Dockerfile script, like "wget not installed" or "bzip2: Cannot exec: No such file or directory").
I tried with an Ubuntu base image using Firefox versions 55.0.3, 93.0 and the latest 103.0.2 .
Which base image are you using ?
On the last step (7. Create a symbolic link to the firefox binary),
I think that the command should be "sudo ln -s /usr/lib/firefox/firefox /usr/bin/firefox".
Also, "rm /usr/bin/firefox" could begin with "sudo" so that copy/pasting it as is always works.