Enable EPEL and Local Repository on RHEL8
一、配置RHEL8 使用 EPEL Repository
1. Installing the configuration package
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
2. To see where those files have been installed, we can run the following command:
$ sudo rpm -ql epel-release
3. To verify that the EPEL repository has been enabled we can run:
$ sudo dnf repolist -v
4. List the packages contained in the EPEL8 repository.
$ sudo dnf repository-packages epel list
5. Disable subscription-manager plugin.
[root@rusking ~]# cat /etc/yum/pluginconf.d/subscription-manager.conf [main] enabled=0 # When following option is set to 1, then all repositories defined outside redhat.repo will be disabled # every time subscription-manager plugin is triggered by dnf or yum disable_system_repos=0
二、配置RHEL8使用Local Repository
How to Setup Local Yum/DNF Repository on RHEL 8 Server Using DVD or ISO File.
1. Mount RHEL 8 ISO file / Installation DVD
Copy RHEL 8 ISO file inside your system.
将ISO或安装盘中的内容拷贝到某一指定目录。本次测试,拷贝到/opt/RHEL82目录
[root@rusking ~]# ls /opt/RHEL82/ AppStream EULA images RPM-GPG-KEY-redhat-beta TRANS.TBL BaseOS extra_files.json isolinux RPM-GPG-KEY-redhat-release EFI GPL media.repo 'System Volume Information'
2. 修改repo配置文件及权限
[root@rusking RHEL82]# cp media.repo /etc/yum.repos.d/rhel8.repo
#chmod 644 /etc/yum.repos.d/rhel8.repo
# cat /etc/yum.repos.d/rhel8.repo
# cat /etc/yum.repos.d/rhel8.repo [InstallMedia-BaseOS] name=Red Hat Enterprise Linux 8.2.0-BaseOS metadata_expire=-1 gpgcheck=1 enabled=1 baseurl=file:///opt/RHEL82/BaseOS/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [InstallMedia-AppStream] name=Red Hat Enterprise Linux 8 - AppStream metadata_expire=-1 gpgcheck=1 enabled=1 baseurl=file:///opt/RHEL82/AppStream/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
3. 测试
# dnf clean all
# dnf repolist
[root@rusking ~]# dnf repolist repo id repo name InstallMedia-AppStream Red Hat Enterprise Linux 8 - AppStream InstallMedia-BaseOS Red Hat Enterprise Linux 8.2.0-BaseOS epel Extra Packages for Enterprise Linux 8 - x86_64 epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 [root@rusking ~]#
# dnf install nginx