Saturday, April 17, 2010

How to use fedora distribution dvd as a yum repository?

I have just learnt how to use fedora distribution DVD as a yum repository. That is I am wanting to install rpm packages from the DVD using yum commands like:

yum install packagename

After googling a bit, I did it. Actually here is no credit of mine, I just did what the Linux bigwigs told me to do. I just want to share it with you. This is how you can do it.

There are the following steps:
1) Mount your DVD in a folder.
2) Change in an existing repository information.
3) Now use yum commands or Add/Remove Sofware panel to install software from dvd.

1)Mount your DVD in a folder:

Insert your fedora DVD in the DVD-rom. Now create a folder to mount. I created the folder in /media. I named it as dvd-rom. Write this command in the terminal being root or super user:

mkdir /media/dvd-rom

Now mount by :

mount /dev/cdrom /media/dev-rom

If you see the following line then the mount is successful.

mount: block device /dev/sr0 is write-protected, mounting read-only

You can dive into the folder dvd-rom and check whether you can see content in it to make sure that the mounting is successful.

2) Change in an existing repository information.

Open the file /etc/yum.repos.d/fedora.repo by any editor. I used gedit.

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

You will see the following information in it.

[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch


Now comment out the following lines:
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
#mirrorlist=http://mirrors.fedoraproject.org.

Instead add the following line:

baseurl=file:///media/dvd-rom/

Make sure that the value of enabled is 1.

enabled=1

After the change, it will look like this:

[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=file:///media/dvd-rom/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch


Now save the file and quit. You have to do all the editing being a root or super user. Otherwise you cant edit the file.

3) Now use yum commands or Add/Remove Sofware panel to install software from dvd:

Go to System->Administration->Add/Remove Software. Make sure that under System->Software Sources ¨Fedora 10 - i386 ¨ is checked. This is the repository that is going to use fedora dvd for the packages.

You have done it. Enjoy faster installation through yum.

No comments:

Post a Comment