You can create and maintain a local repo with reposync. Reposync will use the URLs you have configured in your /etc/yum.repos.d/*.repo files.
Reposync is downloading files in parallel, so it is quite fast.
To create local repositories that can be served through your local web server (assuming you have a web server running with /var/www/html as the document root):
Code: Select all
sudo yum install createrepo yum-utils
sudo mkdir -p /var/www/html/repos/{base,centosplus,extras,updates}
Synchronize the directories for the repositories. Thew --newest-only option puts only the latest version of each package in the repos.
Code: Select all
sudo reposync --gpgcheck --plugins --repoid=base \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/var/www/html/repos/
sudo reposync --gpgcheck --plugins --repoid=centosplus \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/var/www/html/repos/
sudo reposync --gpgcheck --plugins --repoid=extras \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/var/www/html/repos/
sudo reposync --gpgcheck --plugins --repoid=updates \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/var/www/html/repos/
Create (or update) new repodata for the local repositories. Note the option "-g comps.xml" to update the package group information.
Code: Select all
sudo createrepo /var/www/html/repos/base/ -g comps.xml
sudo createrepo /var/www/html/repos/centosplus/
sudo createrepo /var/www/html/repos/extras/
sudo createrepo /var/www/html/repos/updates/
Add a new /etc/yum.repos.d/internal-repos.repo file on your clients to point to your local repository server. Give it the following contents, replacing
myreposerver.mydomain with the name of your server:
Code: Select all
# File:/etc/yum.repos.d/internal-repos.repo
[internal-base]
name=CentOS Base
baseurl=http://myreposerver.mydomain/repos/base/
gpgcheck=0
enabled=1
[internal-centosplus]
name=CentOS CentOSPlus
baseurl=http://myreposerver.mydomain/repos/centosplus/
gpgcheck=0
enabled=1
[internal-extras]
name=CentOS Extras
baseurl=http://myreposerver.mydomain/repos/extras/
gpgcheck=0
enabled=1
[internal-updates]
name=CentOS Updates
baseurl=http://myreposerver.mydomain/repos/updates/
gpgcheck=0
enabled=1
You will have to synchronize your local repositories every now and then to get in updates and security patches. This is conveniently done by creating a cron job that executes the reposync and createrepo commands listed above at regular intervals.