首页 技术 正文
技术 2022年11月15日
0 收藏 975 点赞 3,650 浏览 3903 个字

linux使用createrepo制作本地yum源

 目录

linux使用createrepo制作本地yum源

安装createrepo软件包

yum install -y createrepo

[root@ServerA ~]# yum install -y createrepo
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 createrepo.noarch.0.0.9.9-28.el7 将被 安装
--> 正在处理依赖关系 python-deltarpm,它被软件包 createrepo-0.9.9-28.el7.noarch 需要
--> 正在处理依赖关系 libxml2-python,它被软件包 createrepo-0.9.9-28.el7.noarch 需要
--> 正在处理依赖关系 deltarpm,它被软件包 createrepo-0.9.9-28.el7.noarch 需要
--> 正在检查事务
---> 软件包 deltarpm.x86_64.0.3.6-3.el7 将被 安装
---> 软件包 libxml2-python.x86_64.0.2.9.1-6.el7_2.3 将被 安装
---> 软件包 python-deltarpm.x86_64.0.3.6-3.el7 将被 安装
--> 解决依赖关系完成依赖关系解决======================================================================================
Package 架构 版本 源 大小
======================================================================================
正在安装:
createrepo noarch 0.9.9-28.el7 yum 94 k
为依赖而安装:
deltarpm x86_64 3.6-3.el7 yum 82 k
libxml2-python x86_64 2.9.1-6.el7_2.3 yum 247 k
python-deltarpm x86_64 3.6-3.el7 yum 31 k事务概要
======================================================================================
安装 1 软件包 (+3 依赖软件包)总下载量:454 k
安装大小:2.0 M
Downloading packages:
--------------------------------------------------------------------------------------
总计 20 MB/s | 454 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : deltarpm-3.6-3.el7.x86_64 1/4
正在安装 : python-deltarpm-3.6-3.el7.x86_64 2/4
正在安装 : libxml2-python-2.9.1-6.el7_2.3.x86_64 3/4
正在安装 : createrepo-0.9.9-28.el7.noarch 4/4
验证中 : createrepo-0.9.9-28.el7.noarch 1/4
验证中 : libxml2-python-2.9.1-6.el7_2.3.x86_64 2/4
验证中 : deltarpm-3.6-3.el7.x86_64 3/4
验证中 : python-deltarpm-3.6-3.el7.x86_64 4/4 已安装:
createrepo.noarch 0:0.9.9-28.el7 作为依赖被安装:
deltarpm.x86_64 0:3.6-3.el7 libxml2-python.x86_64 0:2.9.1-6.el7_2.3
python-deltarpm.x86_64 0:3.6-3.el7 完毕!

进入本地rpm包目录

[root@ServerA yum]# ll
总用量 244
dr-xr-xr-x 2 root root 200704 12月 4 15:48 Packages
[root@ServerA yum]# pwd
/root/yum
[root@ServerA Packages]# createrepo ./
Spawning worker 0 with 1862 pkgs
Spawning worker 1 with 1861 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@ServerA Packages]#

执行完后可以看到生成的repodata目录

[root@ServerA yum]#
[root@ServerA yum]# ll
总用量 248
dr-xr-xr-x 2 root root 200704 12月 4 15:48 Packages
drwxr-xr-x 2 root root 4096 12月 4 15:49 repodata
[root@ServerA yum]#
[root@ServerA yum]# cd repodata/
[root@ServerA repodata]# ls
40bac61f2a462557e757c2183511f57d07fba2c0dd63f99b48f0b466b7f2b8d2-other.xml.gz
89f2f521e86842c3874e2d3e0adf9fcc57f51a677007695372fef9cbc094a93a-primary.sqlite.bz2
9710c85f1049b4c60c74ae5fd51d3e98e4ecd50a43ab53ff641690fb164a6d63-other.sqlite.bz2
cfa741341d5d270d5b42d6220e2908d053c39a2d8346986bf48cee360e6f7ce8-filelists.xml.gz
d863fcc08a4e8d47382001c3f22693ed77e03815a76cedf34d8256d4c12f6f0d-filelists.sqlite.bz2
e4567be6b0b9a3fa62ae0c731d0ace9656c93f38cac1947e37c4d58d4a097d1a-primary.xml.gz
repomd.xml
[root@ServerA repodata]#

至此个人yum源完成

编辑yum配置文件使用

vim /etc/yum.repo/yum.repo

[yum2]
name=yum2
baseurl=file:///root/yum/
gpgcheck=0
enabled=1

完成,测试使用

[root@ServerA repodata]#
[root@ServerA repodata]# yum makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
yum2 | 2.9 kB 00:00:00
(1/3): yum2/filelists_db | 2.9 MB 00:00:00
(2/3): yum2/primary_db | 2.8 MB 00:00:00
(3/3): yum2/other_db | 1.2 MB 00:00:00
元数据缓存已建立
[root@ServerA repodata]#
[root@ServerA repodata]#
[root@ServerA repodata]#
[root@ServerA repodata]#
[root@ServerA repodata]#
[root@ServerA repodata]# yum search php-mysql
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
=============================== N/S matched: php-mysql ===============================
php-mysql.x86_64 : A module for PHP applications that use MySQL databases 名称和简介匹配 only,使用“search all”试试。
[root@ServerA repodata]#

关于更新yum仓

不需要重新生成

使用createrepo --update 路径即可

[root@ServerA yum]# createrepo --update ./
Spawning worker 0 with 8 pkgs
Spawning worker 1 with 8 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@ServerA yum]#
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,489
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,904
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,737
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,490
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,128
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,291