封装yum源

 

目标:针对现有的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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值