1. 程式人生 > >yum與apt-get的區別以及兩者更新源(阿里/網易【163】)

yum與apt-get的區別以及兩者更新源(阿里/網易【163】)

一般來說著名的linux系統基本上分兩大類:

1.RedHat系列:Redhat、Centos、Fedora等

2.Debian系列:Debian、Ubuntu等

RedHat 系列

1 常見的安裝包格式 rpm包,安裝rpm包的命令是“rpm -引數”

2 包管理工具 yum

3 支援tar

Debian系列

1 常見的安裝包格式 deb包,安裝deb包的命令是“dpkg -引數”

2 包管理工具 apt-get

3 支援tar

apt-get更新源

在使用apt-get update的時候,出現如下錯誤時:

E: Some index files failed to download, they havebeen ignored, or old ones used instead.

可以將目錄下/var/lib/apt/lists/partial/所有的檔案清掉,再次執行apt-get update即可!

1、複製原檔案備份

sudo cp /etc/apt/source.list/etc/apt/source.list.bak

2、編輯源列表檔案

sudo vim /etc/apt/source.list

3、將原來的列表刪除,新增如下內容

阿里

deb http://mirrors.aliyun.com/ubuntu/ vivid mainrestricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universemultiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universemultiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universemultiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universemultiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universemultiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security main restricteduniverse multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricteduniverse multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricteduniverse multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricteduniverse multiverse

網易

deb http://mirrors.163.com/ubuntu/lucid main universe restricted multiverse
deb-src
http://mirrors.163.com/ubuntu/lucid main universe restricted multiverse
deb
http://mirrors.163.com/ubuntu/lucid-security universe main multiverse restricted
deb-src
http://mirrors.163.com/ubuntu/lucid-security universe main multiverse restricted
deb

http://mirrors.163.com/ubuntu/lucid-updates universe main multiverse restricted
deb
http://mirrors.163.com/ubuntu/lucid-proposed universe main multiverse restricted
deb-src
http://mirrors.163.com/ubuntu/lucid-proposed universe main multiverse restricted
deb
http://mirrors.163.com/ubuntu/lucid-backports universe main multiverse restricted
deb-src
http://mirrors.163.com/ubuntu/lucid-backports universe main multiverse restricted
deb-src
http://mirrors.163.com/ubuntu/lucid-updates universe main multiverse restricted

4、執行sudo apt-get update

5、執行sudo apt-get upgrade

yum更新源

1、複製原檔案備份

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

2、下載新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

CentOS 6

CentOS 7

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

3、之後執行yum makecache生成快取