Pages

Monday, June 25, 2012

CentOS 5.2 Local Yum Repository HOWTO

If you are impatient and want to in have a CentOS 5.2 repository setup so that you don't have to wait for each of your systems to download off a CentOS mirror taking up your time which could be put to better use. Follow the following steps below and you shouldn't have a problem:

1. Install the vsftpd FTP server:

yum -y install vsftpd

2. Edit your /etc/vsftpd/vsftpd.conf and change anonymous_enable from NO, to YES and uncomment if necessary.
3. Enable the vsftpd service on bootup (System runlevels 2, 3, 4, 5):

/sbin/service vsftpd on

4. Verify you can login to your FTP server anonymously, which will convert a basic directory listing to an index.html (quick and dirty):

wget ftp://localhost/

5. Verify that you have the rsync utility installed, If it not installed install it (yum -y install rsync):

rpm -qa rsync

6. Locate user FTP's home directory which is the account the anonymous user uses:

echo ~ftp

7. Go to the directory shown:

cd ~ftp

8. Create all of the appropriate directories:

mkdir -pv pub/centos/5.2/{addons,centosplus,extras,fasttrack,os,updates}

9. Create a symbolic link from CentOS 5.2 to 5:

(cd ~ftp/pub/centos && ln -sf 5.2 5)

10. Go to CentOS Public Mirrors List and find a CentOS mirror which supports RSYNC.

11. Synchronize with a CentOS mirror now, I don't want SRPMS (Source RPMS), i386 RPMS or ISOs so you can adjust as necessary, This probably will take a while depending on what speed of connection you are on:

rsync -v -avrt rsync://<rsync server address and path to centos 5.2>/ --exclude=SRPMS/ --exclude=i386/ --exclude=*isos* /var/ftp/pub/centos/5.2

12. Add the command in step 11 after you have verified it works to your crontab and have it automatically update for you nightly or weekly or whenver you prefer.

13. While the synchronization is taking place you can create a new CentOS repository file which in the contents put:

[os]
name=CentOS-$releasever - OS (Local Repository)
baseurl=ftp://server/pub/centos/$releasever/os/$basearch/
gpgcheck=0
enabled=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


[updates]
name=CentOS-$releasever - Updates (Local Repository)
baseurl=ftp://server/pub/centos/$releasever/updates/$basearch/

gpgcheck=0

enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

[centosplus]
name=CentOS-$releasever - Plus (Local Repository)

baseurl=ftp://server/pub/centos/$releasever/centosplus/$basearch/

gpgcheck=0
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

[extras]
name=CentOS-$releasever - OS (Local Repository)


baseurl=ftp://server/pub/centos/$releasever/extras/$basearch/
gpgcheck=0
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5



[addons]
name=CentOS-$releasever - OS (Local Repository)
baseurl=ftp://server/pub/centos/$releasever/addons/$basearch/
gpgcheck=0

enabled=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

14. Replace the word "server" with the name of your server or IP address.

15. Distribute this file to your CentOS servers and run the command: yum update, which will update your local yum databases which track file versioning and locations of packages. On my servers, I also delete the CentOS-Base.repo because I don't need to download files from the CentOS repositories anymore.

No comments:

Post a Comment