自建centos5/6/7 64位yum源(官网rsync同步)

centos 5.11  (172.16.4.158)

rsync -avzP --exclude=debug --exclude=i386 rsync://archive.kernel.org/centos-vault/5.11/ /opt/data/centos-vault/5.11/

初始化repodata索引文件

createrepo -pdo /opt/data/ /opt/data/

# 每加入一个rpm包就要更新一下

createrepo --update /opt/data/

-------/etc/yum.repos.d/CentOS-Base.repo---------

[base]

name=CentOS-5.11 - Base

failovermethod=priority

baseurl=http://172.16.4.158/centos-vault/5.11/os/$basearch/

gpgcheck=0

gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

 

#released updates

[updates]

name=CentOS-5.11 - Updates

failovermethod=priority

baseurl=http://172.16.4.158/centos-vault/5.11/updates/$basearch/

gpgcheck=0

gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

 

#additional packages that may be useful

[extras]

name=CentOS-5.11 - Extras

failovermethod=priority

baseurl=http://172.16.4.158/centos-vault/5.11/extras/$basearch/

gpgcheck=0

gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-5.11 - Plus

failovermethod=priority

baseurl=http://172.16.4.158/centos-vault/5.11/centosplus/$basearch/

gpgcheck=0

enabled=1

gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

 

#contrib - packages by Centos Users

[contrib]

name=CentOS-5.11 - Contrib

failovermethod=priority

baseurl=http://172.16.4.158/centos-vault/5.11/contrib/$basearch/

gpgcheck=0

enabled=1

gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

---------/opt/cron/rsyum5.11.sh-------

#!/bin/bash

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://archive.kernel.org/centos-vault/5.11/ /opt/data/centos-vault/5.11/

/usr/bin/createrepo --update /opt/data/

chown -R nginx.nginx /opt/data

--------crontab--------

0 2 * * * /opt/cron/rsyum5.11.sh > /dev/null 2>&1 &

----------------

centos 6   (10.10.34.201)

mkdir -p /opt/data/centos/6/os/x86_64/

mkdir -p /opt/data/centos/6/extras/x86_64/

mkdir -p /opt/data/centos/6/updates/x86_64/

mkdir -p /opt/data/epel/6/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/os/x86_64/ /opt/data/centos/6/os/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /opt/data/centos/6/extras/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /opt/data/centos/6/updates/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 --exclude=debug rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/ /opt/data/epel/6/x86_64/

初始化repodata索引文件

createrepo -pdo /opt/data/ /opt/data/

# 每加入一个rpm包就要更新一下

/usr/bin/createrepo --update /opt/data/

------/etc/yum.repos.d/CentOS-Base.repo----------

[base]

name=CentOS - base

baseurl=http://10.10.34.201/centos/6/os/$basearch/

enable=1

gpgcheck=0

 

[updates]

name=CentOS - updates

baseurl=http://10.10.34.201/centos/6/updates/$basearch/

enable=1

gpgcheck=0

 

[extras]

name=CentOS - extras

baseurl=http://10.10.34.201/centos/6/extras/$basearch/

enable=1

gpgcheck=0

[epel]

name=CentOS - epel

baseurl=http://10.10.34.201/epel/6/x86_64/

enable=1

gpgcheck=0

----------/opt/cron/rsyum6.sh------

#!/bin/bash

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/os/x86_64/ /opt/data/centos/6/os/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /opt/data/centos/6/extras/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /opt/data/centos/6/updates/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 --exclude=debug rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/ /opt/data/epel/6/x86_64/

/usr/bin/createrepo --update /opt/data/

chown -R nobody.nobody /opt/data

---------crontab-------

0 2 * * * /opt/cron/rsyum6.sh > /dev/null 2>&1 &

----------------

centos 7   (10.10.34.101)

mkdir -p /opt/data/centos/7

rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/7/    /opt/data/centos/7/

mkdir -p /opt/data/centos/7/os/x86_64/

mkdir -p /opt/data/centos/7/extras/x86_64/

mkdir -p /opt/data/centos/7/updates/x86_64/

mkdir -p /opt/data/epel/7/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/7/os/x86_64/ /opt/data/centos/7/os/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/7/extras/x86_64/ /opt/data/centos/7/extras/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/7/updates/x86_64/ /opt/data/centos/7/updates/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 --exclude=debug rsync://rsync.mirrors.ustc.edu.cn/epel/7/x86_64/ /opt/data/epel/7/x86_64/

yum -y install createrepo

yum -y install rsync

1).创建镜像文件存放目录

#创建四个目录,用于同步公网yum源

mkdir -p /opt/data/centos/6/os/x86_64/

mkdir -p /opt/data/centos/6/extras/x86_64/

mkdir -p /opt/data/centos/6/updates/x86_64/

mkdir -p /opt/data/epel/6/x86_64/

2)同步源

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/os/x86_64/ /opt/data/centos/6/os/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /opt/data/centos/6/extras/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 rsync://rsync.mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /opt/data/centos/6/updates/x86_64/

/usr/bin/rsync -avzP --exclude=debug --exclude=i386 --exclude=debug rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/ /opt/data/epel/6/x86_64/

3)nginx

    server {

        listen       80;

        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root /opt/data/;

        location / {

            autoindex on;

            autoindex_exact_size off;

            autoindex_localtime on;

            #root   html;

            #index  index.html index.htm;

        }

2).确定以上yum源上游源同步镜像地址

  参考官方源:

  CentOS官方标准源:

      http://mirror.centos.org/centos/6.7/

  中科大yum源:

      rsync://mirrors.ustc.edu.cn/centos/6.7/os/x86_64/Packages/

      rsync://mirrors.ustc.edu.cn/centos/6.7/updates/

      rsync://mirrors.ustc.edu.cn/centos/6.7/extras/x86_64/Packages/

  epel源:

      http://mirrors.fedoraproject.org/publiclist/EPEL/

      rsync://mirrors.kernel.org/fedora-epel

  中科大epel源:

      rsync://mirrors.ustc.edu.cn/epel/6/x86_64/

  备注:上游yum源必须要支持rsync协议,否则不能使用rsync进行同步(国内的源很多不支持,这里选用中科大yum源)。

列出各个源下面的软件包

# rsync --list-only rsync://rsync.mirrors.ustc.edu.cn/centos/6.7/os/x86_64/Packages/

# rsync --list-only rsync://rsync.mirrors.ustc.edu.cn/centos/6.7/updates/x86_64/Packages/

# rsync --list-only rsync://rsync.mirrors.ustc.edu.cn/centos/6.7/extras/x86_64/Packages/

# rsync --list-only rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/

#下面四条命令,同时复制执行,就会开始同步官网yum源到本地。

1 /usr/bin/rsync -av rsync://rsync.mirrors.ustc.edu.cn/centos/6/os/x86_64/ /opt/data/centos/6/os/x86_64/

2 /usr/bin/rsync -av rsync://rsync.mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /opt/data/centos/6/extras/x86_64/

3 /usr/bin/rsync -av rsync://rsync.mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /opt/data/centos/6/updates/x86_64/

4 /usr/bin/rsync -av --exclude=debug rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/ /opt/data/epel/6/x86_64/

rsync -avzP --exclude=debug --exclude=i386 

#创建四个目录,用于同步公网yum源

mkdir -p /data/yum_data/centos/6/os/x86_64/

mkdir -p /data/yum_data/centos/6/extras/x86_64/

mkdir -p /data/yum_data/centos/6/updates/x86_64/

mkdir -p /data/yum_data/epel/6/x86_64/

#下面四条命令,同时复制执行,就会开始同步官网yum源到本地。

1 /usr/bin/rsync -av rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64/ /data/yum_data/centos/6/os/x86_64/

2 /usr/bin/rsync -av rsync://mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /data/yum_data/centos/6/extras/x86_64/

3 /usr/bin/rsync -av rsync://mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /data/yum_data/centos/6/updates/x86_64/

4 /usr/bin/rsync -av --exclude=debug rsync://mirrors.ustc.edu.cn/epel/6/x86_64/ /data/yum_data/epel/6/x86_64/

时间: 2024-07-28 21:19:24

自建centos5/6/7 64位yum源(官网rsync同步)的相关文章

Centos5.10中 64位静默安装oracle10g 升级10.2.0.5.12方法

同步时间 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime crontab -e 0-59/10 * * * * /usr/sbin/ntpdate us.pool.ntp.org | logger -t NTP ntpdate  us.pool.ntp.org hwclock -w 设置本地DVD 为源: mkdir /mnt/cdrom mount /dev/cdrom /mnt/cdrom #添加本地源 cat >>/etc/yum.

64位CentOs7源码安装mysql-5.6.35过程分享

首先安装依赖包,避免在安装过程中出现问题 [root@bogon liuzhen]# yum -y install gcc gcc-c++ [root@bogon liuzhen]# yum -y install cmake [root@bogon liuzhen]# yum -y install ncurses-devel [root@bogon liuzhen]# yum -y install autoconf [root@bogon liuzhen]# yum -y install per

CentOS 6.6 64位系统源码安装GitLab7教程

环境:CentOS-6.6-x86_64-minimal.iso 安装LNMP(必须安装Nginx.MySQL.redis,PHP可选),参考<lnmp一键安装包> 添加epel仓库 cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 6 - \$basearch #baseurl=http://download.fedoraproject.org/pu

CentOS5.3 64位系统Tomcat6.0无法启动问题

CentOS5.3 64位系统Tomcat6.0无法启动,提示:java.net.BindException: Cannot assign requested address 这个错误如果从没见过,绝对会浪费大家好多时间去查找,而且网上千篇文章都没有一个真正的解决办法!欢迎请大家转载!! 新服务器配置tomcat6.0环境,配置完毕后,无法正常启动.报错如下:shutdown 端口看似被占用,但是换成其他端口还是无法启动: 2010-11-13 10:16:06 org.apache.catal

CentOS中yum只安装64位软件方法

如果想要保持一个纯的64位系统,在64位CentOS上避免安装32位软件包的话很容易,只需要在 yum.conf 加上一行过滤掉 i386, i686 的软件包就可以了.方法如下:  代码如下 复制代码 # vi /etc/yum.conf  [main]  ...  exclude=*.i?86 或 echo exclude=*.i?86 >> /etc/yum.conf 当然了,这样设置你可以保证今后可以不安装上32位的rpm包,那以前已经安装上的又该怎么办呢?其实还是可以用yum 删除掉

Centos 5.8中64位系统yum安装php5.2步骤

由于程序运行环境需要,不得不使用老掉牙的PHP5.2以下版本. 下面提供两种方法安装PHP5.2 操作系统: CentOS 5.8 64位(阿里云空间) 1.通过官方下载源码,编译安装 下载地址:http://museum.php.net/php2/ 编译安装方法,可以解压后看README文本文件. 2.通过第三方的yum源安装php5.2.17 参考方法:https://webtatic.com/packages/php53/ 1)通过rpm -qa |grep php 命令,查看系统已经安装

64位centos 5.6编译安装vsftpd-2.3.4的两种用户登录配置

服务器搭建FTP是首要的任务了.虚拟用户登录比本地用户登录安全系数高.因为vsftpd虚拟用户,并不是系统的账号,也就仅用来支持Vsftpd服务用,因此没有许可他登陆系统的必要,比直接设定本地用户登录账号为登陆系统的用户安全性高. 一.文章要点: 1.64位系统下使用了PAM数据方式的虚拟用户配置 2.修改关键脚本,是编译成功通过.必要步骤,详细安装配置说明过程. 3.完全配置实例,Centos5.6编译安装vsftpd-2.3.4(配置本地用户登录.虚拟用户登录) 下载 wget http:/

全新64位CentOS6.X上LAMP架构搭建备忘

======================================================================================== PS: 生产环境必须都安装GA版本--很多配置还很不成熟--还需要不断完善和改进-- 安装mysql-5.1.36 tar xf mysql-5.1.36.tar.gz -C /usr/src/ ./configure --prefix=/usr/local/mysql --enable-local-infile --w

如何在64位版本Linux上开发运行32位应用程序

最近换了Linux系统,由i686换成了x86-64,导致在进行开发的时候出用不了原来SDK中32位的开发工具.于是,博主找到如下文章,博主亲测实用: 如何在64位版本Linux上开发运行32位应用程序  内容如下: 很多程序员(特别是别的公司的)跟我抱怨说他们32位软件无法在我们的64位Linux系统上正常运行,而在他们32位机上正常,其实这个很好解决,一般 是64位系统安装后没有默认安装glibc的32位版本,通过简单的执行以下命令即可实现在64位Linux系统上开发运行32位应用程序,而不