Linux搭建本地局域网源并同步支持rsync协议的外网源

一、搭建:

1.环境: Centos 7, ip:192.168.1.38

2.使用工具: Nginx 1.8

3.配置Nginx 安装好nginx后,在终端输入:

  whereis nginx 定位nginx启动文件的路径 >>:nginx: /usr/local/nginx 得到路径后,

    vim /usr/local/nginx/conf/nginx.conf  修改成以下内容

               server

      {

         listen 8080;

         server_name localhost;

        root /var/repos/;

         location / {

             autoindex on;
             autoindex_exact_size off;
                      autoindex_localtime on;

        }

       }

           修改好后,终端输入:sudo /usr/local/nginx/sbin/nginx -s reload nginx重启

4.创建文件夹:mkdir -p /var/repos/centos7

5.浏览器访问:localhost:8080

6.终端输入:rsync -avrt --delete --no-iconv --bwlimit=1000  rsync://mirrors.ustc.edu.cn/epel/7/ /var/repos/centos7/   同步互联网源到本地

7.客户端设置:
redhat系列的:
cd /etc/yum.repos.d

[base]
name=Centos 7
baseurl=http://192.168.1.38:888/Centos7/x86_64/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

posted @ 2018-04-10 14:09  lei-jia-ming  阅读(392)  评论(0编辑  收藏  举报