LoginSignup
1
1

More than 5 years have passed since last update.

CentOSのインストールメディアからyumする方法

Posted at

背景

インターネットに繋がっていないCentOSにnet-snmpをインストールしたいなと思っていたところ、以下のような方法があったのでメモ

CentOS-Media.repoを有効化

enabled=0をコメントアウト

[root@test /]# vi /etc/yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c7-media [command]

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
#enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

その他の.repoを/tmp等に一旦退避

[root@test yum.repos.d]# ll
合計 4
-rw-r--r--. 1 root root 631  3 10 00:07 CentOS-Media.repo

CentOSのメディアをマウント

CentOS-Media.repoに記載されているディレクトリを作成しメディアをマウント

[root@test /]# mkdir media/CentOS
[root@test /]# mount /dev/sr0 /media/CentOS
mount: /dev/sr0 is write-protected, mounting read-only

net-snmpをインストール

メディアからnet-snmpをインストール

[root@test yum.repos.d]# yum install net-snmp net-snmp-utils
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * c7-media:
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ net-snmp.x86_64 1:5.7.2-32.el7  インストール
--> 依存性の処理をしています: net-snmp-agent-libs = 1:5.7.2-32.el7 のパッケージ: 1:net-snmp-5.7.2-32.el7.x86_64
--> 依存性の処理をしています: libnetsnmptrapd.so.31()(64bit) のパッケージ: 1:net-snmp-5.7.2-32.el7.x86_64
--> 依存性の処理をしています: libnetsnmpmibs.so.31()(64bit) のパッケージ: 1:net-snmp-5.7.2-32.el7.x86_64
--> 依存性の処理をしています: libnetsnmpagent.so.31()(64bit) のパッケージ: 1:net-snmp-5.7.2-32.el7.x86_64
---> パッケージ net-snmp-utils.x86_64 1:5.7.2-32.el7  インストール
--> トランザクションの確認を実行しています。
---> パッケージ net-snmp-agent-libs.x86_64 1:5.7.2-32.el7  インストール
--> 依存性解決を終了しました。

依存性を解決しました

=======================================================================================
 Package                    アーキテクチャー
                                          バージョン             リポジトリー     容量
=======================================================================================
インストール中:
 net-snmp                   x86_64        1:5.7.2-32.el7         c7-media        330 k
 net-snmp-utils             x86_64        1:5.7.2-32.el7         c7-media        198 k
依存性関連でのインストールをします:
 net-snmp-agent-libs        x86_64        1:5.7.2-32.el7         c7-media        704 k

・・・省略・・・                       

完了しました!
[root@test yum.repos.d]# systemctl start snmpd
[root@test yum.repos.d]# snmpwalk -v 2c -c public localhost
SNMPv2-MIB::sysDescr.0 = STRING: Linux test 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (549) 0:00:05.49
SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
SNMPv2-MIB::sysName.0 = STRING: test
・・・省略・・・ 
[root@test yum.repos.d]#

以上です。

1
1
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
1
1