Sunday, May 17, 2009

How to Create your own RHEL5 yum repository

Createrepo Tool

Creating your own yum repository is the easy way to install packages on Red Hat, Fedora, CentOS or RPM - based Linux distributions. You can make your own server or CD/DVD-Rom to host your own repository. It will decrease installation time of your packages and saves your bandwidth.


Make your own Red Hat Enterprises Linux 5 repository server




Install createrepo tool

Find createrepo package for your operating system. some are listed below:

for Red Hat Enterprises Linux 5 or CentOS 5 x86 64
http://yum.uit.no/repos/CentOS5-x86_64/RPMS.rpmforge/

for Red Hat Enterprises Linux 5 or CentOS 5 x86 32
http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/


more free repository list

login as root and make a folder to get the packages and install
#mkdir /root/downloads
#cd /root/downloads


Use wget and download the package
#wget http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/createrepo-0.4.10-1.el5.rf.noarch.rpm

install the package using rpm


use your package version instead of the following "createrepo-0.4.XX-X.el5.rf.noarch.rpm"

#rpm -ivh createrepo-0.4.10-1.el5.rf.noarch.rpm

check installed package
#rpm -qa createrepo



Make repository

make folders
#mkdir -p /var/ftp/repo/RHEL5/i386/


copy your rpm package from CD,DVD or what ever you have.
To copy from CD, mount CD-ROM or use the GUI tool

#mkdir /media/cd
#mount /dev/cdrom /media/cd

find your packages and copy to following folders
ex:- 64 Bit packages to ~/RHEL5/x86_64
32 Bit packages to ~/RHEL5/i386


create repository data
#cd /var/ftp/repo/RHEL5/i386/
#createrepo .


run "createrepo ." command in all folders.
"repo RHEL5"

You can add packages later then your have to run this command again or use script to automate


Distribute your Repository

Distribute repository using CD, DVD

You can distribute your repository data using CD,DVD of USB drive or any media.
Use your REPO folder that you should create inside the path /var/ftp.


Distribute repository using an FTP server

Using Very Secure FTP Daemon (vsftpd) is a great way to host your repository data.

install vsftpd and start services
#cd /root/Downloads
#wget ftp://ftp.muug.mb.ca/mirror/centos/5.2/os/i386/CentOS/vsftpd-2.0.5-12.el5.i386.rpm

find it here http://rpm.pbone.net/index.php3/stat/4/idpl/8078351/com/vsftpd-2.0.5-12.el5.i386.rpm.html


install package using rpm

#rpm -ivh vsftpd-2.0.5-12.el5.i386.rpm

Start services
#/etc/init.d/vsftpd start

If your repository data in /var/ftp now you can access your folder using ftp



No comments: