Linux系统之Centos安装epel源

举报
江湖有缘 发表于 2023/02/01 15:18:23 2023/02/01
【摘要】 Linux系统之Centos安装epel源

一、检查本地系统环境

1.检查系统版本

[root@jeven ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"


2.检查系统内核版本

[root@jeven ~]# uname -r
6.1.8-1.el7.elrepo.x86_64


二、检查yum仓库

1.查看repo文件

进入/etc/yum.repos.d目录下,查看系统所有的repo文件

[root@jeven yum.repos.d]# ll
total 12
-rw-r--r--. 1 root root 1759 Jan 28 21:02 CentOS-Base.repo
-rw-r--r--. 1 root root 2081 Jul 26  2022 docker-ce.repo
-rw-r--r--. 1 root root 1946 Jul 10  2022 elrepo.repo


2.检查yum仓库的状态

检查yum仓库的所有镜像源状态


[root@jeven yum.repos.d]# yum repolist all |grep enable
!base/7/x86_64                       CentOS-7 - Base - mirrors.a enabled: 10,072
!docker-ce-stable/7/x86_64           Docker CE Stable - x86_64   enabled:    198
!elrepo                              ELRepo.org Community Enterp enabled:    154
!extras/7/x86_64                     CentOS-7 - Extras - mirrors enabled:    515
!updates/7/x86_64                    CentOS-7 - Updates - mirror enabled:  4,691


三、安装epel源

1.查看系统epel-release.noarch包


[root@jeven yum.repos.d]# yum list all | grep epel-release.noarch
epel-release.noarch                      7-14                          epel

2.yum直接安装

可直接安装epel-release.noarch包,配置epel源。

[root@jeven yum.repos.d]# yum install -y epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================
 Package                                     Arch                                  Version                              Repository                             Size
====================================================================================================================================================================
Installing:
 epel-release                                noarch                                7-11                                 extras                                 15 k

Transaction Summary
====================================================================================================================================================================
Install  1 Package

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

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

Complete!

3.检查epel源状态

  • 查看yum仓库的所有repo文件
[root@jeven yum.repos.d]# ll
total 20
-rw-r--r--. 1 root root 1759 Jan 28 21:02 CentOS-Base.repo
-rw-r--r--. 1 root root 2081 Jul 26  2022 docker-ce.repo
-rw-r--r--. 1 root root 1946 Jul 10  2022 elrepo.repo
-rw-r--r--. 1 root root  951 Oct  3  2017 epel.repo
-rw-r--r--. 1 root root 1050 Oct  3  2017 epel-testing.repo

  • 清理和重建yum缓存

yum -y clean all && yum makecache
  • 查看yum仓库状态
[root@jeven yum.repos.d]# yum repolist all |grep enable
base/7/x86_64                        CentOS-7 - Base - mirrors.a enabled: 10,072
docker-ce-stable/7/x86_64            Docker CE Stable - x86_64   enabled:    199
elrepo                               ELRepo.org Community Enterp enabled:    155
epel/x86_64                          Extra Packages for Enterpri enabled: 13,740
extras/7/x86_64                      CentOS-7 - Extras - mirrors enabled:    515
updates/7/x86_64                     CentOS-7 - Updates - mirror enabled:  4,691


4.查看epel.repo文件

[root@jeven yum.repos.d]# cat epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1


四、使用第三方阿里的epel源

1.清空epel源

yum remove  -y epel-release

2.使用阿里的epel源

[root@jeven yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
--2023-02-01 15:09:07--  https://mirrors.aliyun.com/repo/epel-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 123.6.21.248, 123.6.21.240, 123.6.21.244, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|123.6.21.248|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 664 [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/epel.repo’

100%[==========================================================================================================================>] 664         --.-K/s   in 0.007s  

2023-02-01 15:09:07 (90.0 KB/s) - ‘/etc/yum.repos.d/epel.repo’ saved [664/664]


3.查看epel源状态

[root@jeven yum.repos.d]# yum repolist all |grep epel
epel/x86_64                          Extra Packages for Enterpri enabled: 13,740
epel-debuginfo/x86_64                Extra Packages for Enterpri disabled
epel-source                          Extra Packages for Enterpri disabled


4.查看epel.repo文件

[root@jeven yum.repos.d]# cat epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
 
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
 
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.aliyun.com/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
[root@jeven yu

五、安装links工具

1.在epel仓库中安装links工具

[root@jeven yum.repos.d]# yum -y install links
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package links.x86_64 1:2.20.2-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================
 Package                              Arch                                  Version                                       Repository                           Size
====================================================================================================================================================================
Installing:
 links                                x86_64                                1:2.20.2-1.el7                                epel                                2.9 M

Transaction Summary
====================================================================================================================================================================
Install  1 Package

Total download size: 2.9 M
Installed size: 4.4 M
Downloading packages:
links-2.20.2-1.el7.x86_64.rpm                                                                                                                | 2.9 MB  00:00:28     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:links-2.20.2-1.el7.x86_64                                                                                                                      1/1 
  Verifying  : 1:links-2.20.2-1.el7.x86_64                                                                                                                      1/1 

Installed:
  links.x86_64 1:2.20.2-1.el7                                                                                                                                       

Complete!


2.使用links

inks -dump  https://www.baidu.com/

[root@jeven yum.repos.d]# links -dump  https://mirrors.aliyun.com/centos/
   Link: canonical
   [IMG]
   开源镜像站
   免费体验Linux沙箱实验室 全部镜像 域名解析DNS 网站授时NTP 反馈与建议
   阿里云镜像站> centos镜像配置页> centos镜像下载页> 详细内容

                               Index of /centos/

   File Name                     File Size Date             
   Parent directory/             -         -                
   2/                            -         2010-05-07 01:48 
   2.1/                          -         2009-09-09 13:18 
   3/                            -         2010-05-07 01:48 
   3.1/                          -         2010-05-07 01:48 
   3.3/                          -         2010-05-07 01:48 
   3.4/                          -         2010-05-07 01:48 
   3.5/                          -         2010-05-07 01:48 
   3.6/                          -         2010-05-07 01:48 
   3.7/                          -         2010-05-07 01:48 
   3.8/                          -         2010-05-07 01:48 
   3.9/                          -         2011-03-03 07:44 
   4/                            -         2012-03-13 08:24 
   4.0/                          -         2005-07-19 05:11 
   4.1/                          -         2005-10-22 01:54 
   4.2/                          -         2006-11-04 20:43 
   4.3/                          -         2006-11-11 06:15 
   4.4/                          -         2007-07-08 02:21 
   4.5/                          -         2008-01-11 00:12 
   4.6/                          -         2009-03-31 19:55 
   4.7/                          -         2010-03-08 18:56 
   4.8/                          -         2012-03-13 08:14 
   4.9/                          -         2017-04-03 19:34 
   5/                            -         2017-04-03 19:35 
   5.0/                          -         2014-10-16 21:37 
   5.1/                          -         2014-10-16 21:37 
   5.10/                         -         2017-04-03 19:30 
   5.11/                         -         2017-04-03 19:34 
   5.2/                          -         2014-10-16 21:37 
   5.3/                          -         2014-10-16 21:37 
   5.4/                          -         2014-10-16 21:37 
   5.5/                          -         2014-10-16 21:37 
   5.6/                          -         2014-10-16 21:37 
   5.7/                          -         2014-10-16 21:37 
   5.8/                          -         2014-10-16 21:37 
   5.9/                          -         2014-10-16 21:38 
   6/                            -         2018-07-04 01:21 
   6.0/                          -         2014-10-16 21:42 
   6.1/                          -         2014-10-16 21:42 
   6.10/                         -         2020-12-02 17:00 
   6.2/                          -         2014-10-16 21:42 
   6.3/                          -         2014-10-16 21:42 
   6.4/                          -         2014-10-16 21:42 
   6.5/                          -         2015-01-05 22:33 
   6.6/                          -         2015-08-12 20:23 
   6.7/                          -         2016-06-02 00:09 
   6.8/                          -         2017-06-12 20:38 
   6.9/                          -         2018-07-25 23:42 
   7/                            -         2020-11-12 20:29 
   7.0.1406/                     -         2015-04-07 22:24 
   7.1.1503/                     -         2016-01-08 23:25 
   7.2.1511/                     -         2017-01-28 22:29 
   7.3.1611/                     -         2017-10-25 22:57 
   7.4.1708/                     -         2018-05-24 21:25 
   7.5.1804/                     -         2019-01-05 00:00 
   7.6.1810/                     -         2019-09-25 17:47 
   7.7.1908/                     -         2020-05-05 00:25 
   7.8.2003/                     -         2020-11-17 15:28 
   7.9.2009/                     -         2021-01-18 22:12 
   8/                            -         2021-11-16 20:47 
   8-stream/                     -         2023-01-26 15:44 
   8.0.1905/                     -         2020-10-21 15:52 
   8.1.1911/                     -         2020-10-21 15:53 
   8.2.2004/                     -         2020-12-22 23:27 
   8.3.2011/                     -         2021-09-08 14:57 
   8.4.2105/                     -         2021-11-17 15:29 
   8.5.2111/                     -         2021-12-22 08:53 
   HEADER.html                   1.2 KB    2014-09-30 03:27 
   HEADER.images/                -         2013-11-07 23:21 
   RPM-GPG-KEY-CentOS-3          1.8 KB    2004-03-16 07:16 
   RPM-GPG-KEY-CentOS-4          1.8 KB    2010-05-07 01:48 
   RPM-GPG-KEY-CentOS-5          1.5 KB    2007-02-20 01:57 
   RPM-GPG-KEY-CentOS-6          1.7 KB    2011-07-10 22:28 
   RPM-GPG-KEY-CentOS-7          1.7 KB    2014-07-05 00:01 
   RPM-GPG-KEY-CentOS-Debug-6    1.7 KB    2011-07-10 22:28 
   RPM-GPG-KEY-CentOS-Debug-7    1004.0 B  2015-12-09 17:59 
   RPM-GPG-KEY-CentOS-Official   1.6 KB    2019-09-12 15:39 
   RPM-GPG-KEY-CentOS-Security-6 1.7 KB    2011-07-10 22:28 
   RPM-GPG-KEY-CentOS-Testing-6  1.7 KB    2011-07-10 22:28 
   RPM-GPG-KEY-CentOS-Testing-7  1.7 KB    2015-12-09 17:59 
   RPM-GPG-KEY-beta              1.5 KB    2007-02-20 01:56 
   RPM-GPG-KEY-centos4           1.8 KB    2005-02-27 01:51 
   TIME                          11.0 B    2023-02-01 12:55 
   build/                        -         2005-06-12 20:56 
   dir_sizes                     1.1 KB    2023-02-01 12:10 
   dostools/                     -         2007-04-04 17:45 
   filelist.gz                   7.2 MB    2023-02-01 12:10 
   graphics/                     -         2014-06-12 19:59 
   timestamp.txt                 29.0 B    2023-02-01 12:55 

   镜像源配置帮助 立即查看
   下载排行榜
   最热
   最新
   1 centos镜像源
   2 ubuntu镜像源
   3 pypi镜像源
   4 alinux镜像源
   5 epel镜像源
   6 debian镜像源
   7 fedora镜像源
   8 opensuse镜像源
   9 kali镜像源
   10 rockylinux镜像源
   1 almalinux镜像源
   2 calculate-linux镜像源
   3 blender镜像源
   4 grafana镜像源
   5 centos-debuginfo镜像源
   6 oceanbase镜像源
   7 circlelinux镜像源
   8 termux镜像源
   9 centos-stream镜像源
   10 libreoffice镜像源
   大家都在搜
   archlinux镜像源
   xbmc镜像源
   rubygems镜像源
   mariadb镜像源
   alpine镜像源
   elrepo镜像源
   pypi镜像源
   clfs镜像源
   deepin镜像源
   centos-debuginfo镜像源


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。