7.5 Maintaining the Repository
Patch management means that you have to maintain updates for all the computers on your network. For the repositories that you’ve created, that means you need to keep them up to date. Generally, that means configuring updates as a cron job, not only for clients, but between your local repository and the mirror of your choice. You’ve seen samples of the cron jobs you can use for clients in Chapter 6. In this section, we’ll see how you can maintain a local repository.
As repositories are kept up to date, sometimes headers can be corrupted. In that case, you can delete the headers, whether from the headers/ directory or from the compressed files in the repodata/ directory.
7.5.1 Updating Packages
Generally, you’ll want to update repositories on a daily (or nightly) basis. After a repository is created, the required downloads go down significantly. In most cases, you’ll be able to create your own script in the /etc/cron.daily directory, which is automatically run on a daily basis, as determined by the schedule as defined in /etc/crontab.
As you saw earlier, the following command can synchronize files on the noted local directory with a remote server at mirrors.kernel.org:
rsync -av --exclude debug rsync://mirrors.kernel.org/fedora/core/updates/3/i386/* /var/ftp/pub/yum/3/i386/updates/
I’ve created the repo file in my /etc/cron.daily directory and added the following commands:
#!/bin/sh rsync -av --exclude debug rsync://mirrors.kernel.org/fedora/core/updates/3/i386/* /var/ftp/pub/yum/3/i386/updates/
7.5.2 Cleaning Header Information
If there are problems with updates, check the applicable log file. It’s available in the yum.log file in the /var/log directory. In many cases, it can help to regenerate headers. In other words, you would take the following steps:
- Delete the headers/ or repodata/ subdirectory in your repository.
- Navigate to the directory with the repository.
- Regenerate the headers with the command that applies to your distribution: yum-arch or createrepo.