Monday, December 26, 2011

YUM SERVER

How to setup local yum repository on RedHat :

At first we need to setup vsftpd & createrepo package :
[root@localhost named]# cd /media/RHEL_5.4\ i386\ DVD/Server/


[root@localhost Server]# rpm -ivh vsftpd-2.0.5-16.el5.i386.rpm
warning: vsftpd-2.0.5-16.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]
[root@localhost Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]

Copy all the rpm file from server CD to a specific directory /var/ftp/pub/Server


createrepo : createrepo is a program that creates a repomd (xml-based rpm metadata) repository from a set of rpms.We run the createrepo command only when a new package has been added to the repo.
 
[root@localhost ~]# createrepo /var/ftp/pub/Server/
1009/2230 - jakarta-commons-collections-testframework-javadoc-3.2-2jpp.3.i386.rp2230/2230 - kde-i18n-Norwegian-Nynorsk-3.5.4-1.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata


Now we edit (.repo)file.Here we copy and rename rhel-debuginfo.repo file as a myserver.repo

[root@localhost etc]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
rhel-debuginfo.repo
[root@ns1 yum.repos.d]# cp  rhel-debuginfo.repo rhel-debuginfo.repo.bak
[root@ns1 yum.repos.d]# rm -rf rhel-debuginfo.repo
[root@ns1 yum.repos.d]# cp  rhel-debuginfo.repo.bak myserver.repo
[root@ns1 yum.repos.d]# ls 
myserver.repo  rhel-debuginfo.repo.bak 
[root@localhost yum.repos.d]#vim myserver.repo
[myserver-repo]
name=saiful repository server
baseurl=ftp://192.168.50.19/pub/Server
enable=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


[root@localhost /]# locate repodata
[root@ns1 named]# chkconfig vsftpd on
[root@ns1 named]# /etc/init.d/vsftpd restart