reposync同步aliyunyum库到本地

1、软件安装: yum -y install   yum-utils   createrepo plugin-priorities 

       yum-utils:reposync同步工具

       createrepo:编辑yum库工具

       plugin-priorities:控制yum源更新优先级工具,这个工具可以用来控制进行yum源检索的先后顺序,建议可以用在client端。

2、安装nginx:yum –y install Nginx

3、修改nginx配置文件:/etc/nginx/nginx.conf

4、先把yum库移走先: mkdir /repo  && mv /etc/yum.repos.d/* /repo 

5、建议aliyun yum库:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

wget -O /etc/yum.repos.d/CentOS-epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

 

6、刷新缓存

yum clean all
yum makecache

7、yum repolist

[root@localhost yum.repos.d]# yum repolist
已加载插件:fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
仓库标识仓库名称状态
baseCentOS-6 - Base - mirrors.aliyun.com6,706
extras  CentOS-6 - Extras - mirrors.aliyun.com 46
updates CentOS-6 - Updates - mirrors.aliyun.com   826
repolist: 7,778

8、nginx的html目录:/usr/share/nginx/html/

9、建立rpm库存放目录:mkdir -p /usr/share/nginx/html/Aliyun/CentOS/7/64bit/{base,extras,updates}

10、开始同步下载rpm包:reposync -p /usr/share/nginx/html/Aliyun/CentOS/7/64bit

11、建库:cd /usr/share/nginx/html/Aliyun/CentOS/7/

                 cd base && createrepo -p ./ && cd -

                 cd extras && createrepo -p ./ && cd -

                 cd updates && createrepo -p ./ && cd -

12、其他服务器连接YUM仓库:

vim /etc/yum.repos.d/test.repo

[base]
name=CentOS-Base(GDS)
baseurl=http://10.63.215.7/Aliyun/CentOS/7/64bit/base
path=/
enabled=1
gpgcheck=0

[updates]
name=CentOS-Updates(GDS)
baseurl=http://10.63.215.7/Aliyun/CentOS/7/64bit/updates
path=/
enabled=1
gpgcheck=0

[extras]
name=CentOS-Extras(GDS)
baseurl=http://10.63.215.7/Aliyun/CentOS/7/64bit/extras
path=/
enabled=1
gpgcheck=0

13、建立定时同步,每周一的3点同步:

crontab -e

0 3 * * 1 /usr/bin/reposync -np   /usr/share/nginx/html/Aliyun/CentOS/7/64bit

 

资料信息取之于:https://www.cnblogs.com/juandx/p/6136621.html

                             https://blog.csdn.net/u012402276/article/details/53158682

                             https://www.cnblogs.com/music378/p/7993318.html

  • 1
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值