A Package Repository is where OS package are stored.
This repository are used by package manager such as yum to search and install packages
With yum
yum repolist
Output example:
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10,072
epel/7/x86_64 EPEL YUM repo 13,511+1
extras/7/x86_64 CentOS-7 - Extras 448
remi-safe Safe Remi's RPM repository for Enterprise Linux 7 - x86_64 4,080
updates/7/x86_64 CentOS-7 - Updates 1,207
# with configuration all
yum-config-manager
# only one
yum-config-manager repositoryId
# example
yum-config-manager epel
dnf config-manager --enable repository # where repository is the unique repository ID
dnf config-manager --disable repository # where repository is the unique repository ID
yum-config-manager --enable repository # where repository is the unique repository ID
yum-config-manager --disable repository # where repository is the unique repository ID
Adding a repository for yum is adding a config file at /etc/yum.repos.d/repository-name.repo
With ansible, see yum-repository
- name: 'Package - Add the netdata repository'
yum_repository:
name: netdata
description: Netdata Repo
baseurl: https://packagecloud.io/netdata/netdata/el/$releasever/$basearch/
gpgcheck: no
repo_gpgcheck: yes
# config
yum-config-manager
# or
ls /etc/yum.repos.d
CentOS-Base.repo CentOS-Sources.repo epel-testing.repo remi-glpi94.repo remi-php72.repo
CentOS-CR.repo CentOS-Vault.repo epel-testing.repo.rpmnew remi-modular.repo remi-php73.repo
CentOS-Debuginfo.repo CentOS-x86_64-kernel.repo remi-glpi91.repo remi-php54.repo remi-php74.repo
CentOS-fasttrack.repo epel.repo remi-glpi92.repo remi-php70.repo remi.repo
CentOS-Media.repo epel.repo.rpmnew remi-glpi93.repo remi-php71.repo remi-safe.repo
.............
Your package manager should install the repository public key.
Example with rpm
# Microsoft repository key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
yum -x python-3 update
yum --exclude httpd,php update
In the the conf file
exclude=python-3*
exclude=httpd php
In the repo file .repo in /etc/yum/repos.d/ or /etc/yum.repos.d directory with the exclude property
cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
exclude=python-3*
Edit the /etc/yum.conf
Example:
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
exclude=nginx
EPEL (Extra Packages for Enterprise Linux) - EPEL is a open source and free community based package repository project from Fedora team for Linux distribution. You will find most of the package but open-source.
# Import the key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# Create the repo metadata
sudo sh -c 'echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
The Oracle public yum server offers a free and convenient way to install packages from the Enterprise Linux and Oracle VM installation media via a yum client.
All configuration steps are detailed in the Oracle Public Yum home page
[root@oel11g yum.repos.d]# cat /etc/enterprise-release
Enterprise Linux Enterprise Linux Server release 5.3 (Carthage) <------OEL 5 Update 3
cd /etc/yum.repos.d
dir
wget http://public-yum.oracle.com/public-yum-el5.repo
--21:01:30-- http://public-yum.oracle.com/public-yum-el5.repo
Resolving public-yum.oracle.com... 141.146.44.34
Connecting to public-yum.oracle.com|141.146.44.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1864 (1.8K) [text/plain]
Saving to: public-yum-el5.repo
100%[=======================================>] 1,864 --.-K/s in 0s
21:01:30 (518 MB/s) - public-yum-el5.repo saved [1864/1864]
vi public-yum-el5.repo
Example:
[el5_u3_base]
name=Enterprise Linux $releasever U3 - $basearch - base
baseurl=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/3/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1