Tuesday, May 30, 2006

Fedora Core 5 - Pirut (Software Package Manager)

Well today I was preparing some materials for a workshop tomorrow. And I was googling around to find out how to use Fedora Core 5's gui Package Manager. The unfortunate thing was that we were unable to connect the laptops we prepared to the school's network. Meaning, NO INTERNET ACCESS! So fine, we thought we can just install packages from the discs.

But therein lies Fedora Core 5's quirk. It's software package manager, aka 'pirut' only retrieves software through online repositories! So whenever I tried to use the gui package manager, it just threw me some error which did not even tell me the problem. So googling around, thanks to several forums, I found out that the problem was this strange characteristic of pirut. So how to fix this? Googled again, but only one blog talked about getting it fixed, but did not exactly state how. There was also another website that gave quite detailed steps, but again, it was apparently not tested yet. So fine, I had to just mess around, with only a few hours to go. In the end, this is what I came up with. I hope it helps anyone else who has this problem.

1. Create a directory to hold the rpms.(I put mine in /tmp)
# mkdir -p /tmp/RPMS

2. Change directory to the repository folder
# cd /tmp/RPMS

3. Create directories to temporarily mount the discs
# mkdir disc1 disc2 disc3 disc4 disc5

4. Insert disc 1 and mount it
# mount -r -o loop /dev/hdb disc1

5. Copy the RPMS from the mounted directory(disc1) to our current directory
# cp disc1/Fedora/RPMS/* .

6. Copy comps.xml as well
# cp disc1/repodata/comps.xml .

ok, here you gotta wait a while

Basically you do steps 4 and 5 again until all the 5 discs are done if you wish to install packages from all 5 discs.

7. Once you are done, unmount and remove the files.
# umount disc1 disc2 disc3 disc4 disc5
# rmdir disc1 disc2 disc3 disc4 disc5

8. Now to create the repository metadata
# rpm -Uvh createrepo*
# createrepo -g comps.xml .

9. Edit yum.conf
#vi /etc/yum.conf

10. Add in the below lines and save your changes. (NOTE: You can actually add it in the yum.repos.d as well if you wish)
name=testing the repos

11. Now you have to disable the repositories that point to an online source for the package manager to run properly.
# cd /etc/yum.repos.d
# ls
(You should see something like the below. Those are the default repository files)

12. To disable the repositories, set enabled=0 in the .repo files
# vi fedora-core.repo

13. Do the same for the rest of the .repo files

14. On your desktop, try the Add/Remove Software package manager again.

It should work now.

The above could not have been done without some reference from http://www.city-fan.org/tips/YumRepoFromImages
They also have an excellent tutorial for copying iso from DVDs


Deepak Kumar Msihra said...

Hi.. Thanks for this beautiful info..
But when i tred yum always searched in baseURL/Fedora/RPMS

so i moved all my rpms inside baseurl/Fedora/RPMS by creating dirs.. and it worked..

n e way thanks

maggie said...

Hi deepak,

great that it worked!

But which step was it that had a problem? maybe I can modify my post some more so that it'll be clearer for others

Athreya said...

Thanks So much , I too don't have the internet connection in my home and faced the same probelm. I was very disappointed.

Saw the steps you mentioned in the blog , followed it as it is.

Wow !!!Everything is fine now.

Thanks so much

Athreya VC

maggie said...

Glad to be of help! :D

Anonymous said...

Hi ,

I ran into trouble again. Now when i open ADD/REMOVE Programs it is working. But if i select i package and try to install,getting error as "unable to read the package header"(I am not very specific here abt the error, if needed I can attach the screenshot ).

Did you get such error?

Please let me know if you have any solution ?

Best Regards,

Athreya VC

maggie said...

Hi Athreya, sorry I've been really busy, can you attaCH a screenshot here? or email it to me at widdlepuke@gmail.com

Jay said...

Thanks! I was looking for a solution for this. I included your post in my blog.

Stephen C said...

It works great now. Thanks Maggie

Anonymous said...

thanks man, but is there a way to get the add remove software util to till me what cd should insert and stuff, so that it does the job automatically like the old days of redhat ??