1.创建目录安装软件程序

1.在/root路径下创建123.sh文件,把此文件复制到123.sh里,  sh 123.sh
2.首选安装nginx,作为web展示
3.强力清除老版本残留
rpm -e nginx --nodeps
rm -rf  /etc/nginx
4.开始安装
yum install -y nginx

2.配置文件的编辑

cat > /etc/nginx/nginx.conf << EOF
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {worker_connections 1024;}
http {log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    server{
    listen              80;
    root                /var/ftp/pub/;
    autoindex on;}      }
EOF

#安装vsftpd
yum install  vsftpd -y
#启动自启nginx,ftp
systemctl start nginx
systemctl enable nginx
systemctl start vsftpd
systemctl enable vsftpd
#创建yum源存放目录
mkdir -p /var/ftp/pub/epel/7/
mkdir -p /var/ftp/pub/centos/7/os/x86_64/
mkdir -p /var/ftp/pub/centos/7/updates/x86_64/
mkdir -p /var/ftp/pub/centos/7/extras/x86_64/
mkdir -p /var/ftp/pub/centos/7/centosplus/x86_64/
#把不同步的yum源写入到排除文件
mkdir -p /var/ftp/pub/
cat > /var/ftp/pub/exclude.list <<EOF
SRPMS
aarch64
ppc64
ppc64le
debug
repodata
EFI
LiveOS
images
isolinux
CentOS_BuildTag
EULA
GPL
RPM-GPG-KEY-CentOS-7
RPM-GPG-KEY-CentOS-Testing-7
drpms
EOF
#这里写一个同步清华大学源的脚本
cat >  /var/ftp/pub/centos7-rsync.sh <<EOF
#epel
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/epel/7/ /var/ftp/pub/epel/7/
createrepo /var/ftp/pub/epel/7/
 
#centos7-base
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ /var/ftp/pub/centos/7/os/x86_64/
createrepo /var/ftp/pub/centos/7/os/x86_64/
 
#centos7-updates
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/updates/x86_64/ /var/ftp/pub/centos/7/updates/x86_64/
createrepo /var/ftp/pub/centos/7/updates/x86_64/
 
#centos7-extras
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/extras/x86_64/ /var/ftp/pub/centos/7/extras/x86_64/
createrepo /var/ftp/pub/centos/7/extras/x86_64/
 
#centos7-centosplus
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/centosplus/x86_64/ /var/ftp/pub/centos/7/centosplus/x86_64/
createrepo /var/ftp/pub/centos/7/centosplus/x86_64/

EOF

3.最后一步,执行脚本同步

sh /var/ftp/pub/centos7-rsync.sh

4.做一个定时更新yum源的任务(可做可不做)

echo "#每天4点更新yum源
00 04 * * *  /usr/bin/sh    /var/ftp/pub/centos7-rsync.sh  &> /dev/null" >> /var/spool/cron/root

 
 
 

搭建本地的yum仓库-较简单的更多相关文章

  1. 搭建本地离线yum仓库

    目录 前言 把rpm包下载到本地 配置本地yum仓库信息 生成repodata信息 检查以及使用 对本地仓库进行更新 参考资料 修改记录 环境:VMware-Workstation-12-Pro,Wi ...

  2. cobbler搭建本地的yum仓库源

    cobbler自动化安装参考文档 https://www.cnblogs.com/minseo/p/8537266.html 使用cobbler可以快速搭建一个本地的yum仓库 cobbler rep ...

  3. 5、cobbler搭建本地saltstack yum仓库

    5.1.安装cobbler: 参考"linux运维_集群_01(35.cobbler自动化安装操作系统:)" 5.2.cobbler yum源常用操作命令: cobbler rep ...

  4. (转)搭建企业内部yum仓库(centos6+centos7+epel源)

    搭建企业内部yum仓库(centos6+centos7+epel源) 原文:https://www.cnblogs.com/nulige/p/6081192.html https://www.linu ...

  5. 搭建企业内部yum仓库(centos6+centos7+epel源)

    搭建自己的yum仓库,将自己制作好的rpm包,添加到自己的yum源中. yum仓库服务端配置如下 : 1. 创建yum仓库目录 mkdir -p /data/yum_data/cd /data/yum ...

  6. 自己动手制作一个本地的yum仓库

    制作本地yum源有两种方式,第一种是使用光盘镜像,然后在本地进行安装.第二种是我们自己创建一个本地yum仓库,然后使用file的形式来向本地提供yum repo(也可以使用http的方式向外部提供,我 ...

  7. 搭建本地的git仓库

    折腾了快一天了,终于搭建成功了. 分享一下搭建的步骤: 一.GIT仓库的创建 1. adduser git 2. passwd git 此例设置git的密码为123456 3. cd /home/gi ...

  8. 基于虚拟机的centos6.5 搭建本地光盘yum源

    在线yum安装必须要保持服务器能够连入网络并且他下载的还会比较慢因为地址大部分多是国外的下载站.另外yum在线下载的都是比较新的软件包,可能不是很稳定,那么使用yum的本地资源就是光盘里的RPM包,让 ...

  9. 通过网络仓库建立本地的yum仓库

    [root@kazihuo ~]# yum -y install createrepo yum-utils [root@kazihuo ~]# yum -y install https://mirro ...

随机推荐

  1. 怎么查看当前的git分支是基于哪个分支创建的?

    2019独角兽企业重金招聘Python工程师标准>>> Question: 比如从 branch A 切出一个 branch B 然后对branch B做了一系列的操作 然后忘记了b ...

  2. 四、CentOS 6.5 上传和安装Nginx

    CentOS 6.5 上传和安装Nginx

  3. Ngxin 开启CDN 日志获取不了真实IP的解决办法。

    nginx配置里面在http{ 后加入如下两行代码即可: set_real_ip_from 0.0.0.0/0;real_ip_header X-Forwarded-For; 重启nginx生效. 注 ...

  4. 数学--数论--HDU - 6395 Let us define a sequence as below 分段矩阵快速幂

    Your job is simple, for each task, you should output Fn module 109+7. Input The first line has only ...

  5. Codeforce 1155D Beautiful Array(DP)

    D. Beautiful Array You are given an array aa consisting of nn integers. Beauty of array is the maxim ...

  6. Springboot-WebFlux实现http重定向到https

    1 简介 Spring WebFlux是一个新兴的技术,Spring团队把宝都压在响应式Reactive上了,于是推出了全新的Web实现.本文不讨论响应式编程,而是通过实例讲解Springboot W ...

  7. ubuntu 下修改MySQL 的root用户密码

    环境:Ubuntu 16.04  :  Mysql 5.7问题:mysql root登录密码 忘记了..忘记了..忘..了 1.登录MySQL $ mysql -u root -p 输入密码,如果登录 ...

  8. 洛谷p1149

    一道很有意思的题目嘞. 这道题目看起来,用搜索似乎无疑了. 我想了这样一个办法(看了很多博客似乎都没用这种方法),可能是觉得太麻烦了吧: 1.我们先把0到9的数字排列,找出排列消耗火柴等于0的序列.这 ...

  9. Day_08【面向对象】扩展案例2_测试旧手机新手机类,并给新手机实现玩游戏功能

    分析以下需求,并用代码实现 1.定义手机类 行为: 打电话,发短信 2.定义接口IPlay 行为: 玩游戏 3.定义旧手机类继承手机类 行为: 继承父类的行为 4.定义新手机继承手机类实现IPlay接 ...

  10. 【FreeRTOS学习05】深度解剖FreeRTOSConfig.h实现对系统的自定义剪裁

    ROM/RAM太小,因此要对系统进行剪裁: 相关文章 [FreeRTOS实战汇总]小白博主的RTOS学习实战快速进阶之路(持续更新) 文章目录 相关文章 1 系统的剪裁 2 FreeRTOSConfi ...