服务器:CentOS7

YUM源:阿里云

空间要求:CentOS6+CentOS7  50G,考虑后期更新预留,LVS空间100G

1、在服务器配置CentOS7的yum源和CentOS6的yum源

#Centos7
[base7]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [updates7]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [extras7]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [epel7]
name=CentOS--epel-cmiot.local
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=
#Centos6
[base6]
name=CentOS- - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/
http://mirrors.aliyuncs.com/centos/6/os/x86_64/
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 [updates6]
name=CentOS- - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/updates/x86_64/
http://mirrors.aliyuncs.com/centos/6/updates/x86_64/
http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 [extras6]
name=CentOS- - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/extras/x86_64/
http://mirrors.aliyuncs.com/centos/6/extras/x86_64/
http://mirrors.cloud.aliyuncs.com/centos/6/extras/x86_64/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 [epel6]
name=CentOS--epel-cmiot.local
baseurl=https://mirrors.aliyun.com/epel/6/x86_64/
gpgcheck=

2、检查yum的可用性,并查看yum的repoid

3、安装repo同步工具和必要软件包

yum install -y wget make cmake gcc gcc-c++ pcre-devel zlib-devel openssl openssl-devel createrepo yum-utils

4、创建yum软件包目录并向阿里同步,时间较久。

mkdir -p /mirror/Aliyun/CentOS/
reposync -n --repoid=extras6 --repoid=updates6 --repoid=base6 --repoid=epel6 -p /mirror/Aliyun/CentOS/ mkdir -p /mirror/Aliyun/CentOS/
reposync -n --repoid=extras7 --repoid=updates7 --repoid=base7 --repoid=epel7 -p /mirror/Aliyun/CentOS/

5、创建索引

createrepo -po /mirror/Aliyun/CentOS//base6/ /mirror/Aliyun/CentOS//base6/
createrepo -po /mirror/Aliyun/CentOS//epel6/ /mirror/Aliyun/CentOS//epel6/
createrepo -po /mirror/Aliyun/CentOS//extras6/ /mirror/Aliyun/CentOS//extras6/
createrepo -po /mirror/Aliyun/CentOS//updates6/ /mirror/Aliyun/CentOS//updates6/
createrepo -po /mirror/Aliyun/CentOS//base7/ /mirror/Aliyun/CentOS//base7/
createrepo -po /mirror/Aliyun/CentOS//epel7/ /mirror/Aliyun/CentOS//epel7/
createrepo -po /data/website/centos//extras7 /data/website/centos//extras7
createrepo -po /mirror/Aliyun/CentOS//updates7/ /mirror/Aliyun/CentOS//updates7/

6、安装nginx并配置

worker_processes  ;
events {
worker_connections ;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout ;
server {
listen ;
server_name localhost;
root /mirror ; #这里是yum源存放目录
location / {
autoindex on; #打开目录浏览功能
autoindex_exact_size off; # off:以可读的方式显示文件大小
autoindex_localtime on; # on、off:是否以服务器的文件时间作为显示的时间
charset utf-,gbk; #展示中文文件名
index index.html;
}
error_page /50x.html;
location = /50x.html {
root html;
}
}
}

7、创建更新软件包的定时任务

0 1 * * * /mirror/update.sh
#!/bin/bash
reposync -n --repoid=extras6 --repoid=updates6 --repoid=base6 --repoid=epel6 -p /mirror/Aliyun/CentOS/
reposync -n --repoid=extras7 --repoid=updates7 --repoid=base7 --repoid=epel7 -p /mirror/Aliyun/CentOS/
createrepo --update /mirror/Aliyun/CentOS//base6/
createrepo --update /mirror/Aliyun/CentOS//epel6/
createrepo --update /mirror/Aliyun/CentOS//extras6/
createrepo --update /mirror/Aliyun/CentOS//updates6/
createrepo --update /mirror/Aliyun/CentOS//base7/
createrepo --update /mirror/Aliyun/CentOS//epel7/
createrepo --update /mirror/Aliyun/CentOS//extras7/
createrepo --update /mirror/Aliyun/CentOS//updates7/

8、配置客户端yum文件使用

[base]
name=CentOS-$releasever - Base
baseurl=http://10.150.203.8/Aliyun/CentOS/$releasever/base$releasever
gpgcheck=
gpgkey=http://10.150.203.8/Aliyun/CentOS/RPM-GPG-KEY-CentOS-$releasever [updates]
name=CentOS-$releasever - Updates
baseurl=http://10.150.203.8/Aliyun/CentOS/$releasever/updates$releasever
gpgcheck=
gpgkey=http://10.150.203.8/Aliyun/CentOS/RPM-GPG-KEY-CentOS-$releasever [extras]
name=CentOS-$releasever - Extras
baseurl=http://10.150.203.8/Aliyun/CentOS/$releasever/extras$releasever
gpgcheck=
gpgkey=http://10.150.203.8/Aliyun/CentOS/RPM-GPG-KEY-CentOS-$releasever [epel]
name=CentOS-$releasever - epel
baseurl=http://10.150.203.8/Aliyun/CentOS/$releasever/epel$releasever
gpgcheck=

多版本YUM仓库搭建的更多相关文章

  1. 自动化利器-YUM仓库搭建实战

    本地YUM仓库搭建实战 YUM主要用于自动安装.升级rpm软件包,它能自动查找并解决rpm包之间的依赖关系.要成功的使用YUM工具安装更新软件或系统,就需要有一个包含各种rpm软件包的reposito ...

  2. 其他综合-内网下Yum仓库搭建配置

    内网下Yum仓库搭建配置 1.实验环境 虚拟机环境: VMware 12 版本虚拟机 网络环境: 内网 IP 段:172.16.1.0 外网 iP 段(模拟):10.0.0.0 实验基础:(能够上网, ...

  3. 本地YUM仓库搭建实战

    YUM主要用于自动安装.升级rpm软件包,它能自动查找并解决rpm包之间的依赖关系.要成功的使用YUM工具安装更新软件或系统,就需要有一个包含各种rpm软件包的repository(软件仓库),这个软 ...

  4. linux运维、架构之路-rpm定制、本地yum仓库搭建

    一.定制rpm包 1.环境 [root@m01 ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@m01 ~]# uname - ...

  5. Firewalld共享上网及本地yum仓库搭建

    1.firewalld共享上网 1.服务端操作(有外网的服务器) 1.开启防火墙并加入开机自启动 [root@zeq ~]# systemctl start firewalld [root@zeq ~ ...

  6. mysql5.7版本yum安装---redhat7.0

    1.官网下载yum包 [root@test01 test]# wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch ...

  7. 本地yum仓库搭建,使用163yum源

    如果内部网络没有连接Internet就在本地配置yum仓库 将操作系统镜像上传到服务器中,进行挂载 mount –o loop rhel-server-6.7-x86_64-dvd.iso /mnt ...

  8. 定制化rpm包及本地yum仓库搭建

    为方便本地yum的管理,一般都是在公司局域网内搭建本地yum仓库,实现公司内部快速安装常用软件. 步骤如下: 1.搭建要实现本地yum管理的软件,测试该软件搭建成功与否: 2.定制rpm包及其相关依赖 ...

  9. redhat6.8服务器版本 yum 源的配置

    阿里云的源地址: http://mirrors.aliyun.com/ 打开后点击帮助: 有如下提示: 不过不能直接使用这个源,因为自己使用的是服务器版本,要修改一个变量,先将源文件下载下来. wge ...

随机推荐

  1. setup elk with docker-compose

    version: '2' services: elasticsearch: image: docker.calix.local:18080/docker-elasticsearch:6.2.2-1 c ...

  2. 灵活部署django缓存,并使用

    使用django内置的redis=============>pip3 install django-redisCACHES = { 'default':{ 'BACKEND':'django_r ...

  3. 置换的玩笑——DFS&&暴力

    题目 链接 题意:一个$1$到$n$的序列被去掉空格,需要将其还原.例如$4111109876532$可还原成$4 \ 1 \  11 \  10 \  9 \  8 \  7 \  6 \  5 \ ...

  4. Qt5 使用lambda

    c11新特性中加入了lambda表达式,所以Qt 也支持 需在.pro文件中加入 CONFIG += c++11 m_timer = new QTimer(); m_timer->start() ...

  5. BZOJ 3435 / Luogu 3920 [WC2014]紫荆花之恋 (替罪羊树 动态点分治 套 Treap)

    题意 略 分析 引用PoPoQQQ的话 吾辈有生之年终于把这道题切了...QAQ (蒟蒻狂笑) Orz PoPoQQQ,我又抄PoPoQQQ的题解了 - 突然发现有旋Treap没那么难写 学习了一波C ...

  6. Google Maps API3 之 Hello World

    <html xmlns="http://www.w3.org/1999/xhtml">     <head>         <meta http-e ...

  7. Mac OS 系统开发环境的一些坑

    最近换 Mac OS 系统开发,运行项目时遇到各种报错,记录下: 1.拉取项目后,需要安装依赖 npm install ,提示需要安装 xcode,报错如下. 从官网下载 xcode 时提示要更新最新 ...

  8. table表格合并列中相同的内容

    方法一: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...

  9. js实现OSS上传图片,STS临时授权访问OSS

    1. 引入aliyun-oss-sdk.min.js <script type="text/javascript" src="/static/js/common/a ...

  10. Dubbo 节点telnet测试

        Dubbo 节点telnet测试 本地安装telnet客户端 Telnet 服务地址 端口 如telnet 127.0.0.1 1234 出现此对话框表示连接成功 输入status –l 会显 ...