Ubuntu18 04更換國內源和apt常用的命令

2021-09-11 07:00:46 字數 3495 閱讀 3032

mv /etc/apt/sources.list /etc/apt/sourses.list.backup
#163源

deb bionic main restricted universe multiverse

deb bionic-security main restricted universe multiverse

deb bionic-updates main restricted universe multiverse

deb bionic-proposed main restricted universe multiverse

deb bionic-backports main restricted universe multiverse

deb-src bionic main restricted universe multiverse

deb-src bionic-security main restricted universe multiverse

deb-src bionic-updates main restricted universe multiverse

deb-src bionic-proposed main restricted universe multiverse

deb-src bionic-backports main restricted universe multiverse

# apt update

# apt upgrade

sudo apt-get update  更新源

sudo apt-get install package 安裝包

sudo apt-get remove package 刪除包

sudo apt-cache search package 搜尋軟體包

sudo apt-cache show package 獲取包的相關資訊,如說明、大小、版本等

sudo apt-get install package --reinstall 重新安裝包

sudo apt-get -f install 修復安裝

sudo apt-get remove package --purge 刪除包,包括配置檔案等

sudo apt-get build-dep package 安裝相關的編譯環境

sudo apt-get upgrade 更新已安裝的包

sudo apt-get dist-upgrade 公升級系統

sudo apt-cache depends package 了解使用該包依賴那些包

sudo apt-cache rdepends package 檢視該包被哪些包依賴

sudo apt-get clean && sudo apt-get autoclean 清理無用的包

sudo apt-get check 檢查是否有損壞的依賴

清華源:

#中科大源

deb bionic main restricted universe multiverse

deb bionic-updates main restricted universe multiverse

deb bionic-backports main restricted universe multiverse

deb bionic-security main restricted universe multiverse

deb bionic-proposed main restricted universe multiverse

deb-src bionic main restricted universe multiverse

deb-src bionic-updates main restricted universe multiverse

deb-src bionic-backports main restricted universe multiverse

deb-src bionic-security main restricted universe multiverse

deb-src bionic-proposed main restricted universe multiverse

#阿里雲源

deb bionic main restricted universe multiverse

deb bionic-security main restricted universe multiverse

deb bionic-updates main restricted universe multiverse

deb bionic-proposed main restricted universe multiverse

deb bionic-backports main restricted universe multiverse

deb-src bionic main restricted universe multiverse

deb-src bionic-security main restricted universe multiverse

deb-src bionic-updates main restricted universe multiverse

deb-src bionic-proposed main restricted universe multiverse

deb-src bionic-backports main restricted universe multiverse

#清華源

deb bionic main restricted universe multiverse

deb bionic-updates main restricted universe multiverse

deb bionic-backports main restricted universe multiverse

deb bionic-security main restricted universe multiverse

deb bionic-proposed main restricted universe multiverse

deb-src bionic main restricted universe multiverse

deb-src bionic-updates main restricted universe multiverse

deb-src bionic-backports main restricted universe multiverse

deb-src bionic-security main restricted universe multiverse

deb-src bionic-proposed main restricted universe multiverse

Ubuntu18 04更換國內源

sudo cp etc apt sources.list etc apt sourses.list.backup 163源 deb bionic main restricted universe multiverse deb bionic security main restricted unive...

Ubuntu18 04 更換 國內源

1.進入root模式sudo s 2.進入ubuntu源的目錄cd etc apt 3.備份sources.listcp sources.listsources.list.bak 4.修改sources.list 刪除sources.list中的內容,把阿里雲的源複製進source.list中 ge...

Ubuntu18 04更換國內源

mv etc apt sources.list etc apt sourses.list.backup 163源 deb bionic main restricted universe multiverse deb bionic security main restricted universe m...