本文记录创建自定义yum仓库,目的为方便安装定制的rpm包及开源组件版本统一。
一、Build Local Repository
1、搭建web服务,自己定制的rpm包tengine,所以安装起来就很简单了。
#cd /home/master/software
#rpm -ivh rpm -ivh tengine-2.1.0-0.el6.x86_64.rpm
#vi /opt/config/tengine/vhost/repo.51auto.conf
server {
listen 80;
server_name 172.16.1.211;
location / {
root /home/master/software;
index index.htm index.html;
}
}
#/etc/init.d/rc.tengine start
2、安装createrepo(如果系统有安装这个包,忽略这步)
#yum install createrepo -y
3、自定义repo文件
#cd /etc/yum.repos.d
#vi localrepo.repo
[localrepo]
name=51auto Repository
baseurl=http://172.16.1.211/
gpgcheck=0
enabled=1
#createrepo -v /home/master/software/
After creating repository, disable or rename the existing repositories.
4、Now update the repository files:
#yum clean all
#yum update
//列出本地仓库的软件包
[root@localhost yum.repos.d]# ls -l /home/master/software/
总用量 275740
drwxrwxr-x+ 2 root root 4096 6月 9 14:41 repodata
-rw-rw-r-- 1 master master 138672945 4月 8 04:06 resin-4.0.43-0.el6.x86_64.rpm
-rw-rw-r-- 1 master master 11650040 3月 23 07:33 tengine-2.1.0-0.el6.x86_64.rpm
-rw-rw-r-- 1 master master 14703524 4月 29 10:40 tengine-tfs-2.1.0-0.el6.x86_64.rpm
-rw-rw-r-- 1 master master 117309328 4月 16 08:32 tomcat-6.0.43-0.el6.x86_64.rpm
二、Client Side Configuration
#cd /etc/yum.repos.d
#vi 51auto.repo
[51auto_repo]
name=51auto Repository
baseurl=http://172.16.1.211/
gpgcheck=0
enabled=1
#yum clean all
#yum update
//验证rpm包是否为自定义仓库的包
[root@s03 yum.repos.d]# yum list all |grep tomcat
tomcat.x86_64 1:6.0.43-0.el6 51auto_repo
//安装自定义的rpm包tomcat
[root@s03 yum.repos.d]# yum install tomcat -y
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tomcat.x86_64 1:6.0.43-0.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================
Installing:
tomcat x86_64 1:6.0.43-0.el6 51auto_repo 112 M
Transaction Summary
=================================================================================================================================================================================
Install 1 Package(s)
Total download size: 112 M
Installed size: 234 M
Downloading Packages:
tomcat-6.0.43-0.el6.x86_64.rpm | 112 MB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:tomcat-6.0.43-0.el6.x86_64 1/1
Verifying : 1:tomcat-6.0.43-0.el6.x86_64 1/1
Installed:
tomcat.x86_64 1:6.0.43-0.el6
Complete!
参考链接:http://www.unixmen.com/setup-local-yum-repository-on-centos-rhel-scientific-linux-6-4
本文出自 “hanyun.fang” 博客,转载请与作者联系!
原文地址:http://hanyun.blog.51cto.com/1060170/1660078