Sammenlign revisioner
Install Firefox on Linux
Revision 284482:
Revision 284482 af Mozinet den
Revision 285304:
Revision 285304 af roy-orbitson den
Nøgleord:
ubuntu opensuse debian
ubuntu opensuse debian
Sammendrag til søgeresultat:
This article describes how to download and install Firefox on Linux.
This article describes how to download and install Firefox on Linux.
Indhold:
Many Linux distributions come with Firefox pre-installed through their package manager and set as the default browser. However, if you need to install Firefox on Linux using a different method, the following guide will show you various alternative ways to download and install Firefox on Linux.
{for mac,win}{note}'''This article only applies to Linux.''' {for mac}For instructions to install Firefox on Mac, see [[How to download and install Firefox on Mac]].{/for}{for win}For instructions to install Firefox on Windows, see [[Installing Firefox on Windows]].{/for}{/note}{/for}
__TOC__
=Install Firefox .deb package for Debian-based distributions (Recommended)=
To install the <code>'''.deb'''</code> package through the APT repository, do the following:
#Create a directory to store APT repository keys if it doesn't exist:
#;<code>'''sudo install -d -m 0755 /etc/apt/keyrings'''</code>
#Import the Mozilla APT repository signing key:
#;<code>'''wget -q https://packages.mozilla<!-- -->.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null'''</code>
#;If you do not have <code>'''wget'''</code> installed, you can install it with: <code>'''sudo apt-get install wget'''</code>
#The fingerprint should be '''35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3'''.<!-- Please check with the Release Engineering team (release@mozilla.com) before changing/removing this fingerprint --> You may check it with the following command:
#;<code>'''gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}''''</code>
#Next, add the Mozilla APT repository to your sources list:
#;<code>'''echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla<!-- -->.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null'''</code>
#Configure APT to prioritize packages from the Mozilla repository:
#;<code>'''echo ''''</code>
#;<code>'''Package: *'''</code>
#;<code>'''Pin: origin packages.mozilla<!-- -->.org'''</code>
#;<code>'''Pin-Priority: 1000'''</code>
#;<code>'''' | sudo tee /etc/apt/preferences.d/mozilla'''</code>
#Update your package list, and install the Firefox .deb package:
#;<code>'''sudo apt-get update && sudo apt-get install firefox'''</code>
==Set up different languages in Firefox with .deb files==
For those of you who would like to use Firefox in a different language than American English, we have also created <code>'''.deb'''</code> packages containing the Firefox language packs. To install a specific language pack, replace fr in the example below with the desired language code:
;<code>'''sudo apt-get install firefox-l10n-fr'''</code>
To list all the available language packs, you can use this command after adding the Mozilla APT repository and running <code>sudo apt-get update</code>:
;<code>'''apt-cache search firefox-l10n'''</code>
==Data migration==
If you were using Snap or Flatpak before, you are required to import your profile. There are two ways to do this. You can use either of these methods:
* '''Method 1:''' Set up Sync. For instruction, see [[How do I set up Sync on my computer?]]
* '''Method 2:''' Copy the existing files on your computer. Make sure that all copies of Firefox on your computer are completely closed before doing this:
**Flatpak:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/.var/app/org.mozilla.firefox/.mozilla/firefox/* ~/.mozilla/firefox/'''</code>
**Snap:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/snap/firefox/common/.mozilla/firefox/* ~/.mozilla/firefox/'''</code>
In both cases, once you’ve moved the profiles, launch Firefox from the terminal with the command '''<code>firefox -P</code>'''. Select your desired profile. After this initial setup, the '''<code>-P</code>''' command will no longer be necessary.
= Install from your distribution package manager =
To install Firefox using your distribution package manager, please refer to your Linux distribution's documentation.
This method is recommended because it ensures Firefox and all the required libraries are installed and configured optimally for your distribution. However, there may be a small delay between the official release of a new version of Firefox and the moment when your distribution updates the version it distributes. Your distribution may also distribute it without the Firefox branding or only distribute the ESR version.
= Install from Flatpak =
To install Firefox from Flatpak, [https://flatpak.org/setup/ install and configure Flatpak] on your computer. Once Flatpak is installed, go to the [https://flathub.org/apps/details/org.mozilla.firefox Firefox Flathub's page], and click the {button Install} button. Alternatively, you can type the following command in a terminal:
;<code>'''flatpak install flathub org.mozilla.firefox'''</code>
By default, Flatpak installs Firefox in the same locale as your operating system. To use a different language, please follow the instructions on [[Use Firefox in another language|how to use Firefox in another language]].
= Install from Snap =
To install Firefox from Snap, [https://snapcraft.io/docs/installing-snapd install Snap] on your computer. Once Snap is installed, go to the [https://snapcraft.io/firefox Firefox Snapcraft's Store page], click the {button Install} button, and follow the instructions. Alternatively, you can type the following command in a terminal:
;<code>'''sudo snap install firefox'''</code>
If available, Snap installs Firefox in the same locale as your operating system. To use a different language, please follow the instructions on [[Use Firefox in another language|how to use Firefox in another language]].
= Install Firefox from Mozilla builds =
Before you install Firefox from a Mozilla build, make sure that your computer has the '''[http://www.mozilla.org/firefox/system-requirements.html#gnulinux required libraries]''' installed. Missing or incompatible libraries may cause Firefox to be inoperable.
== System Firefox installation (for advanced users) ==
{note}
To install Firefox with this method, you '''must be''' able to log in as root or execute <code>'''sudo'''</code> commands.
This installation will have priority over the Firefox version installed through your package manager. To run the version installed with your package manager, you will need to execute the binary from a terminal. To do so in most distributions, open a terminal and type:<br><code>'''/usr/bin/firefox'''</code>
{/note}
<!--
Auto-list doesn't work with a newline character in front of a <code> block. This means we need to manually
set the list number
-->
# Go to the [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox download page], and click the {button Download Now} button.
# Open a terminal, and go to the folder where your download has been saved. For example:
#; <code>'''cd ~/Downloads'''</code>
#; Extract the contents of the downloaded file by typing:
#; <code>'''tar xjf firefox-*.tar.bz2'''</code>
#; <br>''The following commands must be executed as root or preceded by <code>'''sudo'''</code>.''
# Move the uncompressed Firefox folder to {filepath /opt}:
#; <code>'''mv firefox /opt'''</code>
# Create a symlink to the Firefox executable:
#; <code>'''ln -s /opt/firefox/firefox /usr/local/bin/firefox'''</code>
# Download a copy of the desktop file:
#; <code>'''wget https://raw.githubusercontent<!-- -->.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop -P /usr/local/share/applications'''</code>
Alternatively, if <code>'''wget'''</code> is not installed on your computer, go to the URL mentioned above, right-click on the page to open the contextual menu, and select {menu Save Page As}. After you downloaded the file, move it to {filepath /usr/local/share/applications}.
To verify that the installation was successful, you can open the [[Use the Troubleshooting Information page to help fix Firefox issues|Troubleshooting Information]] page. In the ''Application Basics'' section, the value of the line ''Application Binary'' should be '''/opt/firefox/firefox-bin'''.
== Local Firefox installation in user's account ==
{note}If you don't have access to login as root or execute <code>'''sudo'''</code> commands, or just prefer to use a local Firefox in your account, you can make a local installation. You can also do this to have multiple Firefox installations for different builds.{/note}
# Go to the [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox download page], and click the {button Download Now} button.
#* You can also click the '''Download a different platform or language''' link below that button to choose another build: Nightly, Beta, Developer or ESR.
# Open a terminal, and go to the folder where your download has been saved. For example:
#; <code>'''cd ~/Downloads'''</code>
# Extract the downloaded file contents. This will create a folder named {filepath firefox}. After that, you can delete the archive:
#; <code>'''tar xjf firefox-*.tar.bz2<br>rm firefox-*.tar.bz2'''</code>
# If you downloaded a specific build, you may want to rename the uncompressed folder accordingly. For example:
#; <code>'''mv firefox firefox-nightly'''</code>
# You can leave the uncompressed folder into your download folder, or move it to another place in your account. For example:
#; <code>'''mv firefox ~/firefox'''</code>
# Firefox is now ready to be used. You can run it directly from the terminal:
#; <code>'''~/firefox/firefox &'''</code>
# Create a desktop shortcut. (It may be different in your Linux distribution.)
#* Right-click on the desktop, and choose '''Create launcher''' from the context menu.
#* You can also type this on the terminal:
#*; <code>'''ln -s ~/firefox/firefox ~/Desktop/'''</code>
#* An icon for the desktop shortcut will be found in <code>'''~/firefox/browser/chrome/icons/default/'''</code>
{note}'''Note:''' This method doesn't change file types binding on the system, so links from other applications will not open in the local installation. You will need to copy the link and paste it in the Firefox address bar.{/note}
=Security features warning=
You may see a warning that “some of Firefox’s security features may offer less protection on your current operating system”.
The sandbox in Firefox makes use of unprivileged user namespaces when creating new processes for enforcing more security. This can be considered a security risk, therefore some Linux distributions have started to restrict its usage and only allow it to work where there is an AppArmor profile.
Such profiles can only cover a limited set of installations paths, including Snap and Debian packages. They cannot however cover some other use cases, such as tarball installations as well as local development builds.
To create an AppArmor profile for Firefox:
In <code>'''/etc/apparmor.d/'''</code>, create a file with the name <code>'''firefox-local'''</code>
in the file, add the following:
<code>'''# This profile allows everything and only exists to give the'''</code>
<code>'''# application a name instead of having the label "unconfined"'''</code>
<code>'''abi <abi/4.0>,'''</code>
<code>'''include <tunables/global>'''</code>
<code>'''profile firefox-local'''</code>
<code>'''/home/<USER>/bin/firefox/{firefox,firefox-bin,updater}'''</code>
<code>'''flags=(unconfined) {'''</code>
:<code>'''userns,'''</code>
:<code>'''# Site-specific additions and overrides. See local/README for details.'''</code>
:<code>'''include if exists <local/firefox>'''</code>
<code>'''}'''</code>
Replace <code>'''<USER>'''</code> with your Linux user name
This assumes the Firefox install is at <code>'''$HOME/bin/'''</code>
Once you have saved the file, run <code>'''sudo systemctl restart apparmor.service'''</code> in the Linux terminal.
Many Linux distributions come with Firefox pre-installed through their package manager and set as the default browser. However, if you need to install Firefox on Linux using a different method, the following guide will show you various alternative ways to download and install Firefox on Linux.
{for mac,win}{note}'''This article only applies to Linux.''' {for mac}For instructions to install Firefox on Mac, see [[How to download and install Firefox on Mac]].{/for}{for win}For instructions to install Firefox on Windows, see [[Installing Firefox on Windows]].{/for}{/note}{/for}
__TOC__
=Install Firefox .deb package for Debian-based distributions (Recommended)=
To install the <code>'''.deb'''</code> package through the APT repository, do the following:
#Add the Mozilla repository to your APT sources:
#;<code>'''printf 'Types: deb\nURIs: https://packages.mozilla<!-- -->.org/apt\nSuites: mozilla\nComponents: main\nSigned-By:%s\n' "$(wget -qO- https://packages.mozilla<!-- -->.org/apt/repo-signing-key.gpg | sed -e 's/^$/./' -e 's/^/ /')" | sudo tee /etc/apt/sources.list.d/mozilla.sources > /dev/null'''</code>
#;If you do not have <code>'''wget'''</code> installed, you can install it with: <code>'''sudo apt-get install wget'''</code>
#The fingerprint should be '''35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3'''.<!-- Please check with the Release Engineering team (release@mozilla.com) before changing/removing this fingerprint --> You may check it with the following command:
#;<code>'''awk '/BEGIN PGP/,/END PGP/' < /etc/apt/sources.list.d/mozilla.sources | sed -e 's/^[^ ]* \+//' -e 's/^\.$//' | gpg -n -q --import --import-options import-show - | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}''''</code>
#Configure APT to prioritize packages from the Mozilla repository:
#;<code>'''printf '\nPackage: *\nPin: origin packages.mozilla<!-- -->.org\nPin-Priority: 1000\n\n' | sudo tee /etc/apt/preferences.d/mozilla'''</code>
#Update your package list and install the Firefox .deb package:
#;<code>'''sudo apt-get update && sudo apt-get install firefox'''</code>
==Set up different languages in Firefox with .deb files==
For those of you who would like to use Firefox in a different language than American English, we have also created <code>'''.deb'''</code> packages containing the Firefox language packs. To install a specific language pack, replace fr in the example below with the desired language code:
;<code>'''sudo apt-get install firefox-l10n-fr'''</code>
To list all the available language packs, you can use this command after adding the Mozilla APT repository and running <code>sudo apt-get update</code>:
;<code>'''apt-cache search firefox-l10n'''</code>
==Data migration==
If you were using Snap or Flatpak before, you are required to import your profile. There are two ways to do this. You can use either of these methods:
* '''Method 1:''' Set up Sync. See [[How do I set up Sync on my computer?]] for instructions.
* '''Method 2:''' Copy the existing files on your computer. Make sure that all copies of Firefox on your computer are completely closed before doing this:
**Flatpak:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/.var/app/org.mozilla.firefox/.mozilla/firefox/* ~/.mozilla/firefox/'''</code>
**Snap:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/snap/firefox/common/.mozilla/firefox/* ~/.mozilla/firefox/'''</code>
In both cases, once you’ve moved the profiles, launch Firefox from the terminal with the command '''<code>firefox -P</code>'''. Select your desired profile. After this initial setup, the '''<code>-P</code>''' command will no longer be necessary.
= Install from your distribution package manager =
To install Firefox using your distribution package manager, please refer to your Linux distribution's documentation.
This method is recommended because it ensures Firefox and all the required libraries are installed and configured optimally for your distribution. However, there may be a small delay between the official release of a new version of Firefox and the moment when your distribution updates the version it distributes. Your distribution may also distribute it without the Firefox branding, or only distribute the ESR version.
= Install from Flatpak =
To install Firefox from Flatpak, [https://flatpak.org/setup/ install and configure Flatpak] on your computer. Once Flatpak is installed, go to the [https://flathub.org/apps/details/org.mozilla.firefox Firefox Flathub's page] and click the {button Install} button. Alternatively, you can type the following command in a terminal:
;<code>'''flatpak install flathub org.mozilla.firefox'''</code>
By default, Flatpak installs Firefox in the same locale as your operating system. To use a different language, please follow the instructions on [[Use Firefox in another language|how to use Firefox in another language]].
= Install from Snap =
To install Firefox from Snap, [https://snapcraft.io/docs/installing-snapd install Snap] on your computer. Once Snap is installed, go to the [https://snapcraft.io/firefox Firefox Snapcraft's Store page], click the {button Install} button and follow the instructions. Alternatively, you can type the following command in a terminal:
;<code>'''sudo snap install firefox'''</code>
If available, Snap installs Firefox in the same locale as your operating system. To use a different language, please follow the instructions on [[Use Firefox in another language|how to use Firefox in another language]].
= Install Firefox from Mozilla builds =
Before you install Firefox from a Mozilla build, make sure that your computer has the ''' [http://www.mozilla.org/firefox/system-requirements.html#gnulinux required libraries]''' installed. Missing or incompatible libraries may cause Firefox to be inoperable.
== System Firefox installation (for advanced users) ==
{note}
To install Firefox with this method, you '''must be''' able to log in as root or execute <code>'''sudo'''</code> commands.
This installation will have priority over the Firefox version installed through your package manager. To run the version installed with your package manager, you will need to execute the binary from a terminal. To do so in most distributions, open a terminal and type:<br><code>'''/usr/bin/firefox'''</code>
{/note}
<!--
Auto-list doesn't work with a newline character in front of a <code> block. This means we need to manually
set the list number
-->
# Go to the [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox download page] and click the {button Download Now} button.
# Open a terminal and go to the folder where your download has been saved. For example:
#; <code>'''cd ~/Downloads'''</code>
#; Extract the contents of the downloaded file by typing:
#; <code>'''tar xjf firefox-*.tar.bz2'''</code>
#; <br>''The following commands must be executed as root, or preceded by <code>'''sudo'''</code>.''
# Move the uncompressed Firefox folder to {filepath /opt}:
#; <code>'''mv firefox /opt'''</code>
# Create a symlink to the Firefox executable:
#; <code>'''ln -s /opt/firefox/firefox /usr/local/bin/firefox'''</code>
# Download a copy of the desktop file:
#; <code>'''wget https://raw.githubusercontent<!-- -->.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop -P /usr/local/share/applications'''</code>
Alternatively, if <code>'''wget'''</code> is not installed on your computer, go to the URL mentioned above, right-click on the page to open the contextual menu and select {menu Save Page As}. After you downloaded the file, move it to {filepath /usr/local/share/applications}.
To verify that the installation was successful, you can open the [[Use the Troubleshooting Information page to help fix Firefox issues|Troubleshooting Information]] page. In the ''Application Basics'' section, the value of the line ''Application Binary'' should be '''/opt/firefox/firefox-bin'''.
== Local Firefox installation in user's account ==
{note}If you don't have access to login as root or execute <code>'''sudo'''</code> commands, or just prefer to use a local Firefox in your account, you can make a local installation. You can also do this to have multiple Firefox installations for different builds.{/note}
# Go to the [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox download page] and click the {button Download Now} button.
#* You can also click the '''Download a different platform or language''' link below that button to choose another build: Nightly, Beta, Developer, or ESR.
# Open a terminal and go to the folder where your download has been saved. For example:
#; <code>'''cd ~/Downloads'''</code>
# Extract the downloaded file contents. This will create a folder named {filepath firefox}. After that, you can delete the archive:
#; <code>'''tar xjf firefox-*.tar.bz2<br>rm firefox-*.tar.bz2'''</code>
# If you downloaded a specific build, you may want to rename the uncompressed folder accordingly. For example:
#; <code>'''mv firefox firefox-nightly'''</code>
# You can leave the uncompressed folder into your download folder, or move it to another place in your account. For example:
#; <code>'''mv firefox ~/firefox'''</code>
# Firefox is now ready to be used. You can run it directly from the terminal:
#; <code>'''~/firefox/firefox &'''</code>
# Create a desktop shortcut. (It may be different in your Linux distribution.)
#* Right-click on the desktop and choose '''Create launcher''' from the context menu.
#* You can also type this on the terminal:
#*; <code>'''ln -s ~/firefox/firefox ~/Desktop/'''</code>
#* An icon for the desktop shortcut will be found in <code>'''~/firefox/browser/chrome/icons/default/'''</code>
{note}'''Note:''' This method doesn't change file types binding on the system, so links from other applications will not open in the local installation. You will need to copy the link and paste in the Firefox address bar.{/note}
=Security features warning=
You may see a warning that “some of Firefox’s security features may offer less protection on your current operating system”.
The sandbox in Firefox makes use of unprivileged user namespaces when creating new processes for enforcing more security. This can be considered a security risk, therefore some Linux distributions have started to restrict its usage and only allow it to work where there is an AppArmor profile.
Such profiles can only cover a limited set of installations paths, including Snap and Debian packages. They cannot however cover some other use cases, such as tarball installations as well as local development builds.
To create an AppArmor profile for Firefox:
In <code>'''/etc/apparmor.d/'''</code>, create a file with the name <code>'''firefox-local'''</code>
in the file, add the following:
<code>'''# This profile allows everything and only exists to give the'''</code>
<code>'''# application a name instead of having the label "unconfined"'''</code>
<code>'''abi <abi/4.0>,'''</code>
<code>'''include <tunables/global>'''</code>
<code>'''profile firefox-local'''</code>
<code>'''/home/<USER>/bin/firefox/{firefox,firefox-bin,updater}'''</code>
<code>'''flags=(unconfined) {'''</code>
:<code>'''userns,'''</code>
:<code>'''# Site-specific additions and overrides. See local/README for details.'''</code>
:<code>'''include if exists <local/firefox>'''</code>
<code>'''}'''</code>
Replace <code>'''<USER>'''</code> with your Linux user name
This assumes the Firefox install is at <code>'''$HOME/bin/'''</code>
Once you have saved the file, run <code>'''sudo systemctl restart apparmor.service'''</code> in the Linux terminal.