标签:yum
搭建内部YUM源
服务器IP 192.168.2.135
外部YUM源使用
要选择支持rsync协议的YUM源
rsync://mirrors.ustc.edu.cn/centos/6/
* * * */1 * /usr/bin/rsync -avz rsync://mirrors.ustc.edu.cn/centos/6/ /var/www/yumrepo/ --exclude=os/i386/ --exclude=isos/
如果有内部开发的软件包,可以
# mkdir -p /var/www/yumrepo/test/x86_64/
#cd /var/www/yumrepo/test/x86_64/
#mkdir Packages/
# createrepo -o . Packages
为了便于使用,可以提供写好的repo文件,用户只需放到/etc/yum.repos.d/目录下,再执行yum update 即可
配置HTTP下载
/etc/httpd/conf.d/yumrepo.conf
Listen 81
NameVirtualHost *:81
<VirtualHost *:81>
DocumentRoot /var/www/yumrepo/
ServerName 192.168.2.135:81
# Other directives here
<Directory "/var/www/yumrepo/">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
配置repo文件
vim /var/www/yumrepo/test.repo
[base]
name=test - Base
baseurl=http://192.168.2.135:81/os/$basearch/
enabled=1
gpgcheck=0
#released updates
[update]
name=test - Updates
baseurl=http://192.168.2.135:81/updates/$basearch/
enabled=1
gpgcheck=0
#additional packages that may be useful
[extras]
name=test - Extras
baseurl=http://192.168.2.135:81/extras/$basearch/
enabled=1
gpgcheck=0
#additional packages that extend functionality of existing packages
[centosplus]
name=test - Plus
baseurl=http://192.168.2.135:81/centosplus/$basearch/
gpgcheck=0
enabled=1
#contrib - packages by Centos Users
[contrib]
name=test - Contrib
baseurl=http://192.168.2.135:81/contrib/$basearch/
gpgcheck=0
enabled=1
#packages of mycompany
[test]
name=test - custom
baseurl=http://192.168.2.135:81/test/$basearch/
gpgcheck=0
enabled=1
将这个repo文件下载到需要安装软件的服务器上
cd /etc/yum.repos.d/
cp CentOS-Base.repo CentOS-Base.repo.bak
cp test.repo CentOS-Base.repo
参考资料:
http://www.cnblogs.com/holbrook/archive/2012/08/17/2644147.html
本文出自 “Linux SA John” 博客,请务必保留此出处http://john88wang.blog.51cto.com/2165294/1691354
标签:yum
原文地址:http://john88wang.blog.51cto.com/2165294/1691354