download local copy of CentOS yum repository for offline use

I have a CentOS 5.6 machine set up on a private network without public internet access. In the interest of time and frustration, I would prefer to be able to install packages using Yum as I would if the machine were online. Is it possible to download a copy of the repositories that can be stored on a network local machine from which I can do this? please provide me any instructions I might need if it is possible.

So to break it down, I want yum install gcc to install gcc without an internet connection.


This is a simple thing to achieve assuming you have a web server set up on your local machine.

If you need help with that, ask a new question :)

You basically rsync a repo to your local machine and set it up as a local website then point your URL at that in your yum configuration.

There is a pretty straight forward guide on the steps involved on howtoforge.com

There will be a maintenance overhead moving forward with keeping your repo updated with updates to the main repositories, so I wouldn't recommend this as a good idea for everyone but if you have the need for a local repo ( for example, you have a lot of machines on a LAN and want to save on bandwidth ) then this can be a good way to go.