建立自己的Yum源
转自http://kicklinux.com/setup-yum-repos-server/
命令 reposync 可以直接同步yum源
如/etc/yum.repos.d/cloudera-cdh4.repo
合适的目录下 reposync cloudera-cdh4 就ok了
#########更新#################
rhel 5 使用 rhel6 或者 fedora 11 以上版本作为yum 源就会发生如下报错:
[Errno -3] Error performing checksum
原因: rhel 6 中 repomd.xml 文件使用 sha256 作为hash 算法 ,在rhel 5中 默认使用的是sha 作为hash 算法 ,倒是rhel5 读取 rhel 6 yum 源中的repomd.xml 出现问题
解决办法: 将rhel 6 光盘中内容拷贝出来 ,createrepo -s sha ./ 重新创建repo ,并制定默认算法 sha
##########更新完毕#################
建立自己的yum服务源
为了节省流量,提高效率,我们在机房内部署了自己的yum server。
安装httpd服务。
同步yum源到/var/www/html/linux下的目录
/usr/bin/rsync -avzL --delete--exclude=SRPMS --exclude=i386 --exclude=isos rsync://mirrors.ustc.edu.cn/centos/6/ /var/www/html/linux/centos/x86_64/
/usr/bin/rsync -avzL --delete rsync://mirrors.ustc.edu.cn/fedora-epel/6/x86_64 /var/www/html/linux/centos/epel/ 北京在线源
rsync://mirrors.yun-idc.com/epel
添加自动化任务,每天夜里自动同步
# vi /var/spool/cron/root 01***/usr/bin/rsync -avzL --delete--exclude=SRPMS --exclude=i386 --exclude=isos rsync://mirrors.ustc.edu.cn/centos/6/ /var/www/html/linux/centos/x86_64/ 01***/usr/bin/rsync -avzL --delete rsync://mirrors.ustc.edu.cn/fedora-epel/6/x86_64 /var/www/html/linux/centos/epel/
# service httpd start
在某一台机器上创建和修改以下文件
[root@vm2 yum.repos.d]# more CentOS-Base.repo # CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the #mirrorlist= does not work for you, as a fall back you can try the# remarked out baseurl= line instead.##[base]
name=CentOS--Base#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=os
baseurl=http://172.16.1.101/linux/centos/x86_64/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates[updates]
name=CentOS--Updates#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=updates
baseurl=http://172.16.1.101/linux/centos/x86_64/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]
name=CentOS--Extras#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=extras
baseurl=http://172.16.1.101/linux/centos/x86_64/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]
name=CentOS--Plus#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=centosplus
baseurl=http://172.16.1.101/linux/centos/x86_64/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]
name=CentOS--Contrib#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=contrib
baseurl=http://172.16.1.101/linux/centos/x86_64/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6[root@vm2 yum.repos.d]# more epel.repo [epel]
name=ExtraPackagesforEnterpriseLinux6- $basearch
baseurl=http://172.16.1.101/linux/centos/epel/$basearch#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://172.16.1.101/linux/centos/epel/RPM-GPG-KEY-EPEL-6[epel-debuginfo]
name=ExtraPackagesforEnterpriseLinux6- $basearch -Debug
baseurl=http://172.16.1.101/linux/centos/epel/$basearch/debug#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=http://172.16.1.101/linux/centos/epel/RPM-GPG-KEY-EPEL-6
gpgcheck=1[epel-source]
name=ExtraPackagesforEnterpriseLinux6- $basearch -Source
baseurl=http://172.16.1.101/linux/centos/epel/SRPMS#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgkey=http://172.16.1.101/linux/centos/epel/RPM-GPG-KEY-EPEL-6
gpgcheck=1
测试一下,一切正常。
附一个脚本:
#!/bin/bash
## rsync mirror centos and epel with yun-idc
## visit http://mirrors.yun-idc.com/centos/5/
## http://mirrors.yun-idc.com/centos/6/
## http://mirrors.yun-idc.com/epel/5/
## http://mirrors.yun-idc.com/epel/6/ Rsync="/usr/bin/rsync"
Options="-azvL --exclude=SRPMS/ --exclude=xen --exclude=SCL/ --exclude=ppc64/ --exclude=ppc/--exclude=cr/ --exclude=fasttrack/ --exclude=isos/ --bwlimit=2000"
Reporoot="/opt/apache/htdocs/repo/"
Centos5="$Reporoot/5/"
Centos5epel="$Reporoot/epel/5/"
Centos6="$Reporoot/6/"
Centos6epel="$Reporoot/epel/6/" Logdir="$Reporoot/logs/"
Date=`date +%Y-%m-%d`
Logfile="$Logdir/$Date.log"
Resultfile="$Logdir/$Date.log.res" Checkres(){
if [ $? == ];then
echo -e "\033[1;32m $1 Rsync is success!\033[0m" >> $Resultfile
else
echo -e "\033[1;31m $1 Rsync is fail!\033[0m" >> $Resultfile
fi
} Checkdir(){
if [ ! -d $ ];then
mkdir -p $
fi
}
Checkdir $Logdir
Rsyncrepo(){
Checkdir $
$Rsync $Options $ $ >> $Logfile
Checkres $
} Rsyncrepo rsync://mirrors.yun-idc.com/centos/5/ $Centos5
Rsyncrepo rsync://mirrors.yun-idc.com/centos/6/ $Centos6
Rsyncrepo rsync://mirrors.yun-idc.com/epel/5/ $Centos5epel
Rsyncrepo rsync://mirrors.yun-idc.com/epel/6/ $Centos6epel
建立自己的Yum源的更多相关文章
- Centos6.5建立本地YUM源
很多情况下公司的服务器是不允许连外网的,那么安装软件的时候就很不方便了,这里就需要建立一个本地YUM源了. 文件位置:/etc/yum.repos.d/ 后缀一定是.repo结束. 下面我们搭建 ...
- 虚拟机centos7配置本地yum源
在虚拟机中要使用yum命令,就要先配置一下yum源,下面就分享一下这个过程: 1. 挂载iso到vmware,首先得确保CD/DVD连接到镜像.可以这样操作 2. 执行下面的命令 # mkdir /m ...
- CentOS下建立本地YUM源并自动更新
1. 尽管有很多的免费镜像提供yum源服务,但是还是有必要建立自己的yum服务器,主要出于以下几点考虑: l 网络速度:访问互联网可能比较慢 l 节省带宽:如果有大量的服务器,架设自己的yum源可以有 ...
- 本地yum源建立
一.openstack(ocata)本地yum源的建立: 1.配置yum缓存: vi /etc/yum.conf 把yum.conf配置改为: [main] cachedir=/var/cache/y ...
- createrepo 建立本地yum源
linux使用createrepo制作本地yum源 目录 linux使用createrepo制作本地yum源 安装createrepo软件包 进入本地rpm包目录 执行完后可以看到生成的repod ...
- Centos6.4 本地yum源配置
由于单位的服务器均使用的是内网,而安装一些软件如Git,需要很多的依赖包,使用yum安装相对简单,由于不能联网故配置本地yum源配置. 1.首先将需要rpm库添加到系统中: 1).虚拟机中安装的lin ...
- centos yum源配置
5步搞定yum源配置 作者小波/QQ463431476欢迎转载! 第一步: 卸载原来的yum [root@localhost home]#rpm -qa|grep yum|xargs rpm -e - ...
- Centos 6.0将光盘作为yum源的设置方法
在使用Centos 的时候,用yum来安装软件包是再方便不过了,但是如果在无法连接互联网的情况下,yum就不好用了. 下面介绍一种方式,就是将Centos安装光盘作为yum源,然后使用yum来安装软件 ...
- linux系统下yum源的搭建
1.建立挂载点 系统默认在 /mnt目录 1>创建挂载点 mkdir -p /mnt/cdrom 参数-p是需要时创建目标目录的上层目录,但即使这些目录已存在也不当作错误处理 2>查看 ...
随机推荐
- Nginx 笔记与总结(5)访问日志管理:计划任务 + 日志切割
要在第二天的凌晨把前一天的访问日志切割备份,并以时间作为文件名,例如:access.20150728.log,这就需要在 Linux 中格式化时间,例如: [root@localhost ~]# da ...
- PHP测试用例练习
本测试用例是一个判断三角形类型的练习测试用例,基于Netbeans 8.1IDE环境,和phpunit-5.2.10以及脚手架工具phpunit-skelgen-2.0.1.具体的环境搭建可参照: h ...
- Irrlicht引擎I 配置
游戏是一个比较大的系统,包含了图形引擎.网络.AI.声音.UI等模块,模块的开发可能会分别进行或者采用开源项目,Irrlicht引擎基本包含了这些模块,不过在使用中也会陆续加入其它的模块.以前开发的程 ...
- memcached学习笔记6--浅谈memcached的机制 以及 memcached细节讨论
附:请浅谈memcached的机制 答: ①基于C/S架构,协议比较简单 c/s架构,此时memcached为服务器端,我们可以使用如PHP,c++/c等程序连接memcached服务器. memca ...
- Asp.net 服务器Application,Session,Cookie,ViewState和Cache区别
2.8 Context 的使用Context 对象包含与当前页面相关的信息,提供对整个上下文的访问,包括请求.响应.以及上文中的Session 和Application 等信息.可以使用此对象在网页之 ...
- python环境搭建
Python下载 Python最新源码,二进制文档,新闻资讯等可以在Python的官网查看到: Python官网:http://www.python.org/ 你可以在一下链接中下载Python的文档 ...
- QWidget 键盘事件 焦点(QApplication源码)
在Qt中,键盘事件和QWidget的focus密不可分:一般来说,一个拥有焦点(focus)的QWidget或者grabKeyboard()的QWidget才可以接受键盘事件. 键盘事件派发给谁? 如 ...
- java System.out
从写Hello World开始,我们就开始使用System.out了.System.out是一个static final 的PrintStream对象. 引用一段jdk API document的内容 ...
- 网页中的超链接<a>标签
格式: <a href="目标网址" title="鼠标滑过显示的文本">链接显示的文本</a> 注意:为文本加入<a>标签 ...
- ArcGIS Engine开发之旅03--ArcGIS Engine中的控件
原文:ArcGIS Engine开发之旅03--ArcGIS Engine中的控件 制图控件,如MapControl.PageLayoutControl,其中MapControl控件主要用于地理数据的 ...