LoginSignup
3
2

More than 1 year has passed since last update.

オフライン環境構築 CentOS編

Last updated at Posted at 2020-09-14

オフライン環境構築 目次へ

BaseOS/AppStream

BaseOS/AppStreamのパッケージをインストールする方法。

マウント

インストールメディアをマウントする。

$ 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

リポジトリ設定

/etc/yum.repos.d/centos8.repoにリポジトリを設定する。

変更前

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

変更後

[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

確認

$ 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

EPELのパッケージをインストールする方法。

ダウンロード

ダウンロードしたいスレッドの数だけ以下のコマンドを実行する。

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

オンライン環境にCentOSを持っている場合は、wgetよりreposyncのほうがラク。

なお、データ容量は20GBくらいになる。

リポジトリ設定

/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

確認

$ sudo dnf clean all
$ sudo dnf repolist
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2