CentOS-7.x Yum Repo Mirror
一. 环境
1.1 主机信息
| 主机 | OS | Storage | 备注 |
|---|---|---|---|
| 100.64.140.101 | centos 7.6 | /dev/sdb > 100GB | 1.selinux disable; 2.放行tcp80端口 |
1.2 挂载磁盘
# 通过fdisk创建linux或linux lvm分区;
# 格式化分区为ext4或xfs格式
mkfs.ext4 /dev/sdb1
# mount
mkdir -p /repo
echo "/dev/sdb1 /repo ext4 defaults 1 2" >> /etc/fstab
mount -a
二. 镜像Yum源
# 使用rsync同步yum源,上游yum源需要支持rsync协议
yum install rsync -y
# 同步清华大学开源软件镜像站,实测阿里云镜像站不支持rsync协议
# centos
mkdir -p /repo/centos/7.6.1810/os/x86_64/
rsync -av rsync://mirrors.tuna.tsinghua.edu.cn/centos/7.6.1810/os/x86_64/ /repo/centos/7.6.1810/os/x86_64/
rsync -av rsync://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-7 /repo/centos/RPM-GPG-KEY-CentOS-7
# 重要!建立/repo/centos/7.6.1810/目录的软链接
ln -s /repo/centos/7.6.1810/ /repo/centos/7
# epel
mkdir -p /repo/epel/7/x86_64/
rsync -av rsync://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/ /repo/epel/7/x86_64/
rsync -av rsync://mirrors.tuna.tsinghua.edu.cn/epel/RPM-GPG-KEY-EPEL-7 /repo/epel/RPM-GPG-KEY-EPEL-7
三. Web服务器
# 安装nginx
yum install nginx -y
# 编辑
vim /etc/nginx/nginx.conf
server {
client_max_body_size 4G;
listen 80 default_server;
server_name 100.64.140.101;
root /mirror;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# 测试
nginx -t
# 启动
systemctl enable nginx
systemctl restart nginx
四. 客户端repo文件
4.1 CentOS-Base.repo
# 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# 生成repo
cat << EOF >> /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://100.64.140.101/centos/$releasever/os/$basearch/
http://100.64.140.101/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://100.64.140.101/centos/RPM-GPG-KEY-CentOS-7
EOF
4.2 epel.repo
# centos默认没有epel.repo
cat << EOF >> /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://100.64.140.101/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://100.64.140.101/epel/RPM-GPG-KEY-EPEL-7
EOF
五. (option范例)初始化repodata索引
# 如果通过rsync从公网同步镜像,repodata也会同步,可直接使用;
# 如果不是从公网同步的镜像库,没有repodata索引文件,可通过createrepo生成
# 安装createrepo
yum install createrepo -y
# 在镜像源目录生成repodata索引文件
createrepo -pdo /repo/centos/7.6.1810/os/x86_64/
createrepo -pdo /repo/epel/7/x86_64/
CentOS-7.x Yum Repo Mirror的更多相关文章
- CentOS yum repo
CentOS yum repo 阿里云的 一个是Centos-6的 一个是Centos-7 # CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.rep ...
- CentOS 7添加yum源
RedHat下主要有两个distribution,一曰 RHEL(Red Hat Enterprise Linux) 一曰 Fedora.前者主要是供服务器使用,优点是稳定,缺点是老的掉牙,后者是供桌 ...
- CentOS配置本地yum源(使用镜像iso文件)
本人在使用yum安装软件的时候,感觉最不爽的是网络不佳时,安装的速度特别慢.所以,个人就上网search了一下如何使用Linux的安装文件作为其yum源.经过几次尝试,已经可以成功的配置了.下面是详细 ...
- 【转发】RedHat Enterprise Linux 6.4 使用 Centos 6 的yum源问题
作为一名新手,学习Linux已经一个月了,其间遇到了不少问题,而今天笔者遇到的问题是 #yum install pam-devel #This system is not registered to ...
- RedHat Enterprise Linux 6.4使用Centos 6 的yum源 分类: 服务器搭建 Nginx 2015-07-14 14:11 5人阅读 评论(0) 收藏
转载自:http://blog.sina.com.cn/s/blog_50f908410101cto6.html 思路:卸载redhat自带yum,然后下载centos的yum,安装后修改配置文件 1 ...
- CentOS 6.6 yum源完全配置
原文地址 http://blog.csdn.net/halazi100/article/details/41311837 一 yum 简介 yum,是"Yellow dog Updater, ...
- CentOS 添加常用 yum 源
CentOS 的官方源去掉了一些与版权有关的软件,因此想要安装这些软件或者手动下载安装,或者使用其他源. 下面我推荐常用的两个源, 这两个源基本可以满足一般服务器的使用需求. 首先, 添加源之前要确定 ...
- OS + CentOS / http_proxy / https_proxy / dalishangwang / repo
s OS + Linux RedHat / redhat7 / redhat 7 / redhat 6 / redhat 5 https://lindows.iteye.com/blog/456637 ...
- 安装CentOS 7 的yum 到 Radhat 7上,使其可以获取资源
镜像资源: 1. http://mirrors.163.com/ 2. https://opsx.alibaba.com/mirror 从上列镜像资源下载如下rpm软件包 -rw-r--r--. 1 ...
随机推荐
- 【Python】新建自定义个数的自定义长度名字
# -*- coding:utf-8 -*- import random def CreateRandomName(number,length): """ :param ...
- 加载驱动三种execute
executeQuery executeUpdate executeQueryBatch
- linux禁止非法用户试探登录
当我们的linux主机一旦暴露在互联网上,就会遭受到来自网络上的一些非法用户的骚扰.如弱口令扫描,试探性登录:这些行为对linux主机构成一定的威胁.那怎样防范此类的攻击了,这里写了一个脚本,功能就是 ...
- php输出年份
Copyright <?php echo date('Y');?> by Creditease Corp.All Right Reserved.
- Grafana3.0.1+Zabbix3.0.4监控系统平台搭建
前言 本文的Zabbix部分知识只介绍它的基础安装,Zabbix的使用以及配置优化并不在本文的介绍范围之内. 本文只介绍在CentOS6系列下的安装和部署,其他发行版与其他版本号暂不涉及 本文默认使用 ...
- css动画,展开折叠图标
@keyframes packupArrowFlow { 0% { bottom:; } 70% { bottom: 10px; } } @-webkit-keyframes packupArrowF ...
- SQL 字符串分割表函数
--字符串分割表函数 ) ) declare @i int; declare @count int; ); ); declare @Index int; )) declare @rowID int; ...
- mysql中使用行号
SELECT `table`.*, (@rownum := @rownum + 1) AS ROWNUMFROM `table` inner join (SELECT @rownum := 0) rW ...
- javascript删除Cookie的正确方法(转载)
原来一直以为只要设置javascript的document.cookie对象就能简单的在浏览器端设置和删除cookie值,网上很多文章也是这么教的,但是最近发现简单的设置javascript的docu ...
- map的综合例子
#include<iostream> #include<string> #include<map> #include<fstream> #include ...