前提:需要在一个具备公网的服务器进行同步官网rpm包
配置阿里云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
同步公网镜像到本地私有仓库
reposync -np /data/nginx/nginx_80/mirrors/
3. 设置定时同步
#!/bin/bash
echo 'Updating Aliyum Source'
DATETIME=`date +%F_%T`
exec > /var/log/aliyumrepo_$DATETIME.log
reposync -np /data/package/centos/7/base
if [ $? -eq 0 ];then
createrepo --update /data/centos/7/base/base
createrepo --update /data/centos/7/base/extras
createrepo --update /data/centos/7/base/updates
createrepo --update /data/centos/7/base/epel
echo "SUCESS: $DATETIME aliyum_yum update successful" >>/var/log/aliyumrepo_$DATETIME.log
else
echo "ERROR: $DATETIME aliyum_yum update failed" >> /var/log/aliyumrepo_$DATETIME.log
fi
0 3 * * 1 /bin/sh /data/crond/yum_update.sh
有问题请加博主微信进行沟通!
全部评论