在yum服务器上创建yum仓库命令
mkdir -p /nginx/html/yumcd /nginx/html/yum
安装createrepo软件
yum install createrepo -y
初始化repodata索引文件
createrepo -pdo /nginx/html/yum/ /nginx/html/yum/
提供yum服务
# 可以用Apache或nginx提供web服务,但用Python的http模块更简单,适用于内网环境。cd /application/nginx/html/yum/python -m SimpleHTTPServer 80 &>/dev/null &
本地yum缓存
vim etc/yum.conf[main]cachedir=/var/cache/yum/$basearch/$releaseverkeepcache=1debuglevel=2logfile=/var/log/yum.logexactarch=1obsoletes=1gpgcheck=1plugins=1installonly_limit=5# keepcache=1,开启本地缓存。省略若干行代码
添加新的rpm包
# 只下载软件不安装yumdownloader pcre-devel openssl-develcreaterepo --update nginx/html/yum/# 每加入一个rpm包就要更新一下。
客户端配置
yum -y install yum-plugin-priorities.noarchcd /etc/yum.repos.d[root@test yum.repos.d]# cat weijing.repo[weijing]name=Serverbaseurl=http://192.168.1.10/yum/enable=1gpgcheck=0priority=1yum --enablerepo=weijing --disablerepo=base,extras,updates,epel list# 指定使用weijing库# 添加yum源的时候只需要添加一个新的repo文件即可。
yum安装本地软件包
# 清除yum缓存yum clean allyum repolist# yum仓库搭建完成!
文章转载自潍鲸,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




