Linux serverNETWORK ADMINISTRATIONS

Redhat Linux 9 Lab: Tạo repository bằng đĩa cài đặt



https://www.youtube.com/playlist?list=PLIpLw6v7Z1qmty_yT3KQUeV5jW46Wu7hG
Link playlist
Red Hat Enterprise Linux Administration

2023 11 15 14 01 06

Creating Your Own Repository
Creating your own repository is not a requirement for the
RHCSA exam, but knowing how to do so is useful if you want to
test setting up and working with repositories. Also, if you’re
using a RHEL system that is not connected to the Red Hat
repositories, it’s the only way you can install packages.
The procedure itself is not hard to summarize. You need to
make sure all RPM packages are available in the directory that
you want to use as a repository, and after doing that, you need
to use the createrepo command to generate the metadata that
enables you to use that directory as a repository. If you’re using
the RHEL 9 installation disk, the procedure is even easier, as
you don’t have to generate the repository metadata. Exercise 9-
1 describes how to create your own repository using the RHEL 9
installation disk.
Exercise 9-1 Creating Your Own Repository
To perform this exercise, you need to have access to the RHEL
or CentOS installation disk or ISO file.
1. Insert the installation disk in your virtual machine and make
sure it is attached and available.
2. Open a root shell and type mkdir /repo so that you have a
mount point where you can mount the ISO file.
3. Add the following line to the end of the /etc/fstab
configuration file: /dev/sr0 /repo iso9660 defaults 0 0
4. Type mount -a, followed by mount | grep sr0. You should
now see that the optical device is mounted on the directory
/repo. At this point, the directory /repo can be used as a
repository.
5. Now, two subdirectories are available through the /repo
directory. The BaseOS repository provides access to the base
packages, and the Application Stream (AppStream)
repository provides access to application streams (these
repositories are described in more detail in the “Managing
Package Module Streams” section later in this chapter). To
make them accessible, you need to add two files to the
/etc/yum.repos.d directory. Start with the file BaseOS.repo.
You can generate this file using dnf config-manager –add repo=file:///repo/BaseOS
6. Add the file /etc/yum.repos.d/AppStream.repo using the
following command: dnf config-manager –add repo=file:///repo/AppStream
7. Type ls /etc/yum.repos.d/. This will show you two new files:
repo_BaseOS.repo and repo_AppStream.repo. Add the
following line to the end of both files: gpgcheck=0
8. Type dnf repolist to verify the availability of the newly
created repository. It should show the name of both
repositories, including the number of packages offered
through this repository (see Example 9-3). Notice that if
you’re doing this on RHEL, you’ll also see a message that this
system is not registered with an entitlement server. You can
safely ignore that message.

source
centos 7