博客
关于我
搭建私有YUM仓库与内网镜像站
阅读量:663 次
发布时间:2019-03-15

本文共 1820 字,大约阅读时间需要 6 分钟。

搭建私有YUM仓库

系统版本:7.4 IP:192.168.1.47

私有YUM仓库服务端配置

第一:创建使用YUM仓库存放路径

mkdir /home/mirrors/siyou -p

第二:安装必要软件

yum install createrepo yum-utils -y

第三:上传自己打包好的RPM包到 /home/mirrors/siyou

cd /home/mirrors/siyoulrzsz # 或者使用其他下载工具

第四:初始化repodata索引文件

createrepo -pdo /home/mirrors/siyou/ /home/mirrors/siyou/

每新添加一个RPM包后,都需要更新索引文件

createrepo --update /home/mirrors/siyou/

第五:提供HTTP服务

cd /home/mirrors/python -m SimpleHTTPServer 80

客户端配置

在使用私有源时,建议先禁用其他源。为了便于管理,建议备份官方源并创建自己的源配置文件。

创建私有源配置文件

vim /etc/yum.repo.d/centos-siyou.repo

内容如下:

[siyou]name=siyoubaseurl=http://192.168.1.47/siyouenable=1gpgcheck=0

重建缓存并安装软件

yum clean all && yum makecache

安装必要软件包

yum install openssl-* -y

镜像站环境

系统版本:CentOS 7.4 IP:192.168.1.47

要能够接入公网,可以访问CentOS及EPAL官方源、中国站(中科大镜像站)镜像。

其中科大的rsync服务器地址为:

rsync://mirrors.ustc.edu.cn/centos/7/os/rsync://mirrors.ustc.edu.cn/centos/7/extras/rsync://mirrors.ustc.edu.cn/centos/7/updates/rsync://mirrors.ustc.edu.cn/epel/7/

内网镜像服务器配置

第一:安装必要软件

yum install rsync -y

第二:同步软件源同步CentOS 7的官方源

mkdir /home/mirrors/centos/7 -prsync -av rsync://mirrors.ustc.edu.cn/centos/7/os/ /home/mirrors/centos/7

同步extras源

rsync -av rsync://mirrors.ustc.edu.cn/centos/7/extras/ /home/mirrors/centos/7

同步updates源

rsync -av rsync://mirrors.ustc.edu.cn/centos/7/updates/ /home/mirrors/centos/7

创建一个简单的同步命令

rsync -av rsync://mirrors.ustc.edu.cn/centos/7.4.1708/ /home/mirrors/centos/

同步epel源

mkdir /home/mirrors/epel/7 -prsync -av rsync://mirrors.ustc.edu.cn/epel/7/ /home/mirrors/epel/7

要长期使用,可将同步命令写入定期执行文件,定期同步更新。可以参考以下示例:

# 定期同步命令(使用rsync sync文件)@reboot sync -av rsync://mirrors.ustc.edu.cn/centos/7/ /home/mirrors/centos/

启动HTTP服务

cd /home/mirrors/python -m SimpleHTTPServer 80

客户端使用

清除缓存并重建缓存

yum clean all && yum makecache

安装软件

yum install tree -y

这是一个关于搭建私有YUM仓库的完整指南,涵盖服务端和客户端的配置,还包含如何构建一个高效的内网镜像站。如果您需要进一步的帮助或遇到问题,请参考相关文档或联系技术支持团队。

转载地址:http://pixmz.baihongyu.com/

你可能感兴趣的文章
python | ttkbootstrap,一个神奇的 Python 库!
查看>>
python | unoconv,一个超厉害的 Python 库!
查看>>
python | urllib3,一个超强的 Python 库!
查看>>
python | webassets,一个超强的 Python 库!
查看>>
python | werkzeug,一个不可思议的 Python 库!
查看>>
python | xlsxwriter,一个实用的 Python 库!
查看>>
python | xlwings,一个非常实用的 Excel 相关的 Python 库!
查看>>
python | xmltodict,一个非常厉害的 关于XML数据 Python 库!
查看>>
python | xonsh,一个超酷的 Python 库!
查看>>
python | yagmail,一个实用的 Python 库!
查看>>
python | 一文掌握Python的上下文管理器和with语句
查看>>
python | 一文看懂Python闭包机制与变量作用域规则
查看>>
python读取含中文的json
查看>>
python | 如何用Python锁避免并发错误?
查看>>
python | 提升代码迭代速度的Python重载方法
查看>>
python | 深入理解Python并发编程中的GIL限制与解决方案
查看>>
Python | 爬虫实战——亚马逊搜索页监控(附详细源码)
查看>>
python | 高效使用Python工具自动生成模块文档的秘诀
查看>>
python 一个list去除另一个list中的值
查看>>
python 三大框架的 介绍。
查看>>