Thursday, April 16, 2009

How to create a local Repository for Linux!

Creating a Local Repository of Yum and apt:-

You should have a FTP server or HTTP server to make yum actually working. However since we haven't really gone through setting up FTP or HTTP server, please read-on and understand the process. If you have got vsftpd installed, use that. Otherwise, don't forget to actually set it up yourself later.

Here we will create a local repository for Fedora and CentOS in the easy way.

0. You should have the yum as well as the createrepo package installed first.

1. Create the directory to hold the repository.

mkdir -p /var/ftp/pub/yum-repo/centos/
mkdir -p /var/ftp/pub/yum-repo/fedora/

2. createrepo /var/ftp/pub/yum-repo/centos/ ; createrepo /var/ftp/pub/yum-repo/fedora/ will create the local yum repository by creating a folder named "repodata with four xml files named, filelists.xml.gz, other.xml.gz, primary.xml.gz and repomd.xml

You will have to run the createrepo command each time a rpm is added there.

3. Now in the client's yum.conf, add the repo directly. However in recent versions, the repositories are put in a separate directory called /etc/yum.repos.d/ . If so, put the contents in a filename, with the extension .repo

[humanlinux repo]
name=Fedora Core $releasever - humanlinux Local Repo
baseurl=file:///var/ftp/pub/yum-repo/fedora/
enabled=1
gpgcheck=0
#gpgkey=file:///path/to/your/RPM-GPG-KEY

Fedora Specific Local Repository:- 

NB : You can create directories inside /var/ftp/pub/yum-repo/fedora/ to look like /var/ftp/pub/yum-repo/fedora/base/8/i386 , /var/ftp/pub/yum-repo/fedora/updates/8/i386 , /var/ftp/pub/yum-repo/fedora/base/9/i386, /var/ftp/pub/yum-repo/fedora/updates/9/i386 and so on.

1) Filling the repos with RPMs:- 

Copy the rpm packages to /var/ftp/pub/yum-repo/fedora/ or /var/ftp/pub/yum-repo/fedora/base/8/i386 from the DVD's Packages directory.

OR

rsync from a rsync supported mirror from the list, http://mirrors.fedoraproject.org//mirrorlists/publiclist/Fedora/8/ like rsync://ftp.sh.cvut.cz/fedora/linux and

rsync -avrt rsync://ftp.sh.cvut.cz/fedora/linux/releases/8/Everything/i386/os/ /var/ftp/pub/yum-repo/fedora/base/8/i386 (remember to have a slash after os/ :-))

2) Updates and regular downloading:- 

/var/ftp/pub/yum-repo/fedora/updates/8/i386

rsync the updates from rsync://ftp.sh.cvut.cz/fedora/linux/updates/8/i386/ to /var/ftp/pub/yum-repo/fedora/updates/8/i386

And then enter the command in a cron job too, to download the updates frequently.

Creating Apt repository:- 

This is done using the apt-mirror tool. Download and install apt-mirror first and then edit the /etc/apt/mirror.list ( to list which packages tree should be mirrored ) which is similar to /etc/apt/sources.list.

apt-mirror will do the rest of the job. Once it is finished, clean up the repositories by running /var/spool/apt-mirror/var/clean.sh.

tell2humanlinux@gmail.com

10 comments:

  1. I think is nice post,cause not many blogger can write this trick for linux
    thanks
    im from http://egadged.blogspot.com

    ReplyDelete
  2. Thank you very much. Just the right one that i am looking for.

    ReplyDelete
  3. Its very briefly described set of information, which I have ever seen in any blog.I am really thankful to publisher.

    ReplyDelete
  4. Seriously..

    Reading the man page was like man pages always are:

    Yes,it had buttons and knobs and blinky lights and swirly things and arcane symbols and and and and... but provide actual real world examples? Ha! Whatever would we want to do that for?!?

    Thank your your clarity and brevity. It helped a lot.

    ReplyDelete
  5. I have to thank you for the efforts you have put in penning this site.
    I'm hoping to check out the same high-grade blog posts from you later on as well. In truth, your creative writing abilities has inspired me to get my very own site now ;)

    Feel free to surf to my site: organised

    ReplyDelete
  6. Hello! This post could not be written any better!
    Reading this post reminds me of my good old room mate! He always kept
    chatting about this. I will forward this write-up to him.
    Pretty sure he will have a good read. Many thanks for sharing!


    my web-site chapter 7 bankruptcy florida

    ReplyDelete
  7. I’νe been browsіng online more than five hrs now, and aftеr noticing
    you on http://humаnlinuх.blοgspot.
    com/, I dеfіnitely haνen't encountered any interesting posts like yours. In my opinion, if all web site entrepreneurs and blog writers created top notch information as you have, the internet will be a lot more helpful than at any time earlier.

    Here is my web blog: gonidium

    ReplyDelete
  8. Some sort of crushed ice crushing, blending, lowering, cutting,
    and as a consequence shredding can be accomplished appearing
    in blenders. A person's fruit or vegetable operates while in the car, macerated due to the fact personal computer, and afterwards went back to discrete chambers as well as charge in addition pulp. Rind kiwis and as well as fresh fruit, fluid and revel in.Individuals who are well-liked of the several other wife's straight after she'd his or her knowledge dental stripped away from as wouldn't normally digest colours!
    Ok we're on the right course.

    My site :: oster blender processor

    ReplyDelete
  9. Bath an the vegetable tomatoes plus shave those by 50 %.
    Jewelry may possibly stay clear of high temperatures relating to shooting can certainly be make about the dampen clay courts.
    Require an alternative chiminea to change a historical perhaps defective design and style, you may have
    a great concept of exactly what contemplating, yet it is in
    spite of everything wise to look into the available choices it does a final decision with
    there being much emerging variants open. Its as well best to find
    yourself so for the fact besides your voguish come across, what is more gifts coziness.


    My web-site best electric ovens

    ReplyDelete