Linux
Yum

yumリポジトリをローカルに設定する方法

More than 5 years have passed since last update.

商用環境だと、外に接続できないときがあります。

そんなときにISOイメージをyumのリポジトリとして使う方法があります。

では早速設定してみます。

動作環境は、以下の通り

Scientific Linux 6.4


リポジトリ設定


/etc/yum.repos.d/sl-media.repo

[sl-media]

Name=Scientific Linux $releasever $basearch Media
baseurl=file:///mnt
gpgcheck=1
enable=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-sl file:///etc/pki/rpm-gpg/RPM-GPG-KEY-sl6 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-cern


IOSのマウント


bash

# mount -o loop /var/kvm/iso/SL-64-x86_64-2013-03-18-Install-DVD.iso /mnt/



確認


bash

# yum repolist

Loaded plugins: security
repo id repo name status
sl-media Scientific Linux 6.4 x86_64 Media 4,003
repolist: 4,003


yum installしてみる


bash

# yum install sysstat

Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sysstat.x86_64 0:9.0.4-20.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================
Installing:
sysstat x86_64 9.0.4-20.el6 sl-media 224 k

Transaction Summary
==========================================================================================================================
Install 1 Package(s)

Total download size: 224 k
Installed size: 807 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : sysstat-9.0.4-20.el6.x86_64 1/1
Verifying : sysstat-9.0.4-20.el6.x86_64 1/1

Installed:
sysstat.x86_64 0:9.0.4-20.el6

Complete!