自建Yum源并与科大开源镜像站进行同步

前端之家收集整理的这篇文章主要介绍了自建Yum源并与科大开源镜像站进行同步前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装Nginx

yum-yinstallNginx

新增yum.conf配置文件

server{
listen80;
server_nameyum.gogen.cn;

location/{
root/usr/share/Nginx/yum;
autoindexon;
autoindex_exact_sizeoff;
autoindex_localtimeon;
}
}

启动Nginx

systemctlstartNginx
systemctlenableNginx

创建目录

mkdir-p/usr/share/Nginx/yum/epel/6/x86_64
mkdir-p/usr/share/Nginx/yum/centos/6/updates/x86_64
mkdir-p/usr/share/Nginx/yum/centos/6/extras/x86_64
mkdir-p/usr/share/Nginx/yum/centos/6/os/x86_64
mkdir-p/usr/share/Nginx/yum/epel/7/x86_64
mkdir-p/usr/share/Nginx/yum/centos/7/updates/x86_64
mkdir-p/usr/share/Nginx/yum/centos/7/extras/x86_64
mkdir-p/usr/share/Nginx/yum/centos/7/os/x86_64

注:如果需要其它系统还需要创建对应的其它目录

同步镜像

#!/bin/bash
#
#此脚本用于同步"http://mirrors.ustc.edu.cn"的镜像到本地
#如果还需要其它系统那么直接往后面加上去
#
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/epel/7/x86_64//usr/share/Nginx/yum/epel/7/x86_64&&\
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/centos/7/extras/x86_64//usr/share/Nginx/yum/centos/7/extras/x86_64&&\
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/centos/7/updates/x86_64//usr/share/Nginx/yum/centos/7/updates/x86_64&&\
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/centos/7/os/x86_64//usr/share/Nginx/yum/centos/7/os/x86_64&&\
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64//usr/share/Nginx/yum/epel/6/x86_64&&\
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/centos/6/extras/x86_64//usr/share/Nginx/yum/centos/6/extras/x86_64&&\
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/centos/6/updates/x86_64//usr/share/Nginx/yum/centos/6/updates/x86_64&&\
rsync-avrtrsync://rsync.mirrors.ustc.edu.cn/centos/6/os/x86_64//usr/share/Nginx/yum/centos/6/os/x86_64

加入计划任务

01***sh/usr/local/sbin/sync.sh&>/tmp/yum.log

CentOS7的repo文件

CentOS-Base.repo

#CentOS-Base.repo
#
#ThemirrorsystemusestheconnectingIPaddressoftheclientandthe
#updatestatusofeachmirrortopickmirrorsthatareupdatedtoand
#geographicallyclosetotheclient.YoushouldusethisforCentOSupdates
#unlessyouaremanuallypickingothermirrors.
#
#Ifthemirrorlist=doesnotworkforyou,asafallbackyoucantrythe
#remarkedoutbaseurl=lineinstead.
#
#

[base]
name=CentOS-$releasever-Base
baseurl=http://yum.gogen.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#releasedupdates
[updates]
name=CentOS-$releasever-Updates
baseurl=http://yum.gogen.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additionalpackagesthatmaybeuseful
[extras]
name=CentOS-$releasever-Extras
baseurl=http://yum.gogen.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additionalpackagesthatextendfunctionalityofexistingpackages
[centosplus]
name=CentOS-$releasever-Plus
baseurl=http://yum.gogen.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

epel.repo

[epel]
name=ExtraPackagesforEnterpriseLinux7-$basearch
baseurl=http://yum.gogen.cn/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=ExtraPackagesforEnterpriseLinux7-$basearch-Debug
baseurl=http://yum.gogen.cn/epel/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=ExtraPackagesforEnterpriseLinux7-$basearch-Source
baseurl=http://yum.gogen.cn/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

CentOS6的repo文件

CentOS-Base.repo

#CentOS-Base.repo
#
#ThemirrorsystemusestheconnectingIPaddressoftheclientandthe
#updatestatusofeachmirrortopickmirrorsthatareupdatedtoand
#geographicallyclosetotheclient.YoushouldusethisforCentOSupdates
#unlessyouaremanuallypickingothermirrors.
#
#Ifthemirrorlist=doesnotworkforyou,asafallbackyoucantrythe
#remarkedoutbaseurl=lineinstead.
#
#

[base]
name=CentOS-$releasever-Base-yum.gogen.cn
baseurl=http://yum.gogen.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://yum.gogen.cn/centos/RPM-GPG-KEY-CentOS-6

#releasedupdates
[updates]
name=CentOS-$releasever-Updates-yum.gogen.cn
baseurl=http://yum.gogen.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://yum.gogen.cn/centos/RPM-GPG-KEY-CentOS-6

#additionalpackagesthatmaybeuseful
[extras]
name=CentOS-$releasever-Extras-yum.gogen.cn
baseurl=http://yum.gogen.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://yum.gogen.cn/centos/RPM-GPG-KEY-CentOS-6

#additionalpackagesthatextendfunctionalityofexistingpackages
[centosplus]
name=CentOS-$releasever-Plus-yum.gogen.cn
baseurl=http://yum.gogen.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://yum.gogen.cn/centos/RPM-GPG-KEY-CentOS-6

#contrib-packagesbyCentosUsers
[contrib]
name=CentOS-$releasever-Contrib-yum.gogen.cn
baseurl=http://yum.gogen.cn/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://yum.gogen.cn/centos/RPM-GPG-KEY-CentOS-6

epel.repo

[epel]
name=ExtraPackagesforEnterpriseLinux6-$basearch
baseurl=http://yum.gogen.cn/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=ExtraPackagesforEnterpriseLinux6-$basearch-Debug
baseurl=http://yum.gogen.cn/epel/6/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

[epel-source]
name=ExtraPackagesforEnterpriseLinux6-$basearch-Source
baseurl=http://yum.gogen.cn/epel/6/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
原文链接:https://www.f2er.com/bash/388271.html

猜你在找的Bash相关文章