株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

ローカルにリポジトリを作成することで、インターネットに繋がっていなくてもスタンドアローン構成のままyumでのパッケージインストールができる。
CentOS7.2でやりました。

 

#インストールディスクをマウント
[root@centos7 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only

#リポジトリ格納用ディレクトリ作成
[root@centos7 ~]# mkdir /tmp/repo
[root@centos7 ~]# mkdir /tmp/repo/centos7
[root@centos7 ~]# mkdir /tmp/repo/centos7/Packages

#リポジトリ格納用ディレクトリにrpmをコピー
[root@centos7 Packages]# pwd
/tmp/repo/centos7/Packages
[root@centos7 Packages]# cp -rp /mnt/Packages/* .

#カレントディレクトリにリポジトリ作成
[root@centos7 Packages]# createrepo .
Spawning worker 0 with 3831 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

#viで設定ファイルを作成
[root@centos7 Packages]# vi /etc/yum.repos.d/centos7.repo
[centos7]
gpgcheck=0
name=repo_tmp
baseurl=file:///tmp/repo/centos7/Packages

#一旦リフレッシュ
[root@centos7 Packages]# yum clean all
読み込んだプラグイン:fastestmirror, langpacks
リポジトリーを清掃しています: base centos7 extras updates
Cleaning up everything

#作成したリポジトリが使用可能なことを確認
[root@centos7 Packages]# yum repolist
読み込んだプラグイン:fastestmirror, langpacks
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 不明なエラー"
centos7                                                  | 2.9 kB     00:00
centos7/primary_db                                       | 3.0 MB     00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 不明なエラー"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 不明なエラー"
リポジトリー ID                     リポジトリー名                         状態
base/7/x86_64                       CentOS-7 - Base                            0
centos7                             repo_tmp                               3,831
extras/7/x86_64                     CentOS-7 - Extras                          0
updates/7/x86_64                    CentOS-7 - Updates                         0
repolist: 3,831

#試しにdovecotをインストール
#ちなみにdisablerepoで全リポジトリを無効化したのち、enablerepoで今回追加したリポジトリのみを有効化している
[root@centos7 Packages]# yum --disablerepo=\* --enablerepo=centos7 install -y dovecot
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ dovecot.x86_64 1:2.2.10-7.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
 Package         アーキテクチャー
                                バージョン                リポジトリー     容量
================================================================================
インストール中:
 dovecot         x86_64         1:2.2.10-7.el7            centos7         3.2 M

トランザクションの要約
================================================================================
インストール  1 パッケージ

総ダウンロード容量: 3.2 M
インストール容量: 9.8 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : 1:dovecot-2.2.10-7.el7.x86_64                   1/1
  検証中                  : 1:dovecot-2.2.10-7.el7.x86_64                   1/1

インストール:
  dovecot.x86_64 1:2.2.10-7.el7

完了しました!

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)