2022-04-10 01:26:40
10 04 2022
摘要:linux系统建立私有yum仓库

1、安装createrepo
  1)[root@hgh101 ~]# yum install createrepo

2、创建源目录
  1)[root@hgh101 ~]# cd /usr/share/nginx/html/Rocky8.5/
  2)[root@hgh101 Rocky8.5]# createrepo ./
3、执行完后可以看到生成的repodata目录
  1)[root@hgh101 Rocky8.5]# cd repodata/
  2)[root@hgh101 repodata]# ls -l
   total 7136
   -rw-r--r--. 1 root root 1628922 Apr 2 11:09 2a2cf70c7c0b6833331d3d25696f4db53bad339cf35a2ce9caef561a111ae126-filelists.sqlite.bz2
   -rw-r--r--. 1 root root 644658 Apr 2 11:09 3b80ac931f1409dd47c0bbe8ded8d78bd098cfbe578179a5cd5977047541e81d-other.sqlite.bz2
   -rw-r--r--. 1 root root 1292327 Apr 2 11:09 4dd5616ee690496c804154d4a01efc055fdb9c7093ce1ec660a1087144f9c736-filelists.xml.gz
   -rw-r--r--. 1 root root 2188696 Apr 2 11:09 d00d086e99e27f38aed4d6d675133f4d860c5ceab2a25bf898188fd4f4186dde-primary.sqlite.bz2
   -rw-r--r--. 1 root root 449721 Apr 2 11:09 dbb15c7947cd47e4fdefe4689c384343e7e7205e9177151222b78568ba348347-other.xml.gz
   -rw-r--r--. 1 root root 1088559 Apr 2 11:09 fb0148659b67200443e21521ff2994890fc6ee06f2f0babdbe18c5a0f7fc3d5e-primary.xml.gz
   -rw-r--r--. 1 root root 3107 Apr 2 11:09 repomd.xml
4、编辑yum配置文件使用
  1)[root@hgh101 repodata]# gzip /etc/yum.repos.d/* #先备份原的配置
  2) 配置自己的源
  cat >/etc/yum.repos.d/localyum.repo<<EOF
   [baseos]
   name=Rocky Linux $releasever - BaseOS
   baseurl=http://192.168.1.101/Rocky8.5/
   gpgcheck=0
   enabled=1
   EOF
3)[root@hgh101 repodata]# yum makecache #元数据缓存已建立

5、加入新的rmp包得更新源数据
  1)[root@hgh101 repodata]# createrepo --update /usr/share/nginx/html/Rocky8.5/
  2)[root@hgh101 repodata]# yum makecache

延伸阅读
  1. 上一篇:JDK
  2. 下一篇:Nginx
发表评论