博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
自己动手制作一个本地的yum仓库
阅读量:6913 次
发布时间:2019-06-27

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

制作本地yum源有两种方式,第一种是使用光盘镜像,然后在本地进行安装。第二种是我们自己创建一个本地yum仓库,然后使用file的形式来向本地提供yum repo(也可以使用http的方式向外部提供,我们这里就自己给自己创建yum仓库)

1、把从网上下载的rpm包放在本地的某个文件夹里面

我们可以这样子下载,使用yum下载rpm包但是并不安装

yum groupinstall "Development tools" --downloadonly --downloaddir=./
[root@chaofeng yum]# pwd/data/yum                                                  #我是把RPM包放在了/data/yum目录下[root@chaofeng yum]# lsautoconf-2.69-11.el7.noarch.rpm          intltool-0.50.2-7.el7.noarch.rpmautomake-1.13.4-3.el7.noarch.rpm         libquadmath-devel-4.8.5-36.el7.x86_64.rpmbison-3.0.4-2.el7.x86_64.rpm             libtool-2.4.2-22.el7_3.x86_64.rpmbyacc-1.9.20130304-3.el7.x86_64.rpm      patch-2.7.1-10.el7_5.x86_64.rpmcscope-15.8-10.el7.x86_64.rpm            patchutils-0.3.3-4.el7.x86_64.rpmctags-5.8-13.el7.x86_64.rpm              perl-Git-1.8.3.1-20.el7.noarch.rpmdiffstat-1.57-4.el7.x86_64.rpm           rcs-5.9.0-5.el7.x86_64.rpmdoxygen-1.8.5-3.el7.x86_64.rpm           redhat-rpm-config-9.1.0-87.el7.centos.noarch.rpmflex-2.5.37-6.el7.x86_64.rpm             rpm-build-4.11.3-35.el7.x86_64.rpmgcc-4.8.5-36.el7.x86_64.rpm              rpm-sign-4.11.3-35.el7.x86_64.rpmgcc-c++-4.8.5-36.el7.x86_64.rpm          subversion-1.7.14-14.el7.x86_64.rpmgcc-gfortran-4.8.5-36.el7.x86_64.rpm     swig-2.0.10-5.el7.x86_64.rpmgettext-devel-0.19.8.1-2.el7.x86_64.rpm  systemtap-3.3-3.el7.x86_64.rpmgit-1.8.3.1-20.el7.x86_64.rpm            systemtap-devel-3.3-3.el7.x86_64.rpmindent-2.2.11-13.el7.x86_64.rpm

2、下载制作本地yum的命令程序包

创建仓库需要特定的程序包来完成。我们下载这个程序包

yum install createrepo

3、确保防火墙关闭状态

4、开始创建yum仓库,在rpm包存放的所在的目录下执行createrepo命令。

[root@chaofeng yum]# createrepo ./Spawning worker 0 with 29 pkgsWorkers FinishedSaving Primary metadataSaving file lists metadataSaving other metadataGenerating sqlite DBsSqlite DBs complete

创建完成后我们会看到这个目录repodata,这个目录很是关键,

5、在/etc/yum.repos.d目录下创建配置文件。(我这里是以本地file的形式给自己的主机提供yum源,如果你要在局域网内的其他主机可以访问到,则使用http或ftp的形式进行,比如:base=http://{当前yum源所在主机的IP}/{RPM软件包目录})

[root@chaofeng yum.repos.d]# cat CentOS-BenDi.repo[Centos-BenDi]name=centos yum repobaseurl=file:///data/yumenabled=1gpgcheck=0priority=1

7、更新本地缓存即可

yum clean allyum makecache

8、尝试安装一个本地存在的软件包gcc

[root@chaofeng yum.repos.d]# yum install gcc已加载插件:fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.zju.edu.cn * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.163.com * updates: centos.mirrors.estointernet.in正在解决依赖关系--> 正在检查事务---> 软件包 gcc.x86_64.0.4.8.5-36.el7 将被 安装--> 解决依赖关系完成依赖关系解决======================================================================================================== Package            架构                  版本                        源                           大小========================================================================================================正在安装: gcc                x86_64                4.8.5-36.el7                Centos-BenDi                 16 M事务概要========================================================================================================安装  1 软件包总下载量:16 M安装大小:37 MIs this ok [y/d/N]: y

上面我们可以看到下载gcc包使用的正是我们刚刚我们制作的本地yum源。

9、我们还可以这样子检测是否使用了本地yum源

[root@chaofeng yum]# yum repolist已加载插件:fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.zju.edu.cn * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.163.com * updates: centos.mirrors.estointernet.in源标识                            源名称                                                          状态Centos-BenDi                      centos yum repo                                                     29base/7/x86_64                     CentOS-7 - Base                                                 10,019epel/x86_64                       Extra Packages for Enterprise Linux 7 - x86_64                  12,851extras/7/x86_64                   CentOS-7 - Extras                                                  321updates/7/x86_64                  CentOS-7 - Updates                                                 625repolist: 23,845

你看第一个就是我们自己制作的本地yum源。

转载于:https://www.cnblogs.com/FengGeBlog/p/10230311.html

你可能感兴趣的文章
1032. Sharing (25)
查看>>
JSP的隐藏对象
查看>>
2014秋C++ 第8周项目 分支程序设计
查看>>
[pig] pig 基础使用
查看>>
java中的线程同步
查看>>
Does the parameter type of the setter match the return type of the getter?
查看>>
MongoDB count distinct group by JavaAPI查询
查看>>
Java多线程系列——原子类的实现(CAS算法)
查看>>
LibEvent代码阅读--多缓冲区和零拷贝技术
查看>>
学生管理系统报错(一)
查看>>
使用 Live555 搭建流媒体服务器
查看>>
第十四周(OOP版电子词典)
查看>>
网络基础知识小小说
查看>>
linux lsof命令详解
查看>>
POJ 1163 The Triangle【dp+杨辉三角加强版(递归)】
查看>>
vue如何在路由跳转的时候更新组件
查看>>
Java多线程(二)
查看>>
《深入浅出数据分析》读后具体解释
查看>>
C++中的异常安全性
查看>>
Xcode中的变量模板(variable template)的使用方法
查看>>