Ubuntu16 04更換成國內源

2021-09-12 15:36:00 字數 3304 閱讀 9875

複製本地源到另乙個檔案

更換源更新源

shell指令碼

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
用vim開啟sources.list檔案,將裡面的內容換成下面。

deb  xenial main

deb-src xenial main

deb xenial-updates main

deb-src xenial-updates main

deb xenial universe

deb-src xenial universe

deb xenial-updates universe

deb-src xenial-updates universe

deb xenial-security main

deb-src xenial-security main

deb xenial-security universe

deb-src xenial-security universe

更新軟體包列表

sudo apt-get update
休復損壞的軟體包,嘗試解除安裝出錯的包,重新安裝正確版本的。

sudo apt-get -f install
公升級系統中的所有軟體包

sudo apt-get upgrade
在當前家目錄下,將要使用的源儲存在sources.list檔案中。

# 更換國內源(使用的是阿里的源)

#sourcesfile=/etc/apt/sources.list.old

#if [ ! -e "$sourcesfile" ]; then

# echo 'backups sources.list'

# sudo cp /etc/apt/sources.list /etc/apt/sources.list.old

# sudo cp $home/sources.list /etc/apt/sources.list

#fi# 軟體更新

sudo apt -y update # 更新源

sudo dpkg --configure -a

sudo apt -y upgrade # 更新已安裝的包

sudo apt -y dist-upgrade # 公升級系統

# 注意以上安裝過程**現的安裝選項,直接回車或者選擇yes即可

sudo apt-get -y autoremove

sudo apt -y autoclean

西電源(只有校內網網線使用,但是不限制流量,還是十分靠譜的)

deb  xenial main restricted universe multiverse

#deb-src xenial main restricted universe multiverse

deb xenial-security main restricted universe multiverse

#deb-src xenial-security main restricted universe multiverse

deb xenial-updates main restricted universe multiverse

#deb-src xenial-updates main restricted universe multiverse

#deb xenial-backports main restricted universe multiverse

#deb-src xenial-backports main restricted universe multiverse

#deb xenial-proposed main restricted universe multiverse

#deb-src xenial-proposed main restricted universe multiverse

清華源

deb  xenial main restricted universe multiverse

# deb-src xenial main restricted universe multiverse

deb xenial-updates main restricted universe multiverse

# deb-src xenial-updates main restricted universe multiverse

deb xenial-backports main restricted universe multiverse

# deb-src xenial-backports main restricted universe multiverse

deb xenial-security main restricted universe multiverse

# deb-src xenial-security main restricted universe multiverse

網易源

deb  wily main restricted universe multiverse

deb wily-security main restricted universe multiverse

deb wily-updates main restricted universe multiverse

deb wily-proposed main restricted universe multiverse

deb wily-backports main restricted universe multiverse

deb-src wily main restricted universe multiverse

deb-src wily-security main restricted universe multiverse

deb-src wily-updates main restricted universe multiverse

deb-src wily-proposed main restricted universe multiverse

deb-src wily-backports main restricted universe multiverse

參考於

Ubuntu16 04更換國內源

1 前言 在ubuntu系統上使用 apt get install 進行軟體安裝更新的時候,由於使用的源是國外的,網路速度非常緩慢,本文記錄在ubuntu系統上進行更換國內源。2 ubuntu換源 首先需要將原始的原始檔進行備份,命令列如下 sudo cp etc apt sources.list ...

Ubuntu 16 04 更換源 映象

ubuntu 16.04 更換源 映象 具體步驟如下 cd mkdir pip sudo vim pip pip.conf然後儲存以下資訊 這裡主要使用的是阿里的雲 global index url install trusted host mirrors.aliyun.com你也可以使用其他的雲 ...

ubuntu16 04更換清華源

找到映象源的存放檔案,並備份 cd etc apt sudo cp sources.list sources.list.bak sudo vim sources.list將下面內容覆蓋掉原檔案內容 預設注釋了原始碼映象以提高 apt update 速度,如有需要可自行取消注釋 deb xenial ...