红联Linux门户
Linux帮助

How to Create Your Own Yum Repository from ISO Images

发布时间:2008-01-06 02:30:15来源:红联作者:gxf
Since the release of FC5 the option to install packages directly from the installation DVD/CD has not been available. If you are one of those users that would like to have this option then this how-to is for you.
This is not a how-to mount a DVD/CD and extract and create a repo from there.
Please see the
Additional Notes:
Section at the end of the post if that is what you would like to do.

This is the Poor Man's guide to creating a local yum repository which will contain the rpms from your Fedora ISO images.
For the most part, final release versions of Fedora usually contain somewhere in the range of 1,800-2,300 rpms of which not all are used at the time of installation. [F6 - 5 CD's contained 2,363 rpms] I counted em

This guide will allow you to create a local repository of those rpms, which will save you download time and band-width usage.

The guide has been segmented into 7 basic steps and has been written with the assumption that Gnome and Nautilus are being used. However, it can be easily applied to other DE's.

Target Users:
New users, users with limited or no internet access, users who are accustomed to having the option to install packaged from install DVD's or CD's and anyone else who would like to save some download band-width and time installing core rpms.

Applies to both DVD or CD Images.

Required Skills:
Basic knowledge of yum and how to become root in Fedora

Required ISO image(s):
DVD or CD images of Fedora releases, directly downloaded from one of the mirrors

Required Hard Disk Space:
You should expect to use somewhere in the range of 3-3.5 gig for a DVD.

Note:
You do not need to burn these images to media, simply saving them to your hard disk is fine.

Required rpm Packages:
createrepo

Optional rpm Packages:
repoview

Package Notes:
All of the above are natively supplied from the standard Fedora Repositories and can be installed with yum. For more information on each package, please see the man pages for each.

Required Time:
To go through this guide and set up a working local repository should take roughly 10-20 minutes.
#-------------------------------------------------------------------------

Step 1.)

Determine the presence of the required and optional packages:

Open a terminal and log in as root using
su -
yourpassword
then type:

rpm -aq | grep createrepo

rpm -aq | grep repoview

If any of the above queries return nothing then you need to install the package.

For packages that you do not have installed, please do so now with yum.
createrepo : is with the package of rpms included in the ISO image(s) or the core repository
repoview : is included in the fedora-extras repo
#-------------------------------------------------------------------------

Step 2.)

Create a directory where you would like to have your local repository.

Note:
You can substitute any name that you wish. Just make sure your directory name carries forward and is substituted where appropriate.

To create a directory named fedora_core in your /home/username/ directory :

Open a terminal and type the following :

mkdir fedora_core

#-------------------------------------------------------------------------

Step 3.)

Extract the rpm packages from the ISO image files

Locate the ISO images that you have saved on your hard disk. For the sake of this how-to, I have assumed the ISO image(s) are located in your /home/username/images/

Using your file browser - Nautilus, open the folder /home/username/images/
and right click on the first ISO image [if a CD, it is usually labeled -disc-1]
Then select :
Open with “Archive Manager”

Double click on the Folder named Fedora
Double click on the Folder named RPMS

Note: Some released DVD ISO images do not have a sub-directory name RPMS

You should now see a large number of rpm packages and the location should be:
/Fedora/RPMS/
or [which-ever applies i.e. DVD or CD ISO image(s)]
/Fedora/

Now Select Extract
A pop up window will appear where you have a choice labeled Extract in folder :
You want to select the folder /home/username/fedora_core/
Once you have found and selected the correct folder, choose, Extract.
It may take a few moments to extract the rpms to the /home/username/fedora_core/ directory.

If you are using a DVD ISO image you are finished, if you are using the CD ISO images, then repeat the above process for each one of your ISO images.

When you have finished this process, double check that your /home/username/fedora_core/ directory contains the rpms, [The directory should contain only the rpms and no folders] if all looks well then on to the next Step.

#-------------------------------------------------------------------------

Step 4.)

Create the correct repodata files with createrepo

Open a terminal and log in as root using

su -
yourpassword

then type the following:

createrepo /home/username/fedora_core/

This may take a few minutes to complete, so be patient.

When it's finished, move on to the next Step.

#-------------------------------------------------------------------------

Step 5.)

Now we will create the fedora_core.repo file for use with yum

Open a terminal and log in as root using

su -
yourpassword

then type the following:

gedit /etc/yum.repos.d/fedora_core.repo

and copy and paste the following

HTML Code:

[fedora_core] name=Fedora Core $releasever - $basearch - fedora_core baseurl=file:///home/username/fedora_core/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora



You need to leave at least one blank line after the last line in this file.

Save and Exit.

#-------------------------------------------------------------------------

Step 6.)

We will now disable the standard core repository.

While in the same open terminal type :

gedit /etc/yum.repos.d/fedora-core.repo

and set
enabled=1
to
enabled=0

Save and Exit.

Note:
The core repo may or may not contain more rpm packages than the ISO images, as such just keep in mind that you can enable the fedora-core.repo at any time.

#-------------------------------------------------------------------------

Step 7.)

We will now test both the enabling of the new repository [fedora_core.repo] and the disabling of the standard [fedora-core.repo].

While in the same open terminal type :

yum clean all

then type

yum check-update

Both of these yum commands should execute cleanly and you should see the newly created repository, [fedora_core] enabled and see that the old repository [core] is disabled.

If, that is what you see, then you are finished ..... have a beer and kick back


If you receive an error, then slap yourself and go back to Step 5.)

#-------------------------------------------------------------------------

Additional Notes:
If you have no internet connection you will need to disable the standard repositories, which are located in /etc/yum.repos.d
Those are usually:
fedora-extras.repo, fedora-core.repo & fedora-updates.repo
to do so, follow the instructions under Step 6.) above.

Once those are disabled you will be able to use yum to install packages from the core repository, which you have created.

If you wish to try other methods of installing packages directly from your DVD / CD and creating / or not creating a local hard drive repository, then please have a look at this site:http://www.city-fan.org/tips/YumRepoFromImages

[ 本帖最后由 gxf 于 2008-1-6 02:31 编辑 ]
文章评论

共有 0 条评论