將Ubuntu18.04的原始鏡像源更換為阿里鏡像源或清華鏡像源:
1、編輯組態檔,將原始內容洗掉或者注釋掉:
編輯之前可以對原始檔案進行備份,使用如下命令:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
編輯檔案,命令如下:
vim /etc/apt/sources.list
2、將下面內容粘貼進去(以下是阿里的鏡像源)
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
如果要更換為清華的鏡像源,則進入網址,選擇Ubuntu對應版本的鏡像內容:
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
阿里鏡像源網址如下:
https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11WMFViZ
注意:一定要選擇與你的Ubuntu版本對應的鏡像,我這里是18.04版本
3、更新源
apt-get update
常見相關命令
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 source package 下載該包的源代碼
sudo apt-get clean && sudo apt-get autoclean 清理無用的包
sudo apt-get check 檢查是否有損壞的依賴
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/263375.html
標籤:其他
