Download the epel-release and dag repos
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Create the following directories for local yum setup
| Parent Directory | mkdir -p /var/ftp/pub/ |
| Local Repo directories | mkdir -p /var/ftp/pub/{epel,dag,centos,DVD} |
| Local Repo configuration and keys | mkdir /var/ftp/pub/local-repos |
| Scripts location | mkdir /var/ftp/pub/scripts |
| Cron for yum updates | mkdir /etc/cron.daily/mirrors/ |
Install httpd and symlink /var/ftp/pub to /var/www/html/pub so it can be seen over http
yum install httpd
ln -s /var/ftp/pub /var/www/html/pub
Export /var/ftp/pub
vim /etc/exports
/var/ftp/pub *.domain(rw,no_root_squash)
exportfs -a
Install createrepo
yum install createrepo
| Local repo directory | mkdir -pv /var/ftp/pub/centos/5.2 /{os,updates}/i386 |
| DVD mount of centos | mount -o loop /var/ftp/pub/DVD/c5.iso /mnt/ |
| Copy files | rsync -avH /mnt/ /var/ftp/pub/centos/5.2/os/i386/ |
| Create repository header | createrepo /var/ftp/pub/centos/5.2/os/i386/ |
Add centos repo file to start looking at the local repository, remove the one looking to the external site.
vim /etc/yum.repos.d/local-centos.repo
[local-centos]
name=CentOS-$releasever - Base
baseurl=http://yum.general.local/centos/5.2/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-c5
[centos-update]
name=CentOS-$releasever - Updates
baseurl=http://yum.general.local/centos/5.2/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-c5
Copy the GPG keys and local configuration file to: /var/ftp/pub/local-repo/
| Local repo directory | mkdir -pv /var/ftp/pub/epel/5/ |
vim /etc/yum.repos.d/local-epel.repo
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
baseurl=http://yum.general.local/pub/epel/5/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
baseurl=http:// yum.general.local /pub/epel/5/$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
baseurl=http:// yum.general.local /pub/epel/5/$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
Copy the GPG keys and local configuration file to: /var/ftp/pub/local-repo/
| Local repo directory | mkdir -pv /var/ftp/pub/rpmforge/ |
Modify the rpmforge repo file
vim /etc/yum.repos.d/local-dag.repo
[local-rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
#baseurl = http://apt.sw.be/redhat/el5/en/$basearch/dag
#mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
failovermethod = priority
#baseurl = http://yum.general.local/pub/rhel/el5/i386/rpmforge
baseurl = http://yum.general.local/pub/rpmforge/el5/en/i386/dag
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
Copy the GPG keys and local configuration file to: /var/ftp/pub/local-repo/
Add script the following scripts to /etc/cron.daily/mirrors/
rsync-dag.sh
rsync-epel.sh
rsync-centos.sh