CentOS搭建内网离线yum仓库(以postgresql安装为例)

内网yum仓库服务端配置

192.168.126.146 Web服务端主机,已安装有Nginx

[root@bogon html]# createrepo -pdo postgresql/x86_64/ postgresql/x86_64/
  • 将下载完成的rpm包存放到到repodata工作目录

  • 更新yum源,每次有新增的rpm包都需要执行更新

[root@bogon html]# createrepo --update /usr/share/nginx/html/postgresql/x86_64/
  • 最终服务端目录如下所示,可能还需要添加相关依赖包,此处不作赘述,方法类似
[root@bogon html]# tree postgresql/
postgresql/
└── x86_64
    ├── pgdg-redhat-repo-42.0-4.noarch.rpm
    ├── pgdg-redhat-repo-latest.noarch.rpm
    └── repodata
        ├── 445ee0d2e31a019d6e1decf9485ef9a611c814c811c986812ccea999c4564872-primary.sqlite.bz2
        ├── 627e914a7e1d2dcad2bdaa75edd9730c2e4c0d2552a8ba400b0e21df5ce220db-other.xml.gz
        ├── 72d106452bea9d803f61c44ec8b0c06cc76e0abf1140b80002745330d4b1048b-other.sqlite.bz2
        ├── 86e85d2f38c54099bc474ca2567e49e8e3957659c9c776d6ccebd9cd64d90ae8-filelists.xml.gz
        ├── 974bc8888a0708d6bbfcd9404b21fffc256b11e77f40e6d2ab547673db05863d-primary.xml.gz
        ├── f2ad55ae551c06f1705eb388c105420f46306346ca90aee51fdbe79a2a853496-filelists.sqlite.bz2
        └── repomd.xml

2 directories, 9 files

客户端配置

  • 192.168.126.145 客户端主机
  • 编写客户端.repo文件,如下
[root@bogon yum.repos.d]# cat test.repo 
[base]
name=base
baseurl=http://192.168.126.146/base
enable=1
gpgcheck=0

[upodates]
name=updates
baseurl=http://192.168.126.146/updates
enable=1  
gpgcheck=0

[test]
name=test
baseurl=http://192.168.126.146/test
enable=1  
gpgcheck=0
  • 重建缓存,即可
[root@bogon yum.repos.d]# yum clean all && yum makecache

参考链接

CentOS 7 yum 安装 Nginx
搭建私有YUM仓库_及_内网镜像站
centos7自建yum源 安装rpm
创建局域网内的离线 YUM 仓库
搭建本地离线yum仓库
RPM包制作及yum仓库搭建

猜你喜欢

转载自www.cnblogs.com/zy37275/p/11306124.html