Friday, October 2, 2009

How to create a Fedora or Ubuntu repository

First of all let me tell you why you should create a local repository.

It happens many times that we need some software for our Linux OS but internet connection is too crappy or inaccessible at times. A local repo comes handy in these cases. Also install speed increases considerably because of rapid download.
Organizations using linux can save a lot of money and bandwidth by creating a local repository since packages are downloaded once into the repository server and all the computers can get the packages directly from the local repo server at a much high speed.
Following are the steps to create Fedora repo. Ubuntu repo is also created similarly.

  1. We will create this repository in such a way that it is available using http. If you are creating this repo for your personal use and not on a server then you can skip this step. Since we are creating this on a server it is safe to assume that apache is already installed. If apache is not installed then type yum install httpd as root (Ubuntu users should type sudo apt-get install apache2). After the install start apache by using /etc/init.d/httpd start. The default document root is /var/www/html, so we'll create the repo in /var/www/html/repo.
  2. To create a repo we need a tool called createrepo which is available in fedora repository. Typs yum install createrepo to get this tool. Now create two folder in this way :-
    mkdir -p /var/www/html/repo/base/11/i386
    mkdir -p /var/www/html/repo/updates/11/i386

  3. Now we have to to populate these folders with packages. There are two ways of doing so. Either start by copying the packages present in fedora install dvd then use the rsync protocol to populate the rest of the packages or start by rsync only. To use rsync type rsync -avrt rsync:// /var/www/html/repo/base/11/i386.
    rsync -avrt rsync:// --exclude=debug/ /var/www/html/repo/updates/11/i386
    These are indicative addresses only to show the method. A complete list of rsync mirrors can be found at fedora website.
  4. Now run createrepo /var/www/html/yum/base/8/i386 to get the repo ready.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.