firefox装在linux_在Linux下使用脚本安装Firefox浏览器及卸载Firefox的方法
本文介紹的方法是在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瀏覽器完成。
相關主題
總結
以上是生活随笔為你收集整理的firefox装在linux_在Linux下使用脚本安装Firefox浏览器及卸载Firefox的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PS减小照片大小kb且比较清晰
- 下一篇: 苹果审核2.1大礼包