Scientific Linux Forum.org



  Reply to this topicStart new topicStart Poll

> Create a local repo from a install DVD
AndrewSerk
 Posted: Jan 21 2012, 05:05 AM
Quote Post


SLF Moderator
*****

Group: Moderators
Posts: 457
Member No.: 54
Joined: 14-April 11









Create a local repo from a install DVD

There has been a few threads with people asking how to create a local repo from the install DVD lately so I thought I would share the method I use.

I will be using the ScientificLinux 6.1x86_64DVD installation DVD and the Gnome Desktop Environment for this guide.

Start by creating a directory for the local repo:
CODE
su -c 'mkdir /SL_DVD_localrepo'


Then we put the DVD in the reader. The DVD will be auto-mounted in the /media directory.
We now need to copy the .rpm files from the Packages folder inside the DVD to the new directory we created “/SL_DVD_localrepo“. The easiest way is to use the < tab> key for auto-complete function.
CODE
su -
cp /media/<TAB>/Packages/*.rpm /SL_DVD_localrepo

When I used the auto-complete <tab> key above it found/completed the directory of the DVD.

We now need to create a repo from the directory /SL_DVD_localrepo . This requires the package “createrepo” . If you do not have the package createrepo installed :
CODE
cd /SL_DVD_localrepo
yum localinstall createrepo<tab>


Once you have the package “createrepo” installed you can create the repo with:
CODE
createrepo /SL_DVD_localrepo


The last thing to do is create a repo file (for this purpose I used gedit but you can use whatever text editor you prefer) :
CODE
gedit /etc/yum.repos.d/SL_DVD_localrepo.repo


Make the SL_DVD_localrepo.repo file read as follows and save:

QUOTE
[SL_DVD_localrepo]
Name=SL_DVD_localrepo $releasever $basearch local repository
baseurl=file:///SL_DVD_localrepo
enable=1



If you have other repos enabled and you want to use just the local repo you can do that with a command like:
CODE
yum install foo –disablerepo=* --enablerepo=SL_DVD_localrepo

or change “enable=1” to “enable=0” in all .repo files except SL_DVD_localrepo.repo


Hope this helps someone,
PM
^
certainquirk
 Posted: Aug 28 2012, 01:24 PM
Quote Post


SLF Newbie


Group: Members
Posts: 7
Member No.: 932
Joined: 16-October 11









Thanks for this. Since many distros do this by default and I've been more familiar with them, this was most helpful.

Edit: I should clarify that "many distros" leave the CD/DVD enabled as a repo, but they don't create a local repo for it.

--------------------
Motherboard: ASUS M3A78-EM AM2+/AM2 AMD 780G;
CPU: AMD Athlon 64 X2 5000 2.6GHz;
RAM: Kingston 2GB SDRAM DDR2 800;
System: SL63
PMUsers Website
^
basefilm
 Posted: May 14 2013, 02:33 PM
Quote Post


SLF Newbie


Group: Members
Posts: 1
Member No.: 2489
Joined: 14-May 13









Great instructions, thanks. I found a number of non-working ones out there before yours. Yours worked for me for SL6.4 and RHEL6.4.

A couple improvements:
1. To turn off gpg checking for your local repo, allowing you to skip the "--nogpgcheck" argument when using yum, add this line to the /etc/yum.repos.d/SL_DVD_localrepo.repo file:
QUOTE
gpgcheck=0


2. Its nice to have 'yum grouplist' and 'yum groupinstall' working for a local repository. Here's how:

CODE
cd /SL_DVD_localrepo
cp /media/\"ScientificLinux\ 6.4\ i386\ DVD\"/repodata/comps.xml .
createrepo -g comps.xml .
yum clean all
yum makecache


Note: On RHEL, the file to copy is in a different directory. Look for the one named <huge random string>-comps-rhel6-Server.xml, e.g.:
CODE
cp /mnt/cdrom/Server/repodata/cda5429ve6f36ce1348e8f897f4fc96aa00d5727c75e9e5a0b5dc40d22a51116-comps-rhel6-Server.xml .
createrepo -g cda5429ve6f36ce1348e8f897f4fc96aa00d5727c75e9e5a0b5dc40d22a51116-comps-rhel6-Server.xml .


Test it with:
CODE
yum grouplist

PM
^
AndrewSerk
 Posted: May 14 2013, 04:56 PM
Quote Post


SLF Moderator
*****

Group: Moderators
Posts: 457
Member No.: 54
Joined: 14-April 11









Thanks for the additions basefilm and welcome to SLF, smile.gif
I am sure many will find the info usefull!

This post has been edited by AndrewSerk: May 14 2013, 04:57 PM
PM
^
igadoter
 Posted: Jul 17 2015, 09:46 PM
Quote Post


SLF Member
***

Group: Members
Posts: 54
Member No.: 3337
Joined: 13-January 15









Small addons,

I was using this how to and works great. My only change is that I actually didn't copy files from the fist DVD, but I linked them.

In other words in directory /SL_DVD_localrepo I put only links to packages from the first DVD, this way I saved 4.0 GB of space on hard-drive.
PMEmail Poster
^
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll