当前位置:网站首页 / Linux / 正文

linux软件源快速更换

时间:2018年12月31日 | 作者 : liuhui | 分类 : Linux | 浏览: 6574次 | 评论 0

阿里云限量代金券 | 此广告位出租25元/月

Centos换源命令

查看系统版本

CentOS
1
cat /etc/system-release

备份系统源

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

Centos-阿里云源

Centos7
1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Centos6
1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
Centos5
1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

  • 运行以下命令生成缓存

Centos
1
2
yum clean all
yum makecache

Centos-网易源

Centos7
1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
Centos6
1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
Centos5
1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo

  • 运行以下命令生成缓存

Centos
1
2
yum clean all
yum makecache

Debian换源命令

查看系统版本

Debian
1
2
cat /etc/issue
lsb_release -a

备份系统源

Debian
1
mv /etc/apt/sources.list /etc/apt/sources.list.backup

Debian-阿里云源

stretch_9
1
2
3
4
5
6
7
8
9
10
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib
EOF
Jessie_8
1
2
3
4
5
6
7
8
9
10
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ jessie/updates main non-free contrib
EOF
wheezy_7
1
2
3
4
5
6
7
8
9
10
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.aliyun.com/debian/ wheezy main non-free contrib
deb http://mirrors.aliyun.com/debian/ wheezy-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ wheezy-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ wheezy-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ wheezy-backports main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ wheezy/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ wheezy/updates main non-free contrib
EOF
squeeze_6
1
2
3
4
5
6
7
8
9
10
11
12
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.aliyun.com/debian/ squeeze main non-free contrib
deb http://mirrors.aliyun.com/debian/ squeeze-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ squeeze-lts main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ squeeze main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ squeeze-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ squeeze-lts main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ squeeze/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ squeeze/updates main non-free contrib
deb http://mirrors.aliyun.com/debian-backports/ squeeze-backports main contrib non-free
deb-src http://mirrors.aliyun.com/debian-backports/ squeeze-backports main contrib non-free
EOF

  • 运行以下命令生成缓存

Debian
1
apt-get update && apt-get upgrade -y

Debian-网易源

stretch_9
1
2
3
4
5
6
7
8
9
10
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
EOF
Jessie_8
1
2
3
4
5
6
7
8
9
10
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
EOF
wheezy_7
1
2
3
4
5
6
7
8
9
10
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.163.com/debian/ wheezy main non-free contrib
deb http://mirrors.163.com/debian/ wheezy-updates main non-free contrib
deb http://mirrors.163.com/debian/ wheezy-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ wheezy main non-free contrib
deb-src http://mirrors.163.com/debian/ wheezy-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ wheezy-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ wheezy/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ wheezy/updates main non-free contrib
EOF
squeeze_6
1
2
3
4
5
6
7
8
9
10
11
12
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.163.com/debian/ squeeze main non-free contrib
deb http://mirrors.163.com/debian/ squeeze-updates main non-free contrib
deb http://mirrors.163.com/debian/ squeeze-lts main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze-lts main non-free contrib
deb http://mirrors.163.com/debian-security/ squeeze/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ squeeze/updates main non-free contrib
deb http://mirrors.163.com/debian-backports/ squeeze-backports main contrib non-free
deb-src http://mirrors.163.com/debian-backports/ squeeze-backports main contrib non-free
EOF

  • 运行以下命令生成缓存

Debian
1
apt-get update && apt-get upgrade -y

Ubuntu换源命令

查看系统版本

Ubuntu
1
2
cat /etc/issue
lsb_release -a

备份系统源

Ubuntu
1
mv /etc/apt/sources.list /etc/apt/sources.list.backup

Ubuntu-阿里云源

Ubuntu_14.04
1
2
3
4
5
6
7
8
9
10
11
12
cat > /etc/apt/sources.list<<-EOF
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
EOF
Ubuntu_16.04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cat > /etc/apt/sources.list<<-EOF
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
EOF
Ubuntu_18.04
1
2
3
4
5
6
7
8
9
10
11
12
cat > /etc/apt/sources.list<<-EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb 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 main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF

  • 运行以下命令生成缓存

Debian
1
apt-get update && apt-get upgrade -y


推荐您阅读更多有关于“”的文章

猜你喜欢

网站分类
关注电脑博士
友情链接

分享:

支付宝

微信