Offline environment construction CentOS edition

1 minute read

To offline environment construction table of contents

CentOS

BaseOS/AppStream

How to install BaseOS / AppStream packages.

mount

Mount the installation media.

$ sudo mount CentOS-8.2.2004-x86_64-dvd1.iso /media
$ sudo ls -l /media/
$ sudo cp -v /media/media.repo /etc/yum.repos.d/centos8.repo
$ sudo chmod 644 /etc/yum.repos.d/centos8.repo
$ sudo ls -l /etc/yum.repos.d/centos8.repo

Repository settings

Set the repository in /etc/yum.repos.d/centos8.repo.

Change before

[InstallMedia]
name=CentOS Linux 8
mediaid=None
metadata_expire=-1
gpgcheck=0
cost=500

** After change **

[Local-BaseOS]
name=CentOS-8 - Local - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///media/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[Local-AppStream]
name=CentOS-8 - Local - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///media/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

Verification

$ sudo dnf clean all
$ sudo dnf repolist
Failed to set locale, defaulting to C
CentOS-8 - AppStream                                                                                                                      0.0  B/s |   0  B     00:01    
CentOS-8 - Base                                                                                                                           0.0  B/s |   0  B     00:01    
CentOS-8 - Extras                                                                                                                         0.0  B/s |   0  B     00:01    
CentOS Linux 8 - AppStream                                                                                                                 34 MB/s | 5.7 MB     00:00    
CentOS Linux 8 - BaseOS                                                                                                                    60 MB/s | 2.2 MB     00:00    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'BaseOS', ignoring this repo.
Failed to synchronize cache for repo 'extras', ignoring this repo.
Last metadata expiration check: 0:00:01 ago on Mon Sep 14 14:48:23 2020.
repo id                                                                         repo name                                                                           status
InstallMedia-AppStream                                                          CentOS Linux 8 - AppStream                                                          4901
InstallMedia-BaseOS                                                             CentOS Linux 8 - BaseOS                                                             1672

EPEL

How to install the EPEL package.

download

Execute the following commands for the number of threads you want to download.

wget -c -r -N --no-parent https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/

If you have CentOS in your online environment, reposync is easier than wget.

The data capacity will be about 20GB.

Repository settings

Set the repository in /etc/yum.repos.d/epel8.repo.

[Local-EPEL]
name=CentOS-8 - Local - EPEL
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=file:///mnt/host/epel/dl.fedoraproject.org/pub/epel/8/Everything/x86_64
# gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

Verification

$ sudo dnf clean all
$ sudo dnf repolist