redhat7.2上搭建网易、epel的yum repo

近期从百度云盘上下载下来rhel7.2(MaiPo),之后,开始解决怎么在rhel7.2上使用非红帽官方的yum仓库,终于解决了。解决方法如下:

1、网易163的yum repo:

在/etc/yum.repos.d/下面新建163.repo:

total 8
-rw-r--r--. 1 root root 87 Aug 5 01:13 163.repo
-rw-r--r--. 1 root root 358 Aug 1 00:27 redhat.repo

[zqf@rhel7-2 yum.repos.d]$ cat 163.repo
[163]
name=163
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1

就OK了,下面安装nvme试试:

[zqf@rhel7-2 r12058]$ sudo yum -y install nvme-cli
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
163 | 3.6 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package nvme-cli.x86_64 0:0.7-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================
Installing:
nvme-cli x86_64 0.7-1.el7 163 103 k

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

Total download size: 103 k
Installed size: 172 k
Downloading packages:
nvme-cli-0.7-1.el7.x86_64.rpm | 103 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : nvme-cli-0.7-1.el7.x86_64 1/1
Verifying : nvme-cli-0.7-1.el7.x86_64 1/1

Installed:
nvme-cli.x86_64 0:0.7-1.el7

Complete!

2、epel源:

[zqf@rhel7-2 yum.repos.d]$ sudo rpm -vih http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
[sudo] password for zqf:
Retrieving http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
warning: /var/tmp/rpm-tmp.DI8Hiy: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:epel-release-7-10 ################################# [100%]

装完这个rpm包之后就自动生成了epel.repo和epel-testing.repo

[zqf@rhel7-2 yum.repos.d]$ ll
total 16
-rw-r--r--. 1 root root 87 Aug 5 01:13 163.repo
-rw-r--r--. 1 root root 951 Jun 24 11:04 epel.repo
-rw-r--r--. 1 root root 1050 Jun 24 11:04 epel-testing.repo
-rw-r--r--. 1 root root 358 Aug 1 00:27 redhat.repo

注意http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm这个链接有可能会变,因为在不断更新,比如之前几个月就是http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm

查看当前系统所有可用的yum repository:

[zqf@rhel7-2 ~]$ sudo yum repolist all
[sudo] password for zqf:
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
epel/x86_64/metalink | 4.7 kB 00:00:00
epel | 4.3 kB 00:00:00
(1/3): epel/x86_64/group_gz | 170 kB 00:00:01
(2/3): epel/x86_64/updateinfo | 807 kB 00:00:04
(3/3): epel/x86_64/primary_db | 4.8 MB 00:00:14
repo id repo name status
163 163 enabled: 9,363
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 enabled: 11,930
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
repolist: 21,293

原文地址:https://www.cnblogs.com/zengqingfu1442/p/7299329.html