Some of you might share the following use case: You need (or want) to mirror repos to provide packages for the hosts on your LAN that are not connected to the internet, and therefore cannot access the upstream repos directly. In this article, I explain how to accomplish this task easily by using reposync, which is shipped with your Red Hat Enterprise Linux (RHEL) 7 or Red Hat Enterprise Linux 8 subscription.
Before we get started, I would like to point out the important requirements. You need a valid subscription for every repo you would like to mirror because your mirror server can only sync those repos that are included in its own subscription. All of your other hosts that will use this mirror need to have a valid subscription, too.
If you have any questions about subscriptions, please take a look at the following URLs: the Red Hat subscription model FAQ and the Red Hat subscription service overview.
Setting up mirrored repos for Red Hat Enterprise Linux 7
To start, you’ll need to choose the web server that will serve the mirrored repos to your LAN. Then, if you’re using Red Hat Enterprise Linux 7, then to create a basic repo you have to start by installing createrepo. Don’t worry, this tool is included in your subscription, too. Install it on your web server with the following:
# yum install yum-utils createrepo
Next, you need the repository ID for the repo you would like to sync. Run yum repolist, and you’ll find the repo ID in the output’s first column:
$ yum repolist
Loaded plugins: langpacks, nvidia, product-id, search-disabled-repos, subscription-
: manager
repo id repo name status
rhel-7-server-optional-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server - O 19.490
rhel-7-server-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server (RP 26.766
virtualbox/7Server/x86_64 Oracle Linux / RHEL / CentOS-7Server 77
In this case, rhel-7-server-rpms is the ID for the standard Red Hat Enterprise Linux 7 repo. You can get a complete list of repos your subscription has access to with the command:
$ sudo subscription-manager repos --list
You’ll find the repo ID in there, too.
For example, to sync the packages from the rhel-7-server-rpms repo and create a basic local repository, execute the following commands:
# reposync --gpgcheck -l --repoid=rhel-7-server-rpms --download_path=/var/www/html # Sync RPMS
# cd /var/www/html/rhel-7-server-rpms
# createrepo -v /var/www/html/rhel-7-server-rpms # Create the repo
Setting up mirrored repos for Red Hat Enterprise Linux 8
For Red Hat Enterprise Linux 8, this process is even easier. You only need the reposync command:
# reposync -p <download-path> --download-metadata --repo=<repo id>
The createrepo command is not needed anymore because reposync downloads everything, including the repodata.
Sharing the local repository
Once the packages are fetched and the local repo is created using either of these methods, the local repository can be distributed among the offline/disconnected systems using a simple web server, FTP, or NFS. The following knowledgebase articles provide the necessary information regarding your choice of distribution:
For more sophisticated setup than described in this article, consider using Red Hat Satellite.
[ Want to try out Red Hat Enterprise Linux? Download it now for free. ]
저자 소개
Jörg has been a Sysadmin for over ten years now. His fields of operation include Virtualization (VMware), Linux System Administration and Automation (RHEL), Firewalling (Forcepoint), and Loadbalancing (F5). He is a member of the Red Hat Accelerators Community and author of his personal blog at https://www.my-it-brain.de.
유사한 검색 결과
Behind the scenes of RHEL 10, part 3
Alliander modernises its electricity grid with Red Hat for long-term reliability in balance with rapid innovation
The Overlooked Operating System | Compiler: Stack/Unstuck
Linux, Shadowman, And Open Source Spirit | Compiler
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래