本文介绍的方法是在Linux操作系统下使用脚本的方式来安装Mozilla Firefox浏览器,由于是通过脚本设置Firefox的,所以需要手动进行卸载,以下提供详细的操作方法。
下载Firefox DL安装程序
下面我们开始安装Mozilla Firefox,将使用“Firefox DL and install”脚本,因为它允许任何人自动安装浏览器并进行更新。
该脚本是一个简单的工具,请打开系统终端,然后使用wget下载工具从开发人员的GitHub存储库中获取它:
wget https://raw.githubusercontent.com/arnaudbey/firefox-dl-n-install/master/firefox_dl_n_install.sh
要是不能用wget,请使用git工具code代码:
git clone https://github.com/arnaudbey/firefox-dl-n-install.git
将脚本下载到Linux PC后,你需要更新脚本的权限,请使用chmod命令:
sudo chmod +x firefox_dl_n_install.sh
或者,对于GitHub版本,请执行以下操作:
sudo chmod +x ~/firefox-dl-n-install/firefox_dl_n_install.sh
使用DL安装程序安装Firefox
Firefox安装脚本不是完全自动的,没有用户输入也不会做任何事情,首先,转到终端并使用sh命令执行脚本:
sh firefox_dl_n_install.sh
或者:
sh ~/firefox-dl-n-install/firefox_dl_n_install.sh
脚本运行后,你将在屏幕上看到提示,在此提示中,将看到几个版本的Mozilla Firefox可供选择,这些版本包括Firefox Stable、Firefox Beta、Firefox Aurora和Firefox Nightly:
在终端中输入一个数字以进行选择,很快该工具将开始从Mozilla的网站下载Firefox浏览器并安装浏览器:
脚本运行完毕后,通过输入exit命令关闭终端窗口。
注意:如果需要更新Firefox,重新运行脚本并选择相同的版本,它会覆盖所有内容,并将你带到最新版本中。
通过按Alt+F2然后在命令框中输入“firefox”,在Linux PC上启动新安装的Firefox浏览器。
创建桌面快捷方式
Firefox安装脚本抓取源代码并将所有文件放在正确的位置,但它不会创建桌面快捷方式。
要创建新的桌面快捷方式,请执行以下操作:
第1步:创建一个新的桌面文件:
sudo touch /usr/share/applications/firefox.desktop
第2步:在Nano中打开firefox.desktop文件:
sudo nano -w /usr/share/applications/firefox.desktop
第3步:将代码粘贴到文本编辑器中
请注意,如果你选择Firefox Stable以外的,则必须将下面快捷代码中的每个“Exec=”实例更改为你的Firefox版本,它看起来像firefox-release:
[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer;
Exec=/usr/local/bin/firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml; application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http; x-scheme-handler/https;x-scheme-handler/ftp; x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true
Actions=new-window;new-private-window;
[Desktop Action new-window]
Name=Open a New Window
Exec=/usr/local/bin/firefox -new-window
[Desktop Action new-private-window]
Name=Open a New Private Window
Exec=/usr/local/bin/firefox -private-window
第4步:使用Ctrl+O保存代码,然后使用Ctrl+X退出Nano
第5步:更新firefox.desktop文件权限:
sudo chmod +x /usr/share/applications/firefox.desktop
随着权限的更新,Mozilla Firefox都能随时可用,要启动它,请检查应用启动器的“Internet”选项。(注:如果无效请把第3步文件MimeType=中涉及的三处空格去掉,比如application/rss+xml; application/rdf+xml;改成application/rss+xml;application/rdf+xml;)
卸载Firefox的方法
如果你决定不在Linux PC上使用Firefox浏览器,那么请按下面的方法操作,因为浏览器是通过脚本设置的,所以无法通过系统的包管理器卸载,需要手动删除所有文件。
安装程序脚本将浏览器文件放在系统上的多个位置,要卸载Firefox,需要使用su命令打开一个新的终端会话并在shell中获得root访问权限:
su -
或者,如果不能使用su命令,请尝试使用sudo:
sudo -s
现在已获得root访问权限,可以进入/opt/目录:
cd /opt/
从这里,使用rm命令删除浏览器的文件和子目录:
rm -rf firefox*
删除浏览器文件后,使用cd命令移至Linux PC上的/usr/share/applications目录:
cd /usr/share/applications
rm firefox.desktop
最后,从/usr/local/bin/目录中删除二进制文件:
rm firefox*
至此,卸载Firefox浏览器完成。
相关主题