Buy the book on Amazon https://www.amazon.co.uk/dp/B08CF33XM2 50 yum repository details in /etc/yum.repos.d • Under /etc/yum.repos.d are the files which define the repositories to be used; for the CentOS 8 distribution these include: ♦ CentOS-Base.repo - contains the BaseOS repository details. ♦ CentOS-AppStream.repo - used to install AppStream packages from the distribution. • For our own in-house courses, the above repo files have been edited on the training systems so that the machine looks only to the training server vespa on the local network when installing or updating packages; this can be seen as follows: $ yum -v repolist • There should be three main repositories: Repo-id : AppStream-FA Repo-name : CentOS-8 - AppStream from FA server Repo-revision : 8.3.2011 Repo-distro-tags : [cpe:/o:centos:centos:8]: , 8, C, O, S, e, n, t Repo-updated : Tue 15 Dec 2020 03:05:32 PM GMT Repo-pkgs : 5,754 Repo-available-pkgs : 5,058 Repo-size : 6.9 G Repo-baseurl : http://192.168.200.41/centos/8/AppStream Repo-expire : 172,800 second(s) (last: Thu 31 Dec 2020 05:34:39 PM GMT) 50 of 617 First Alternative 2021 51 Repo-filename : /etc/yum.repos.d/CentOS-AppStream.repo Repo-id : BaseOS-FA Repo-name : CentOS-8 - Base on FA local http server Repo-revision : 8.3.2011 Repo-distro-tags : [cpe:/o:centos:centos:8]: , 8, C, O, S, e, n, t Repo-updated : Tue 15 Dec 2020 03:05:26 PM GMT Repo-pkgs : 1,697 Repo-available-pkgs : 1,695 Repo-size : 1.1 G Repo-baseurl : http://192.168.200.41/centos/8/BaseOS Repo-expire : 172,800 second(s) (last: Thu 31 Dec 2020 05:34:41 PM GMT) Repo-filename : /etc/yum.repos.d/CentOS-Base.repo Repo-id : extras-FA Repo-name : CentOS-8 - Extras on FA server Repo-revision : 1605188560 Repo-updated : Thu 12 Nov 2020 01:42:22 PM GMT Repo-pkgs : 30 Repo-available-pkgs : 30 Repo-size : 338 k Repo-baseurl : http://192.168.200.41/centos/8/Extras/ Repo-expire : 172,800 second(s) (last: Thu 31 Dec 2020 05:34:41 PM GMT) Repo-filename : /etc/yum.repos.d/CentOS-Extras.repo Total packages : 7,481 • On a system with the standard .repo files, the output would contain references to the CentOS online repos. 51 of 617 First Alternative 2021 Buy the book on Amazon https://www.amazon.co.uk/dp/B08CF33XM2 52 yum repository details • yum is able to pick a suitable mirror for downloading by referring to a mirrorlist directive in the CentOS-Base.repo file, which provides a list of download URLs. • Here is an example repo entry from the standard CentOS- Base.repo file: [BaseOS] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&re po=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial ♦ Remember the GPG key location? We used it earlier with rpm. ♦ The repo files on the training systems are configured to disable the standard repos. • Some repo entries may also include: enabled=0 • If enabled=0, do not use this repo; if set to 1, repo is enabled. This can be changed by manual editing or by command, which you will see later. • For details of other entries run: $ man yum.conf 52 of 617 First Alternative 2021 53 yum repository details RHEL8 • On a RHEL8 system you will find a single redhat.repo file in /etc/yum.repos.d containing all possible repos, with the relevant entries enabled, according to your subscription. • This file is updated by the subscription-manager command, so there is never a need to edit it manually. • You might sometimes see examples of yum (or dnf) commands where repos are enabled/disabled on the command line. • On a RHEL8 system this is most likely to be done by running subscription-manager, for example: $ sudo subscription-manager repos \ --enable rhel-7-server-rpms ♦ This example you will see when we cover RHEL7 to RHEL8 in-place upgrades later in the course. 53 of 617 First Alternative 2021 54 Buy the book on Amazon https://www.amazon.co.uk/dp/B08CF33XM2 Creating local yum repositories • Creating a local repository means you can download packages from online repositories to just a single system, then use that system to update others. • The server used on this course has its own repositories, which all the training machines are configured to use. • The /etc/yum.repos.d/CentOS-Base.repo file contains: [BaseOS-FA] name=CentOS-$releasever - Base on FA local http server baseurl=http://192.168.200.41/centos/8/BaseOS gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial ♦ The original entry is still in the file but enabled is set to 0 so it does not get used. • 192.168.200.41 refers to the server vespa. • gpgcheck verifies the authenticity of packages loaded from repos, as we saw earlier. • There are two other enabled repository files in the directory, one for AppStream and the other for Extras. • Important note: There is no updates repository anymore – all updates are pushed directly to the BaseOS and AppStream repos. Keep reading….. 54 of 617 First Alternative 2021 55 Creating local yum CentOS repositories - Choices • There are three types available when it comes to using CentOS 8 repos: ♦ Fixed - Repos which are fixed at a given point release, for example 8.1. Good examples are the BaseOS and AppStream repos contained in the distribution ISO tree. ♦ Updated - Repos which receive package updates. Examples would be the repos which are accessed online using the default /etc/yum.repos.d files supplied with CentOS 8 release. ♦ 8-Stream - a new collaborative repo between CentOS and RHEL, which reflects the RedHat development taking place for the next point release. • Use cases: ♦ Fixed - use for initial installs, either from ISO/DVD or a network source if using Kickstart. ♦ Updated - use to update installed system with the latest bug and security fixes, and new features, including to the next point release. ♦ 8-Stream - for the curious, should not be used in production. See the following notes for more information if you wish to enable 8-Stream. • You may see another repo file CentOS-CR.repo, which is known as the Continuous Release repo, but is disabled by default. 55 of 617 First Alternative 2021 Buy the book on Amazon https://www.amazon.co.uk/dp/B08CF33XM2 56 • Note that it is updated only occasionally and may be empty, in which case it will be ignored. • It only has content between the RedHat upstream release date and the corresponding CentOS release date, so that you can obtain updated packages before the CentOS release is available. • An example would be that RHEL8.3 is released, with CentOS8.3 a couple of months later, and the updated packages would be available from the CR repo during that 2-month gap. • To enable the repo, you can edit the CentOS-CR.repo file and set enabled=1, or do it from the command line: $ sudo yum config-manager --enable cr • For the full details, have a look here: https://wiki.centos.org/AdditionalResources/Repositories/CR 56 of 617 First Alternative 2021 57 Creating local yum repositories for RedHat • RedHat provide full instructions for creating a local mirror repo of the latest updates, without using a satellite server, here: https://access.redhat.com/solutions/23016 • The article covers RHEL5 through 8. 57 of 617 First Alternative 2021 Buy the book on Amazon https://www.amazon.co.uk/dp/B08CF33XM2 58 Local CentOS 8 repository server setup using a web server • To set up a system as a local repository server you can provide access via: ♦ Local directory access (e.g. NFS mount) ♦ Web server (HTTP) ♦ FTP (File Transfer Protocol) • We will look first at HTTP, followed by local directory access. • The repos we will create are the updated variety. • 1. Install and enable the Apache web server. $ sudo yum install httpd $ sudo systemctl enable httpd $ sudo systemctl start httpd ♦ Ignore any warning messages. • 2. Create directories on the server for the BaseOS, Appstream and Extras repos within the web site directory space: $ sudo mkdir -p /var/www/html/centos/8/BaseOS $ sudo mkdir /var/www/html/centos/8/AppStream $ sudo mkdir /var/www/html/centos/8/Extras • 3. Ensure internet access is enabled, then create a BaseOS repo as follows: 58 of 617 First Alternative 2021 59 $ sudo rsync -avrt \ rsync://rsync.mirrorservice.org/mirror.centos.org/8\ BaseOS/x86_64/os/ \ /var/www/html/centos/8/BaseOS/ ---------------------------------------------------------------------------- Welcome to the University of Kent's UK Mirror Service. More information can be found at our web site: http://www.mirrorservice.org/ Please send comments or questions to [email protected]. ---------------------------------------------------------------------------- receiving file list ... done ./ .discinfo .treeinfo EULA GPL extra_files.json media.repo EFI/ etc. • Remember that the repos we are copying are the updated versions, so we can run the same rsync commands periodically to keep our local repos up-to-date. • You may consider using the reposync utility which will also download the repositories for you. • reposync is part of the yum-utils package, and the reposync man page has examples of use. ♦ rsync.mirrorservice.org is the rsync server on the internet, 59 of 617 First Alternative 2021 Buy the book on Amazon https://www.amazon.co.uk/dp/B08CF33XM2 60 which may need to be changed depending on your location.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages31 Page
-
File Size-