当前位置:首页 > 有云笔记 > SERVICES > 正文内容

linux如何做自定义Yum仓库?

小白2年前 (2021-12-20)SERVICES201210

linux如何做自定义Yum仓库?

一、自定义Yum仓库

•将自己下载的RPM包构建为仓库

•Yum仓库的组成:

   1.众多的软件包   2.仓库数据文件(repodata

 

•第一阶段 tools.tar.gz 

•由真机将tools.tar.gz传递到虚拟机A的/root目录下 

真机为Linux

]# ls   /linux-soft/
]# ls   /linux-soft/1
]# scp  /linux-soft/1/tools.tar.gz  root@192.168.4.7:/root/


[root@svr7 ~]# ls /root
[root@svr7 ~]# tar -tf /root/tools.tar.gz    #查看包内容
 
[root@svr7 ~]# tar -xf /root/tools.tar.gz  -C   /    #解包
[root@svr7 ~]# ls /
[root@svr7 ~]# ls /tools/
[root@svr7 ~]# ls /tools/other/


[root@svr7 ~]# createrepo /tools/other/ #生成仓库数据文件
[root@svr7 ~]# ls /tools/other/ 
[root@svr7 ~]# vim /etc/yum.repos.d/mydvd.repo

[mydvd]
name=centos7
baseurl=file:///mydvd
enabled=1
gpgcheck=0
[rpm] #唯一标识 
name=myrpm
baseurl=file:///tools/other #指定Yum仓库的路径
enabled=1
gpgcheck=0


[root@svr7 ~]# yum repolist
[root@svr7 ~]# yum -y install sl
[root@svr7 ~]# yum -y install cmatrix

更新自定义Yum仓库:   

1. 更新生成仓库数据文件

[root@svr7 ~]# createrepo  --update  /tools/other/

2.更新Yum缓存(yum  makecache更新yum缓存命令)

[root@svr7 ~]# yum  makecache


]# mv /tools/other/sl-5.02-1.el7.x86_64.rpm   /root/
]# yum repolist
]# createrepo  --update  /tools/other/
]# yum  makecache
]# yum repolist

over

linux如何做自定义Yum仓库?  您阅读本篇文章共花了: 

分享到:

    扫描二维码推送至手机访问。

    版权声明:本文由有云转晴发布,如需转载请注明出处。

    本文链接:https://www.yyzq.cf/?id=45

    分享给朋友:

    发表评论

    访客

    ◎欢迎参与讨论,请在这里发表您的看法和观点。