前言
内网环境搭建本地yum仓库
步骤
创建本地仓库
最好是创建一个ftp的服务器,来存放rpm的安装包,这样所有内网,其他只需将baseurl
修改为ftp://<ip>/<目录>
rpm存放的位置即可
# cd /etc/yum.repos.d/
# mkdir bak
# mv CentOS* bak/
# vi local.repo
[local]
name=local
baseurl=file://opt/app
gpgcheck=0
enabled=0
上传安装包
- 将我们下载的rpm安装包上传到
/opt/app
目录下 - 制作基础镜像,并通过
mount
挂载到/opt
或者/mnt
目录下
挂载到/mnt下的话.对应的baseurl的地址需要替换为file://mnt/<软件包目录>
生成repodata信息
代码语言:javascript复制# rpm -ivh /opt/libxml2-* --force --nodeps
# rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm --force --nodeps
# rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm --force --nodeps
# reaterepo /app/
验证yum源
代码语言:javascript复制yum clean all
yum list
查看仓库信息
代码语言:javascript复制[root@t-scrm-service-redis app]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id repo name status
local local 0
repolist: 0
[root@t-scrm-service-redis app]# yum repoinfo
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Repo-id : local
Repo-name : local
Repo-revision: 1596436019
Repo-updated : Mon Aug 3 14:26:59 2020
Repo-pkgs : 0
Repo-size : 0
Repo-baseurl : file://opt/app/
Repo-expire : 21,600 second(s) (last: Mon Aug 3 14:27:10 2020)
Filter : read-only:present
Repo-filename: /etc/yum.repos.d/local.repo
repolist: 0