createrepo简单使用
一环境说明
在99.48.236.64上测试
目录说明
1).制作的 yum 源根目录 /root/test/local-yum
2).yum源的下的packages /root/test/local-yum/Packages
二实践
1. 将rpm包拷贝至Packages目录下
[root@scctmpdev02101 Packages]# cp {samba*,httpd*} /root/test/local-yum/Packages/
[root@scctmpdev02101 Packages]# ll /root/test/local-yum/Packages/
total 54980
-r--r--r-- 1 root root 840348 Jan 22 17:45 httpd-2.2.15-26.el6.x86_64.rpm
-r--r--r-- 1 root root 153304 Jan 22 17:45 httpd-devel-2.2.15-26.el6.i686.rpm
-r--r--r-- 1 root root 153260 Jan 22 17:45 httpd-devel-2.2.15-26.el6.x86_64.rpm
-r--r--r-- 1 root root 801768 Jan 22 17:45 httpd-manual-2.2.15-26.el6.noarch.rpm
-r--r--r-- 1 root root 74040 Jan 22 17:45 httpd-tools-2.2.15-26.el6.x86_64.rpm
-r--r--r-- 1 root root 5291592 Jan 22 17:45 samba-3.6.9-151.el6.x86_64.rpm
-r--r--r-- 1 root root 366648 Jan 22 17:45 samba4-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 430140 Jan 22 17:45 samba4-client-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 625132 Jan 22 17:45 samba4-common-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 12208 Jan 22 17:45 samba4-dc-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 12240 Jan 22 17:45 samba4-dc-libs-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 271736 Jan 22 17:45 samba4-devel-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 4225800 Jan 22 17:45 samba4-libs-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 110128 Jan 22 17:45 samba4-pidl-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 1835808 Jan 22 17:45 samba4-python-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 73232 Jan 22 17:45 samba4-swat-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 1573800 Jan 22 17:45 samba4-test-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 386304 Jan 22 17:45 samba4-winbind-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 103140 Jan 22 17:45 samba4-winbind-clients-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 16860 Jan 22 17:45 samba4-winbind-krb5-locator-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r-- 1 root root 11370160 Jan 22 17:45 samba-client-3.6.9-151.el6.x86_64.rpm
-r--r--r-- 1 root root 10501248 Jan 22 17:45 samba-common-3.6.9-151.el6.i686.rpm
-r--r--r-- 1 root root 10533520 Jan 22 17:45 samba-common-3.6.9-151.el6.x86_64.rpm
-r--r--r-- 1 root root 2259588 Jan 22 17:45 samba-winbind-3.6.9-151.el6.x86_64.rpm
-r--r--r-- 1 root root 2112292 Jan 22 17:45 samba-winbind-clients-3.6.9-151.el6.i686.rpm
-r--r--r-- 1 root root 2114056 Jan 22 17:45 samba-winbind-clients-3.6.9-151.el6.x86_64.rpm
[root@scctmpdev02101 Packages]# ll /root/test/local-yum/
total 4
drwxr-xr-x 2 root root 4096 Jan 22 17:45 Packages
2 制定yum源的根目录生成repodata
[root@scctmpdev02101 ~]# createrepo /root/test/local-yum/
Spawning worker 0 with 26 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@scctmpdev02101 ~]# ll /root/test/local-yum/
total 8
drwxr-xr-x 2 root root 4096 Jan 22 17:45 Packages
drwxr-xr-x 2 root root 4096 Jan 22 17:47 repodata
3测试新建的yum源是否可用
[root@scctmpdev02101 ~]# vim /etc/yum.repos.d/rhel_local.repo
[local-yum]
name=local-yum
baseurl=file:///root/test/local-yum/
enabled=1
gpgcheck=0
[root@scctmpdev02101 ~]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: local-yum
Cleaning up Everything
[root@scctmpdev02101 ~]# yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
local-yum | 2.9 kB 00:00 ...
local-yum/filelists_db | 20 kB 00:00 ...
local-yum/primary_db | 45 kB 00:00 ...
local-yum/other_db | 9.7 kB 00:00 ...
Metadata Cache Created
[root@scctmpdev02101 ~]# yum list available
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Available Packages
httpd.x86_64 2.2.15-26.el6 local-yum
httpd-devel.i686 2.2.15-26.el6 local-yum
httpd-devel.x86_64 2.2.15-26.el6 local-yum
httpd-manual.noarch 2.2.15-26.el6 local-yum
httpd-tools.x86_64 2.2.15-26.el6 local-yum
samba-common.i686 3.6.9-151.el6 local-yum
samba4.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-client.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-common.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-dc.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-dc-libs.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-devel.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-libs.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-pidl.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-python.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-swat.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-test.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-winbind.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-winbind-clients.x86_64 4.0.0-55.el6.rc4 local-yum
samba4-winbind-krb5-locator.x86_64 4.0.0-55.el6.rc4 local-yum