下载yum源和epel源

1.进入源文件

[root@localhost ~]#cd /etc/yum.repos.d/  #进入源文件
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@localhost yum.repos.d]# mkdir repo_bak   #创建文件夹
[root@localhost yum.repos.d]# mv *.repo repo_bak/  #当前repo源移动到新建文件里
[root@localhost yum.repos.d]# ls  #查看
repo_bak 
[root@localhost yum.repos.d]#

2.下载阿里yum

[root@localhost yum.repos.d]# yum install wget #下载wget
[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost yum.repos.d]# yum clean all  #清空缓存
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum makecache #生成
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Determining fastest mirrors

3.安装epel源 

[root@localhost yum.repos.d]#  yum install -y epel-release #安装epel
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo #安装阿里云开源epel源
[root@localhost yum.repos.d]# yum clean  all #清空
[root@localhost yum.repos.d]# yum makecache  #生成
 

 4.验证

[root@localhost yum.repos.d]# yum repolist all
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
repo id                             repo name                                                               status
base/7/x86_64                       CentOS-7 - Base - 163.com                                               enabled: 10,072
centosplus/7/x86_64                 CentOS-7 - Plus - 163.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: 13,595
epel-debuginfo/x86_64               Extra Packages for Enterprise Linux 7 - x86_64 - Debug                  disabled
epel-source                         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 

5.完结-----持续更新

猜你喜欢

转载自blog.csdn.net/m0_52454621/article/details/117341654