CentOS7配置阿里云yum源和EPEL源

配置阿里云yum源(参考:http://mirrors.aliyun.com/help/centos)

1、备份

[root@bogon ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# mkdir repo_bak
[root@bogon yum.repos.d]# mv *.repo repo_bak/
[root@bogon yum.repos.d]# ls
repo_bak

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

复制代码

[root@bogon yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
–2018-02-09 16:33:46-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)… 124.14.2.234, 124.14.2.235, 124.14.2.217, …
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.14.2.234|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 2573 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[========================================================================================>] 2,573 --.-K/s in 0s

2018-02-09 16:33:47 (182 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2573/2573]

[root@bogon yum.repos.d]# ls
CentOS-Base.repo repo_bak

复制代码

3、之后运行yum clean all 清除缓存,运行 yum makecache 生成新的缓存
复制代码

[root@bogon yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@bogon yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/12): base/7/x86_64/group_gz | 156 kB 00:00:00
(2/12): extras/7/x86_64/filelists_db | 636 kB 00:00:07
(3/12): extras/7/x86_64/primary_db | 166 kB 00:00:02

复制代码

安装EPEL(Extra Packages for Enterprise Linux )源

4、安装EPEL源
复制代码

[root@bogon yum.repos.d]# yum list | grep epel-release
epel-release.noarch 7-9 extras
[root@bogon yum.repos.d]# yum install -y epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    Resolving Dependencies
    –> Running transaction check
    —> Package epel-release.noarch 0:7-9 will be installed
    –> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
Package Arch Version Repository Size

Installing:
epel-release noarch 7-9 extras 14 k

Transaction Summary

Install 1 Package

Total download size: 14 k
Installed size: 24 k
Downloading packages:
epel-release-7-9.noarch.rpm | 14 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-9.noarch 1/1
Verifying : epel-release-7-9.noarch 1/1

Installed:
epel-release.noarch 0:7-9

Complete!
[root@bogon yum.repos.d]# ls #多了epel.repo和epel-testing.repo
CentOS-Base.repo epel.repo epel-testing.repo repo_bak

复制代码

5、再次运行yum clean all 清除缓存,运行 yum makecache 生成新的缓存

6、查看启用的yum源和所有的yum源
复制代码

[root@bogon yum.repos.d]# yum repolist enabled #查看启用的仓库
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • epel: mirrors.ustc.edu.cn
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    repo id repo name status
    base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,591
    epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 12,277
    extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 388
    updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,929
    repolist: 24,185
    [root@bogon yum.repos.d]# yum repolist all #查看所有的仓库
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
  • base: mirrors.aliyun.com
  • epel: mirrors.ustc.edu.cn
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    repo id repo name status
    base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com enabled: 9,591
    centosplus/7/x86_64 CentOS-7 - Plus - mirrors.aliyun.com disabled
    contrib/7/x86_64 CentOS-7 - Contrib - mirrors.aliyun.com disabled
    epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 enabled: 12,277
    epel-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Debug disabled
    epel-source/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Source disabled
    epel-testing/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 disabled
    epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug disabled
    epel-testing-source/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source disabled
    extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com enabled: 388
    updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com enabled: 1,929
    repolist: 24,185
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值