【Linux operation 36】Red Hat Enterprise Linux 7.6 配置国内清华大学yum源

  • Post author:
  • Post category:linux




1、官方指导说明:

https://mirrors.tuna.tsinghua.edu.cn/help/elrepo/

在这里插入图片描述



2、首先按照官网的安装说明,配置 ELRepo(即导入公钥):

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

官网地址:

https://elrepo.org/tiki/tiki-index.php

在这里插入图片描述



3、接着,按照你的系统版本下载安装elrepo.repo 文件


RHEL-6, SL-6 或者 CentOS-6:

 yum install https://www.elrepo.org/elrepo-release-6.el6.elrepo.noarch.rpm


RHEL-7, SL-7 或者 CentOS-7:

 yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm


如果是 RHEL-8 或者 CentOS-8 则运行:

yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm

此时的系统为Red Hat Enterprise Linux 7.6 ,故选择yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm,具体如下:

[root@localhost yum.repos.d]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@localhost yum.repos.d]# yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Examining /var/tmp/yum-root-SHS66x/elrepo-release-7.el7.elrepo.noarch.rpm: elrepo-release-7.0-5.el7.elrepo.noarch
Marking /var/tmp/yum-root-SHS66x/elrepo-release-7.el7.elrepo.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package elrepo-release.noarch 0:7.0-5.el7.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================== Package                                           Arch                                      Version                                             Repository                                                              Size
==============================================================================================================================================================================================================================Installing:
 elrepo-release                                    noarch                                    7.0-5.el7.elrepo                                    /elrepo-release-7.el7.elrepo.noarch                                    5.0 k

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

Total size: 5.0 k
Installed size: 5.0 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : elrepo-release-7.0-5.el7.elrepo.noarch                                                                                                                                                                     1/1 
  Verifying  : elrepo-release-7.0-5.el7.elrepo.noarch                                                                                                                                                                     1/1 

Installed:
  elrepo-release.noarch 0:7.0-5.el7.elrepo                                                                                                                                                                                    

Complete!



4、备份 /etc/yum.repos.d/elrepo.repo :

cp /etc/yum.repos.d/elrepo.repo /etc/yum.repos.d/elrepo.repo.bak



5、编辑 /etc/yum.repos.d/elrepo.repo 文件


在 mirrorlist= 开头的行前面加 # 注释掉;并将 elrepo.org/linux 替换mirrors.tuna.tsinghua.edu.cn/elrepo。

具体如下:

[root@localhost yum.repos.d]# cat elrepo.repo 
### Name: ELRepo.org Community Enterprise Linux Repository for el7
### URL: https://elrepo.org/

[elrepo]
name=ELRepo.org Community Enterprise Linux Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/elrepo/el7/$basearch/
#http://elrepo.org/linux/elrepo/el7/$basearch/
#       http://mirrors.coreix.net/elrepo/elrepo/el7/$basearch/
#       http://mirror.rackspace.com/elrepo/elrepo/el7/$basearch/
#       http://linux-mirrors.fnal.gov/linux/elrepo/elrepo/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo.el7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-testing]
name=ELRepo.org Community Enterprise Linux Testing Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/testing/el7/$basearch/
#http://elrepo.org/linux/testing/el7/$basearch/
#       http://mirrors.coreix.net/elrepo/testing/el7/$basearch/
#       http://mirror.rackspace.com/elrepo/testing/el7/$basearch/
#       http://linux-mirrors.fnal.gov/linux/elrepo/testing/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-testing.el7
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el7/$basearch/
#http://elrepo.org/linux/kernel/el7/$basearch/
#       http://mirrors.coreix.net/elrepo/kernel/el7/$basearch/
#       http://mirror.rackspace.com/elrepo/kernel/el7/$basearch/
#       http://linux-mirrors.fnal.gov/linux/elrepo/kernel/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-kernel.el7
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-extras]
name=ELRepo.org Community Enterprise Linux Extras Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/extras/el7/$basearch/
#http://elrepo.org/linux/extras/el7/$basearch/
#       http://mirrors.coreix.net/elrepo/extras/el7/$basearch/
#       http://mirror.rackspace.com/elrepo/extras/el7/$basearch/
#       http://linux-mirrors.fnal.gov/linux/elrepo/extras/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-extras.el7
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
[root@localhost yum.repos.d]# 



6、最后,更新软件包缓存

yum makecache
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
elrepo                                                                               | 3.0 kB  00:00:00     
(1/3): elrepo/x86_64/filelists_db                                                    |  40 kB  00:00:01     
(2/3): elrepo/x86_64/other_db                                                        |  32 kB  00:00:00     
(3/3): elrepo/x86_64/primary_db                                                      | 390 kB  00:00:01     
Metadata Cache Created



版权声明:本文为qq_22938603原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。