First install the createrepo-0.9.9-17.el6.noarch.rpm
I built Yum before, so I installed it directly with Yum install.
My system is redhat6.
[[email protected] rpm-gpg]# yum install createrepoloaded plugins: Product-id, refresh-packagekit, security, subscription-managerthis system is not registered to Red Hat Subscription Management. You can use Subscription-manager to register. setting up install processresolving dependencies--> running transaction Check---> Package createrepo.noarch 0:0.9.9-17.el6 will be installed--> Processing Dependency: python-deltarpm for package: Createrepo-0.9.9-17.el6.noarch--> running transaction check---> Package Python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed--> processing Dependency: deltarpm = 3.5-0.5.20090913git.el6 for package: python-deltarpm-3.5-0.5.20090913git.el6.x86_64--> running transaction check---> package deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed--> Finished Dependency resolutiondependencies resolved========================================================================== ====== package arch Version repository size====== ==========================================================================installing: createrepo noarch 0.9.9-17.el6 rhel-source 94 kinstalling for dependencies: deltarpm x86_64 3.5-0.5.20090913git.el6 rhel-source 71 k python-deltarpm x86_64 3.5-0.5.20090913git.el6 rhel-source 27 ktransaction summary=============================================================================== =install 3 package (s) total download size: 192 kinstalled size: 518 kis this ok [y/n]: ydownloading packages:-- ------------------------------------------------------------------------------total 667 kb/ s | 192 kb 00:00running rpm_check_debugrunning transaction testtransaction test succeededrunning transaction installing : deltarpm-3.5-0.5.20090913git.el6.x86_64 1/3 Installing : python-deltarpm-3.5-0.5.20090913git.el6.x86_64 2/3 Installing : createrepo-0.9.9-17.el6.noarch 3/3rhel-source/productid | 1.7 kB 00:00 ... verifying : python-deltarpm-3.5-0.5.20090913git.el6.x86_64 1/3 verifying : createrepo-0.9.9-17.el6.noarch 2/3 Verifying : deltarpm-3.5-0.5.20090913git.el6.x86_64 3/3installed: createrepo.noarch 0:0.9.9-17.el6dependency installed: deltarpm.x86_64 0:3.5-0.5.20090913git.el6 python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6complete! You have new mail in /var/spool/mail/root
[Email protected] rpm-gpg]# Rpm-qa | grep createrepocreaterepo-0.9.9-17.el6.noarch
I have successfully installed
2. Under/root mkdir a folder Epel, I put the *.rpm copy to/root/epel that I had previously mounted under/mnt/packages
3. Modify the Rhel-source.repo file under/ETC/YUM.REPOS.D (possibly different file names)
[Email protected] yum.repos.d]# pwd/etc/yum.repos.d[[email protected] yum.repos.d]# Lsrhel-source.repo[[email Protected] yum.repos.d]# cat rhel-source.repo[rhel-base]name=red Hatbaseurl=file:///mntenabled=1gpgcheck=0[epel] Name=epelbaseurl=file:///root/epelenabled=1gpgcheck=0[[email protected] yum.repos.d]#
"Epel" is my newly added configuration
4. We execute the Yum repolist command to see
[[email protected] yum.repos.d]# yum repolistloaded plugins: product-id, Refresh-packagekit, security, subscription-managerthis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.file:///root/epel/repodata/repomd.xml: [errno 14] Could not open/read file:///root/epel/repodata/repomd.xmltrying other mirror.repo id repo name statusepel epel 0rhel-Base Red Hat 0repolist: 0[[email protected] yum.repos.d]#
Repo ID and repo name have shown the newly added Epel, but the error is missing repomd.xml, let me create a repomd.xml
5.
[[email protected] yum.repos.d]# createrepo /root/epel/spawning worker 0 with 15 pkgsworkers finishedgathering worker resultssaving primary metadatasaving file lists metadatasaving other metadatagenerating sqlite dbssqlite dbs complete[[email protected] yum.repos.d]# ls /root/epel/ php-5.3.3-22.el6.x86_64.rpm php-pear-1.9.4-4.el6.noarch.rpmphp-cli-5.3.3-22.el6.x86_64.rpm php-pecl-apc-3.1.9-2.el6.x86_64.rpmphp-common-5.3.3-22.el6.x86_64.rpm php-pecl-memcache-3.0.5-4.el6.x86_64.rpmphp-gd-5.3.3-22.el6.x86_64.rpm php-pgsql-5.3.3-22.el6.x86_64.rpmphp-ldap-5.3.3-22.el6.x86_64.rpm Php-soap-5.3.3-22.el6.x86_64.rpmphp-mysql-5.3.3-22.el6.x86_64.rpm php-xml-5.3.3-22.el6.x86_ 64.rpmphp-odbc-5.3.3-22.el6.x86_64.rpm php-xmlrpc-5.3.3-22.el6.x86_64.rpmphp-pdo-5.3.3-22.el6.x86_64.rpm repodata[[email protected] yum.repos.d]#
I first yum clean all clear down the cache and Yum repolist see if there is an error
[[Email protected] yum.repos.d]# yum clean allloaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to red hat subscription management. you can use Subscription-manager to register. cleaning repos: epel rhel-basecleaning up everything[[email protected] yum.repos.d]# yum repolistloaded plugins: product-id, refresh-packagekit, Security, subscription-managerthis system is not registered to red hat Subscription Management. You can use subscription-manager to register.epel | 2.9 kB 00:00 ...epel/primary_db | 14 kB 00:00 ...rhel-Base | 3.9 kb 00:00 ...rhel-Base/primary_db | 3.1 mb 00:02 ...repo id repo name statusepel epel 15rhel-base Red Hat 3,648repolist: 3,663[[email protected] yum.repos.d]#
Yum Repolist did not make a mistake, it seems that we have succeeded.
6. Testing
Yum List
Yum List all
Yum Install a software
[[Email protected] epel]# yum install php-5.3.3-22.el6.x86_64.rpmloaded plugins: product-id, refresh-packagekit, security, subscription-managerthis system is not registered to Red Hat Subscription Management. You can Use subscription-m anager to register. Setting up install processexamining php-5.3.3-22.el6.x86_64.rpm: php-5.3.3-22.el6.x86 _64marking php-5.3.3-22.el6.x86_64.rpm to be installedresolving dependencies--> running transaction check---> package php.x86_64 0:5.3.3-22.el6 will  BE INSTALLED--> PROCESSING DEPENDENCY: PHP-CLI (x86-64) = 5.3.3-22.el6 for package: php-5.3.3-22.el6.x86_ 64--> processing dependency: php-common (x86-64) = 5.3.3-22.el6 for&nbsP;package: php-5.3.3-22.el6.x 86_64--> running transaction check--- > package php-cli.x86_64 0:5.3.3-22.el6 will be installed---> Package php-common.x86_64 0:5.3.3-22.el6 will be installed--> Finished dependency resolutiondependencies resolved========================================================== ================================== package Arch Version Repository size========== ==================================================================================installing: php x86_64 5.3.3-22.el6 /php-5.3.3-22.el6.x86_64 3.5 MInstalling for dependencies: php-cli x86_64 5.3.3-22.el6 epel 2.2 M php-common x86_64 5.3.3-22.el6 epel 524 ktransaction summary================================================ ============================================install 3 package (s) Total size: 6.2 mtotal download size: 2.7 minstalled size: 13 mis this ok [y/n]: ^cexiting on user command[[email protected] epel]#
This article is from a "self-made" blog, be sure to keep this source http://baishouqijia.blog.51cto.com/2580498/1678306
Yum How to manually create a local yum repository