1. 程式人生 > >CentOS 和 Ubuntu 更新源

CentOS 和 Ubuntu 更新源

yum,是Yellow dog Updater, Modified 的簡稱,是杜克大學為了提高RPM 軟體包安裝性而開發的一種軟體包管理器。起初是由yellow dog 這一發行版的開發者Terra Soft 研發,用Python 寫成,那時還叫做yup(yellow dog updater),後經杜克大學的[email protected] 開發團隊進行改進,遂有此名。yum 的宗旨是自動化地升級,安裝/移除rpm 包,收集rpm 包的相關資訊,檢查依賴性並自動提示使用者解決。yum 的關鍵之處是要有可靠的repository,顧名思義,這是軟體的倉庫,它可以是http 或ftp 站點,也可以是本地軟體池,但必須包含rpm 的header,header 包括了rpm 包的各種資訊,包括描述,功能,提供的檔案,依賴性等。正是收集了這些header 並加以分析,才能自動化地完成餘下的任務。

  yum 的理念是使用一箇中心倉庫(repository)管理一部分甚至一個distribution 的應用程式相互關係,根據計算出來的軟體依賴關係進行相關的升級、安裝、刪除等等操作,減少了Linux 使用者一直頭痛的dependencies 的問題。這一點上,yum 和apt 相同。apt 原為debian 的deb 型別軟體管理所使用,但是現在也能用到RedHat 門下的rpm 了。

  yum 主要功能是更方便的新增/刪除/更新RPM 包,自動解決包的倚賴性問題,便於管理大量系統的更新問題。

  yum 可以同時配置多個資源庫(Repository),簡潔的配置檔案(/etc/yum.conf),自動解決增加或刪除rpm 包時遇到的依賴性問題,保持與RPM 資料庫的一致性。

安裝完CentOS後,為避免從國外站點安裝更新速度過慢,需要更改yum更新源,所以從網上找了下更改linux yum源的方法,
和大家進行下分享。原理很簡單,就是把yum配置檔案中的更新源改一下,這裡直接用163的映象站點中的配置檔案。

CentOS更換163源

1.進入yum配置檔案目錄

cd /etc/yum.repos.d/

2.備份配置檔案

mv CentOS-Base.repo CentOS-Base.repo.bak

3.下載163的配置

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

下載下來的檔名為 CentOS6-Base-163.repo

4.改名

mv CentOS6-Base-163.repo CentOS-Base.repo

5.更新資料庫

yum update

CentOS更換ali源

1.備份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下載ali源

CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

3.更新

yum clean all
yum makecache

Ubuntu更換源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo gedit /etc/apt/sources.list
sudo apt-get update

sources.list

deb http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse