服务器: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. 进程通过内核缓存区请求设备I/O的一些事情

    请求进程,内核缓存区,设备I/O 请求进程无法直接访问设备I/O,而是通过内核缓冲区提交请求数据,等数据就绪后,数据从设备缓冲区提交至进程空间 请求进程把数据提交给内核缓存空间需要等待,内核把数据复制 ...

  2. ACM-ICPC 2017 西安赛区现场赛 A. XOR(线性基+线段树)

    题目链接:https://nanti.jisuanke.com/t/20749 参考题解:https://blog.csdn.net/Lee_w_j__/article/details/8266418 ...

  3. c++中lambda表达式的用法

    #include <iostream> using namespace std; int main(){ ; auto func1 = [=](;}; auto func2 = [& ...

  4. $ python manage.py makemigrations You are trying to add a non-nullable field 'name' to course without a default; we can't do that (the database needs something to populate existing rows). Please selec

    问题: $ python manage.py makemigrationsYou are trying to add a non-nullable field 'name' to course wit ...

  5. JavaScript三元运算符

    ㈠条件运算符也叫做三元运算符 ⑴语法:条件表达式?语句1:语句2: ⑵执行的流程: ①条件运算符在执行时,首先对条件表达式进行求值 ▶如果该值为true,则执行语句1,并返回执行结果 ▶如果该值为fa ...

  6. Django从Models 10分钟定制一个Admin后台

    目录 Django从Models 10分钟建立一套RestfulApi Django从Models 10分钟定制一个Admin后台 简介 Django自带一个Admin后台, 支持用户创建,权限配置和 ...

  7. LG5283 异或粽子

    题意 共有\(n\)个数,选择\(k\)个不同的\([l,r]\)区间,使得它们的异或和最大 $ 1 \leq n \leq 5 \times 10^5,k \leq 2 \times 10^5$ 思 ...

  8. LG2467 地精部落

    题意 给出\(n\),求有几个\(W\)形的\(n\)的全排列(震荡) 思路 可以变求出第二个数比第一个数大的,再翻倍就好 设\(f[i][j]\)表示\(i\)个数中\(j\)个数不符合序列 转移时 ...

  9. 22.从上往下打印二叉树 Java

    题目描述 从上往下打印出二叉树的每个节点,同层节点从左至右打印. 解题思路 就是二叉树的层序遍历.借助一个队列就可以实现.使用两个队列一个存放节点,一个存放值.先将根节点加入到队列中,然后遍历队列中的 ...

  10. maven坐标及依赖范围的学习(1)

    首先,我们先了解什么是maven的坐标(重中之重): 在这里我们可以看到那三个红色的行,基本是pom.xml中出现的最多的配置     例如这个配置:这里我们可以看到我们这个项目的pom文件中,他对名 ...