建立自己的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>查看 ...
随机推荐
- mysql安装tcmalloc
TCMalloc(Thread-Caching Malloc)是google-perftools工具中的一个,与标准的glibc库的malloc相比,TCMalloc在内存的分配上效率和速度要高得多, ...
- Git 忽略一些文件不加入版本控制
在git中如果想忽略掉某个文件,不让这个文件提交到版本库中,可以使用修改 .gitignore 文件的方法.这个文件每一行保存了一个匹配的规则例如: # 此为注释 – 将被 Git 忽略 *.a ...
- LAMP环境搭建教程(原创)
学习PHP脚本编程语言之前,必须先搭建并熟悉开发环境,开发环境有很多种,例如LAMP.WAMP.MAMP等.这里我介绍一下LAMP环境的搭建,即Linux.Apache.MySQL.PHP环境. 一. ...
- Paging
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Both unequal fixed-si ...
- Bootstrap 图标菜单按钮组件
---恢复内容开始--- 一.小图标组件 Bootstrap 提供了免费的 263 个小图标(数了两次),具体可以参考中文官网的组件 链接:http://v3.bootcss.com/componen ...
- C++ 实现 发送HTTP Get/Post请求 good
1.简述 最近简单看了一下关于HTTP请求方面的知识,之前一直用Qt来实现,有专门HTTP请求的QNetworkAccessManager类来处理,实现也比较简单,这里主要讲解一下用C++代码来实现H ...
- Prism&MEF构建开发框架 (三)
菜单管控模块EntityFW 菜单的加载采用MEF技术,程序实现思路: 1 .主菜单加载页面MainMenuView.xaml指向MenuRegion 2. 菜单Item点击及内容加载,采用订阅模式, ...
- Linux学习之CentOS(十)--虚拟机下的CentOS如何上网
原地址:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/05/3001148.html 这篇随笔应该说跟CentOS的学习关系不是很大, ...
- json-lib 之jsonConfig具体应用
一,setCycleDetectionStrategy 防止自包含 public static void testCycleObject() { CycleObject object ...
- css3 transform动画效果与公司框架简易动画的差异
先看一下该网站的效果 http://2014guangzhouchezhan.dongfeng-citroen.com.cn/mobile/ 该站里面的动画效果由简易动画与css3动画2种方式混合达到 ...