User Tools

Site Tools


mywiki:linux:yumlocaliso

Setup yum repositories to update or install package from Local ISO Image

Creation of yum repositories is handled by a separate tool called createrepo, which generates the necessary XML metadata. If you have a slow internet connection or collection of all downloaded ISO images, use this hack to install rpms from iso images.

Step # 1: Mount an ISO file

Type the following command (replace iso file name with the actual iso file):

  yum install createrepo
  mkdir -p /mnt/dvd
  mount -o loop /dev/sr0/ /mnt/dvd
  mkdir -p /var/ftp/pub/fedora-20-dvd
  cp /mnt/dvd/*  /var/ftp/pub/fedora-20-dvd/ -a

Step # 2: Create config file

Create a repo config file in **/etc/yum.repos.d/local.repo.

Its content is as below:

[local-repo]
name='local repo based on Fedora 20 DVD ISO'
baseurl=file:///var/ftp/pub/fedora-20-dvd
enabled=1
gpgcheck=0

Test

#yum repolist all

Its print log is like below:

[shaoguoh@localhost yum.repos.d]$ yum repolist all
Loaded plugins: langpacks, refresh-packagekit
repo id                     repo name                                                status
fedora/20/x86_64            Fedora 20 - x86_64                                       enabled: 38,597
fedora-debuginfo/20/x86_64  Fedora 20 - x86_64 - Debug                               disabled
fedora-source/20/x86_64     Fedora 20 - Source                                       disabled

local-repo local repo based on Fedora 20 DVD ISO enabled: 4,071

updates/20/x86_64           Fedora 20 - x86_64 - Updates                             enabled: 20,178
updates-debuginfo/20/x86_64 Fedora 20 - x86_64 - Updates - Debug                     disabled
updates-source/20/x86_64    Fedora 20 - Updates Source                               disabled
updates-testing/20/x86_64   Fedora 20 - x86_64 - Test Updates                        disabled
updates-testing-debuginfo/20/x86_64 Fedora 20 - x86_64 - Test Updates Debug          disabled
updates-testing-source/20/x86_64    Fedora 20 - Test Updates Source                disabled
repolist: 62,846

# yum install package-name

 sudo yum install tftp
Loaded plugins: langpacks, refresh-packagekit

local-repo | 3.6 kB 00:00:00

Resolving Dependencies
--> Running transaction check
---> Package tftp.x86_64 0:5.2-10.fc20 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================
 Package                   Arch                        Version                            Repository                   Size
============================================================================================================================
Installing:
 tftp                      x86_64                      5.2-10.fc20                        fedora                       36 k

Transaction Summary
============================================================================================================================
Install  1 Package
mywiki/linux/yumlocaliso.txt · Last modified: by 127.0.0.1