首页 > 代码库 > 使用createrepo自定义yum源
使用createrepo自定义yum源
使用createrepo自定义yum源
自制yum源有时也很有必要的,比如为了自定义自己的软件,为了安全,或者为了高大上!
下面是基本思路,后面附有实验步骤,其核心是你选择的rpm的用途和质量
1,准备所有必需rpm包,上传到yum服务器/var/www/html/cdn/x86_64目录下
2,使用createrepo创建自己的yum源
yum -y install createrepo
createrepo -u -o -d /var/www/html/cdn/
3,客户端设置cdn.repo源
[cdn]
name=cdnrepo
baseurl=http://ip of yum server/cdn
gpgcheck=0
enabled=1
4,客户端验证
yum clean all
yum list all
yum intall xxx
实验结果:
服务端:
这里只是做一个samba源,相关软件包有samba*,libsmbclient*, libtalloc*,libtevent*
1,准备所有必需rpm包在/var/www/html/cdn/x86_64目录下
libsmbclient-3.6.9-164.el6.i686.rpm samba-client-3.6.9-164.el6.x86_64.rpm
libsmbclient-3.6.9-164.el6.x86_64.rpm samba-common-3.6.9-164.el6.i686.rpm
libsmbclient-devel-3.6.9-164.el6.i686.rpm samba-common-3.6.9-164.el6.x86_64.rpm
libsmbclient-devel-3.6.9-164.el6.x86_64.rpm samba-doc-3.6.9-164.el6.x86_64.rpm
libtalloc-2.0.7-2.el6.i686.rpm samba-domainjoin-gui-3.6.9-164.el6.x86_64.rpm
libtalloc-2.0.7-2.el6.x86_64.rpm samba-swat-3.6.9-164.el6.x86_64.rpm
libtalloc-devel-2.0.7-2.el6.i686.rpm samba-winbind-3.6.9-164.el6.x86_64.rpm
libtalloc-devel-2.0.7-2.el6.x86_64.rpm samba-winbind-clients-3.6.9-164.el6.i686.rpm
libtevent-0.9.18-3.el6.i686.rpm samba-winbind-clients-3.6.9-164.el6.x86_64.rpm
libtevent-0.9.18-3.el6.x86_64.rpm samba-winbind-devel-3.6.9-164.el6.i686.rpm
libtevent-devel-0.9.18-3.el6.i686.rpm samba-winbind-devel-3.6.9-164.el6.x86_64.rpm
libtevent-devel-0.9.18-3.el6.x86_64.rpm samba-winbind-krb5-locator-3.6.9-164.el6.x86_64.rpm
samba-3.6.9-164.el6.x86_64.rpm
2,使用createrepo创建自己的yum源
#yum -y install createrepo
#createrepo -u -o -d /var/www/html/cdn
25/25 - x86_64/libsmbclient-3.6.9-164.el6.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
# pwd
/var/www/html/cdn
# ls -R
.:
repodata x86_64
./repodata:
filelists.sqlite.bz2 filelists.xml.gz other.sqlite.bz2 other.xml.gz primary.sqlite.bz2 primary.xml.gz repomd.xml
./x86_64:
libsmbclient-3.6.9-164.el6.i686.rpm samba-client-3.6.9-164.el6.x86_64.rpm
...
客户端:
1,设置repo
[cdn]
name=cdnrepo
baseurl=http://172.17.0.83/cdn
gpgcheck=0
enabled=1
2,安装验证
先清空缓存
#yum clean all
Loaded plugins: fastestmirror, refresh-packagekit
Cleaning repos: cdn
Cleaning up Everything
Cleaning up list of fastest mirrors
重新生成缓存并检查yum源是否正确
# yum list all |grep cdn
libsmbclient.i686 3.6.9-164.el6 cdn
libsmbclient.x86_64 3.6.9-164.el6 cdn
libsmbclient-devel.i686 3.6.9-164.el6 cdn
3.6.9-164.el6 cdn
libtalloc.i686 2.0.7-2.el6 cdn
libtalloc.x86_64 2.0.7-2.el6 cdn
libtalloc-devel.i686 2.0.7-2.el6 cdn
libtalloc-devel.x86_64 2.0.7-2.el6 cdn
libtevent.i686 0.9.18-3.el6 cdn
libtevent.x86_64 0.9.18-3.el6 cdn
libtevent-devel.i686 0.9.18-3.el6 cdn
libtevent-devel.x86_64 0.9.18-3.el6 cdn
samba.x86_64 3.6.9-164.el6 cdn
samba-client.x86_64 3.6.9-164.el6 cdn
samba-common.i686 3.6.9-164.el6 cdn
samba-common.x86_64 3.6.9-164.el6 cdn
samba-doc.x86_64 3.6.9-164.el6 cdn
3.6.9-164.el6 cdn
samba-swat.x86_64 3.6.9-164.el6 cdn
samba-winbind.x86_64 3.6.9-164.el6 cdn
3.6.9-164.el6 cdn
3.6.9-164.el6 cdn
3.6.9-164.el6 cdn
3.6.9-164.el6 cdn
3.6.9-164.el6 cdn
最终安装测试
这里是安装samba,依赖的包比较少libtalloc、libtalloc、samba-common、samba-winbind 、samba-winbind-clients
# yum install samba
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.6.9-164.el6 will be installed
--> Processing Dependency: samba-winbind-clients = 3.6.9-164.el6 for package: samba-3.6.9-164.el6.x86_64
--> Processing Dependency: samba-common = 3.6.9-164.el6 for package: samba-3.6.9-164.el6.x86_64
--> Processing Dependency: libtalloc.so.2(TALLOC_2.0.2)(64bit) for package: samba-3.6.9-164.el6.x86_64
--> Processing Dependency: libtevent.so.0(TEVENT_0.9.9)(64bit) for package: samba-3.6.9-164.el6.x86_64
--> Processing Dependency: libwbclient.so.0()(64bit) for package: samba-3.6.9-164.el6.x86_64
--> Processing Dependency: libtevent.so.0()(64bit) for package: samba-3.6.9-164.el6.x86_64
--> Processing Dependency: libtalloc.so.2()(64bit) for package: samba-3.6.9-164.el6.x86_64
--> Running transaction check
---> Package libtalloc.x86_64 0:2.0.7-2.el6 will be installed
---> Package libtevent.x86_64 0:0.9.18-3.el6 will be installed
---> Package samba-common.x86_64 0:3.6.9-164.el6 will be installed
---> Package samba-winbind-clients.x86_64 0:3.6.9-164.el6 will be installed
--> Processing Dependency: samba-winbind = 3.6.9-164.el6 for package: samba-winbind-clients-3.6.9-164.el6.x86_64
--> Running transaction check
---> Package samba-winbind.x86_64 0:3.6.9-164.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
samba x86_64 3.6.9-164.el6 cdn 5.0 M
Installing for dependencies:
libtalloc x86_64 2.0.7-2.el6 cdn 20 k
libtevent x86_64 0.9.18-3.el6 cdn 26 k
samba-common x86_64 3.6.9-164.el6 cdn 10 M
samba-winbind x86_64 3.6.9-164.el6 cdn 2.1 M
samba-winbind-clients x86_64 3.6.9-164.el6 cdn 2.0 M
Transaction Summary
=====================================================================================================================================
Install 6 Package(s)
Total download size: 19 M
Installed size: 68 M
Is this ok [y/N]:
本文出自 “jerrymin” 博客,请务必保留此出处http://jerrymin.blog.51cto.com/3002256/1543806
使用createrepo自定义yum源