Posted by: charan | May 19, 2008

Create a Yum Repository locally on Fedora 9

In our college internet bandwidth is a bit slow at times.It is very difficult to download packages and install or upgrade directly from internet.It becomes very congested when many users start to download the basic same packages or updates,which can be shared.So I thought of setting up a local repository for my fellow fedora users.Here are the basic steps to create a local yum repository.

First go to Administration in the system panel and services.This lists out all the services that are running on the machine and services,daemons that can be run.We need a web server running to host the packages for others to use.So see that httpd is enabled and running.

Open up your favourite browser and type localhost to see whether the apache server is setup.

Next we to create a few directories for packages we are going to mirror on our machine.All the files of the webserver of the localhost are located at “/var/www/html/”.
So
1.) cd /var/www/html/
Now create a directory yum using the mkdir.
2.) mkdir yum
Now you can define the directory structure to your mirror.I would prefer…
Fedora/9/”base;updates” –for Fedora 9
3.)mkdir -pv /var/www/html/yum/Fedora/9/{base,updates}
If you think you don’t have enough space on particular partition.Then create a folder “base;updates” anywhere you want and link it.
4.) mkdir /home/solo/Downloads/base
5.) mkdir /home/solo/Downloads/updates
6.) ln -s /home/solo/Downloads/base /var/www/html/yum/Fedora/9/base
Now copy the rpm’s that you have in your cd’s or dvd.
7.) cp /mnt/cdrom/Fedora/RPMS/*.rpm /var/www/html/yum/Fedora/9/base/
Next we want to also put the rpm’s which we have downloaded from the internet.Generally yum clears the caches once it installs the packages and its dependencies.So we have to store the packages even after finishing the installation or upgrade.
For this we have make a small change in the yum configuration file.
8.) vim /etc/yum.conf
It presents you with the following

Change the keepcache=0 on line 3 value to 1 from 0.This lets you to store the cache.You can even change the cache directory to our storage directory by specifying on line 2.
Next we have to create base repository headers.Go to the base directory.
9.) cd /var/www/html/Fedora/9/base
10.) createrepo .
This will create the base repository headers and similarly to all the folders on our server.Now we have to make these changes to the yum.conf for using our local repository and all those on our network who wants use your machine as a mirror.
[updates-released]
name=Fedora $releasever – $basearch – Released Updates
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
baseurl=http://192.168.0.xx/yum/Fedora/9/updates/$basearch/
enabled=1
gpgcheck=1

[base]
name=Fedora $releasever – $basearch – Base
baseurl=http://192.168.0.xx/yum/Fedora/$releasever/base/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1

Substitute your machine local ip address for 192.168.0.xx
Have fun mirroring packages and creating a local repository.


Leave a response

Your response:

Categories