Локальный репозиторий oracle linux

Локальный репозиторий oracle linux

Define global configuration options in the dnf.conf file. Then, edit or create .repo files to define which repositories to subscribe to.

Configuring the Global DNF Configuration Settings

Edit the main configuration in /etc/dnf/dnf.conf . The global definitions for DNF are located under the [main] section heading of the DNF configuration file. The following table lists important directive for DNF.

For backward-compatibility purposes, a symbolic link to /etc/dnf/dnf.conf is created at /etc/yum.conf . The configuration syntax is generally the same; although, some configuration options have been deprecated and some new configuration options have been added. See Comparing Yum Version 3 With DNF for a list of the differences between configuration options and syntax.

See the dnf.conf(5) manual page for more information.

Directive Description
cachedir Directory used to store downloaded packages.
debuglevel Logging level, from 0 (none) to 10 (all).
exclude A space separated list of packages to exclude from installs or updates, for example: exclude=VirtualBox-4.? kernel* .
gpgcheck If set to 1, verify the authenticity of the packages by checking the GPG signatures. You might need to set gpgcheck to 0 if a package is unsigned, but be wary that the package could have been maliciously altered.
gpgkey Path to the GPG public key file.
installonly_limit Maximum number of versions that can be installed of any one package.
keepcache If set to 0, remove packages after installation.
logfile Path to the yum log file.
obsoletes If set to 1, replace obsolete packages during upgrades.
plugins If set to 1, enable plugins that extend the functionality of yum .
proxy URL of a proxy server including the port number. See Configuring a System to Use a Proxy With a Yum Server
proxy_password Password for authentication with a proxy server.
proxy_username User name for authentication with a proxy server.
reposdir Directories where yum looks for repository files with a .repo extension. The default directory is /etc/yum.repos.d . See Subscribing to Different Yum Repositories.
Читайте также:  Linux команды мониторинга сети

Example [main] Configuration

The following listing shows an example [main] section from the DNF configuration file.

[main] cachedir=/var/cache/dnf keepcache=0 debuglevel=2 logfile=/var/log/dnf.log obsoletes=1 gpgkey=file://media/RPM-GPG-KEY gpgcheck=1 plugins=1 installonly_limit=3

Configuring a System to Use a Proxy With a Yum Server

If the organization uses a proxy server as an intermediary for internet access, specify the proxy setting in /etc/dnf/dnf.conf as shown in the following example.

proxy=http://proxysvr.example.com:3128

If the proxy server requires authentication, additionally specify the proxy_username , and proxy_password settings.

proxy=http://proxysvr.example.com:3128 proxy_username=user proxy_password=password 

All dnf users require read access to /etc/dnf/dnf.conf or /etc/sysconfig/rhn/up2date . If these files must be world-readable, do not use a proxy password that is the same as any user’s login password, and especially not root ‘s password.

Configuring Access to the Oracle Linux Yum Server Through a Firewall

The Oracle Linux yum server delivers content through a Content Delivery Network (CDN). When you connect to the Oracle Linux yum server, you connect to a node on the CDN that is geographically closer to the system you are using. With CDN, download speeds are faster.

Because the CDN has multiple nodes that are located in different networks around the world, you can not configure any single IP address or network range for an egress firewall rule.

In environments where a strict firewall policy limits outbound connections for systems, we recommend configuring a local yum mirror server within a demilitarized zone (DMZ). See Setting Up a Local Yum Mirror for information on how to configure a local yum mirror.

Subscribing to Different Yum Repositories

Oracle Linux uses modular yum repository configuration files that are made available as release packages that are maintained through yum. Release packages simplify repository management and also ensures that yum repository definitions are kept up-to-date automatically whenever you update the system.

On all Oracle Linux systems, the oraclelinux-release-el8 package is installed by default. This package contains the core repository configurations to access all of the repositories required for an Oracle Linux system to be able to install common OS software packages and the other release packages used to obtain additional yum repository configurations.

A list of all available RPM files to manage all of the possible yum repository configurations for a release can be obtained by running the following command, where n is the Oracle Linux release version of the RPM files, such as -el8 .

Читайте также:  List files in package linux

To install the yum repository configuration for a particular set of software, use the dnf command to install the corresponding package.

Editing Yum Repository Configuration Files

DNF uses yum repository configuration files to determine where to install different packages and their dependencies from. By default, dnf expects any repository configuration files to be located in the /etc/yum.repos.d directory, unless you use the reposdir directive to define alternative directories in the dnf.conf file.

Use the repository directory to define .repo files for repositories that you want to make available. A .repo file can contain entries for multiple yum repositories. To subscribe to a repository, you can edit the enabled option to a value of 1 and save the configuration file. The change has immediate effect.

The following table describes the basic directives for a repository. Any other directive that appears in the repository file override the corresponding global definition in the [main] section of the DNF configuration file. See the dnf.conf(5) manual page for more information.

Directive Description
baseurl Location of the repository channel (expressed as a file:// , ftp:// , http:// , or https:// address). This directive must be specified.
enabled If set to 1, permit yum to use the channel.
name Descriptive name for the repository channel. This directive must be specified.

Example Repository Listing

The following listing shows an example repository section from a .repo configuration file.

[ol8_appstream] name=Oracle Linux $releasever Application Stream ($basearch) baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/appstream/$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1

In this example, the values of gpgkey and gpgcheck override any global setting. dnf substitutes the name of the current system’s architecture for the variable $basearch .

Configure Compute Instances Access to Regional Yum Server Repositories

Compute instances in Oracle Cloud Infrastructure have access to regional yum servers through the service gateway. The base URL for the repository uses the $ociregion variable to define which regional server to use and the $ocidomain variable to define the domain where the yum server is located. By using variables, configuration can remain relatively standard across Oracle Linux deployments but provide access to the additional resources available to Oracle Cloud Infrastructure customers.

Читайте также:  Изменить порядок загрузки операционных систем linux windows

For example, the base URL to the ol8_baseos_latest repository for Oracle Linux 8 is:

baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/baseos/latest/$basearch

You can set the $ociregion variable by populating content in /etc/dnf/vars/ociregion . For example, if $ociregion is set to -phx , the base URL expands to point to the regional yum server located in Phoenix.

Typically, when you create an instance, this value is set to point to the closest regional yum server on the Oracle Cloud Infrastructure service network. If the /etc/dnf/vars/ociregion file does not exist, or the file is empty, the base URL points to the publicly accessible Oracle Linux yum server.

Using the DNF config-manager Plugin

The dnf-plugins-core package includes several utilities that can help you to manage configuration and safely apply updates to existing configuration. The most significant of these utilities is the dnf config-manager plugin.

You can use dnf config-manager to add repositories, either at a specified URL or within a specified repository file. For example, to add a repository configuration file for Oracle Linux that is hosted on a remote server, you can run the following command:

sudo dnf config-manager --add-repo https://example.com/my_yum_config.repo

You can use the same command to automatically generate a repository configuration file for a valid yum repository by pointing to the URL for which the repository is hosted. For example, to create a configuration file in /etc/repos.d for an example repository, run the following command:

sudo dnf config-manager --add-repo https://example.com/repo/OracleLinux/ol-release/myrepo/x86_64 

To enable a repository by using dnf config-manager , use the —enable option. For example, to enable the ol8_appstream repository, run the following command:

sudo dnf config-manager --enable repository

You can use the —disable option in a similar way to disable a repository.

You can also use the dnf config-manager tool to set other configuration options by specifying the —setopt and —save options. See the dnf.plugin.config_manager(8) manual page for more information.

How to Recover the Base Yum Repository Configuration

Perform this task if the system’s base repository configuration has been corrupted or otherwise lost.

sudo mkdir /etc/yum.repos.d/temp_base.repo
[ol9_baseos_latest] name=Oracle Linux 9 BaseOS Latest ($basearch) baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL9/baseos/latest/$basearch/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1
[ol8_baseos_latest] name=Oracle Linux 8 BaseOS Latest ($basearch) baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/baseos/latest/$basearch/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1
sudo dnf reinstall oraclelinux-release-olrelease-nbr
ls /etc/yum.repos.d/oraclelinux-release-olrelease-nbr
rm /etc/yum.repos.d/temporary_base.repo
sudo dnf reinstall repository
sudo dnf config-manager --enable repository

Источник

Оцените статью
Adblock
detector