目标:针对现有的yum源进行封装,主要是在centos7的系统进行yum源的搭建
主要封装的源是:阿里云yum源,epel源、戴尔镜像源
一、源文件下载
#同步源文件需要的依赖
yum install -y wget make cmake gcc gcc-c++ pcre-devel zlib-devel openssl openssl-devel createrepo yum-utils plugin-priorities
#下载阿里云repo包
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
yum clean all
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
#下载epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#下载dell源
wget -q -O - http://linux.dell.com/repo/hardware/Linux_Repository_15.07.00/bootstrap.cgi | bash
#检验源是否正常
yum repolist
说明:
yum-utils:reposync同步工具
createrepo:编辑yum库工具
plugin-priorities:控制yum源更新优先级工具,这个工具可以用来控制进行yum源检索的先后顺序,建议可以用在client端。
二、同步源文件到本地
#创建源目录,nginx中配置的路径下面
mkdir /var/www/html/yum/mirror
#同步到本地目录
reposync -p /var/www/html/yum/mirror/centos7.5
reposync -p /var/www/html/yum/mirror/epel7.5
reposync -p /var/www/html/yum/mirror/dell7.5
注:不用担心没有创建相关目录,系统自动创建相关目录,并下载,时间较长请耐心等待
#生成repodate信息
cd /var/www/html/yum/mirror
createrepo centos7.5
createrepo epel7.5
createrepo dell7.5
#由于传输是走的世纪互联带宽,在阿里云中下载完成,传输至本地机器,限速100M
rsync -avzP --bwlimit=102400 /data/resources/epel 10.10.10.1:/var/www/html/mirror/ |
三、配置yum源
[to8to_base]
name=to8to-base
baseurl=http://10.10.10.1/yum/mirror/centos7.5/base/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
[to8to_updates]
name=to8to-updates
baseurl=http://10.10.10.1/yum/mirror/centos7.5/updates/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
[to8to_extras]
name=to8to-extras
baseurl=http://10.10.10.1/yum/mirror/centos7.5/extras/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
[to8to_epel]
name=to8to-epel
baseurl=http://10.10.10.1/yum/mirror/epel7.5/
gpgcheck=0
enabled=1
[to8to_dell]
name=to8to-dell
baseurl=http://10.10.10.1/yum/mirror/dell7.5/
gpgcheck=0
enabled=1 |
参考链接:https://www.cnblogs.com/lldsn/p/10479493.html
https://www.cnblogs.com/asheng2016/p/local-yum.html