Oracle linux server repository

Mirror a Yum Repository on Oracle Linux

The task of mirroring a yum repository holds multiple benefits. These include the following:

  • Provide access to yum repositories for systems without access to a public network
  • Improve software download times and reduce the bandwidth overhead of a large infrastructure
  • Configure local network-based installation strategies
  • Catering for a snapshot style update strategy where performing testing against a controlled software distribution environment

This tutorial shows how to mirror a yum repository for local, offline, or distributed systems access.

Objectives

In this lab, you’ll learn how to:

  • Prepare a system to host the repository mirror
  • Install and configure a web server
  • Download and create a local repository
  • Configure a system to access the repository mirror

Prerequisites

  • Two Oracle Linux systems, one for the server and the other as a client
  • Storage with enough free space to contain the repository mirror

Setup the Local Yum Mirror Server

Note: When using the free lab environment, see Oracle Linux Lab Basics for connection and other usage instructions.

The output shows a listing of all the enabled repositories and the current space each repository consumes. Pass the repository name as a parameter to display only a single repository.

sudo dnf repoinfo ol8_baseos_latest 
[oracle@ol-server ~]$ sudo dnf repoinfo ol8_baseos_latest Last metadata expiration check: 0:00:59 ago on Wed Apr 12 13:33:45 2023. Repo-id : ol8_baseos_latest Repo-name : Oracle Linux 8 BaseOS Latest (x86_64) Repo-status : enabled Repo-revision : 1681227410 Repo-updated : Tue Apr 11 15:36:56 2023 Repo-pkgs : 16862 Repo-available-pkgs: 16856 Repo-size : 43 G Repo-baseurl : https://yum-eu-frankfurt-1.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/ Repo-expire : 172800 second(s) (last: Wed Apr 12 13:33:13 2023) Repo-filename : /etc/yum.repos.d/oracle-linux-ol8.repo Total packages: 16862 

The output shows this repository’s current size with the value: Repo-size: 43G . As repositories are dynamic and grow over time, allocate enough space on the mirror server for package storage.

The free lab environment provides the mount point /u01 , which contains 50G of free space for storing these packages.

sudo dnf install -y yum-utils 
sudo ln -s /u01/yum /var/www/html/yum 
sudo semanage fcontext -a -t httpd_sys_content_t "/u01/yum(/.*)?" sudo restorecon -RFv /u01/yum 
sudo sed -i "/^#ServerName www.example.com:80/a ServerName $(hostname -i):80" /etc/httpd/conf/httpd.conf 
sudo cat /etc/httpd/conf/httpd.conf | grep "/var/www/html" -A20 
[oracle@ol-server ~]$ sudo cat /etc/httpd/conf/httpd.conf | grep "/var/www/html" -A20 DocumentRoot "/var/www/html" # # Relax access to content within /var/www. # AllowOverride None # Allow open access: Require all granted # Further relax access to the default document root: # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None 
sudo systemctl enable --now httpd 
sudo systemctl status httpd 
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --reload 

Sync Repositories to the Local Yum Mirror

Administrators can mirror any repository available on the Oracle Linux yum server, provided the definition exists in /etc/yum.repos.d on the mirror server. This ability includes repositories for mixed clients such as Oracle Linux 9 and Oracle Linux 7. For more details on configuring for hybrid clients, see the Oracle Linux documentation links at the end of this lab.

    Mirror the designated repository to the base directory.

sudo dnf reposync --delete --download-metadata -p /u01/yum --repoid ol8_addons 

Note: Running this command for the first time takes a while to complete. The selection of the ol8_addons repository in this demo is solely to save time and space when running this lab.

Warning: Ensure enough free space exists on the mirror server if mirroring all the repositories.

Administrators must repeat this command when syncing the latest packages from the Oracle Linux yum server. Automating this action is possible via scripting and using cron ; however, that is outside the scope of this lab.

Configure Client Access to the Local Mirror

Clients require access to the local repository mirror to receive updates and errata fixes.

    Open a terminal and connect via ssh to the ol-client instance, if not already connected.

sudo wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-ol8 sudo gpg --import --import-options show-only /etc/pki/rpm-gpg/RPM-GPG-KEY-ol8 
sudo dnf config-manager --disable ol8_addons 

Tip: To distinguish the local repositories from the public yum repositories, prefix the names of their entries with a string such as local_.

cat  EOF | sudo tee /etc/yum.repos.d/local-yum.repo > /dev/null [local_ol8_addons] name=Oracle Linux 8 Addons ($basearch) baseurl=http://ol-server/yum/ol8_addons gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ol8 gpgcheck=1 enabled=1 EOF 

Verify the Client Configuration.

sudo repoquery -a --repoid local_ol8_addons 

Summary

The client’s output displaying a list of the packages available on the local yum mirror shows the configuration and sync works.

For More information

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.

Mirror a Yum Repository on Oracle Linux

Copyright © 2022, Oracle and/or its affiliates.

Источник

Читайте также:  Arch linux 32 bit install
Оцените статью
Adblock
detector