自行制作yum源仓库

背景

客户服务器为内网机器,centos7系统,且无法与外网连接。需要部署对应的LANMP环境及其它软件

解决思路

1.在阿里云服务器,利用阿里云的yum源仓库,下载对应软件及关联软件。

2.在客户机上面自建yum仓库,然后通过yum安装,解决依赖问题

下载软件
[root@compute1 tmp]# mkdir -pv /tmp/soft
cd /tmp/soft
[root@compute1 soft]# ll /tmp/soft
total 0
[root@compute1 soft]# yum install nginx --downloadonly --downloaddir=/tmp/soft
[root@compute1 soft]# ll /tmp/soft
total 0
-rw-r--r-- 1 root root 0 Jul 13 14:13 fontconfig-2.10.95-10.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 fontpackages-filesystem-1.44-8.el7.noarch.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 gd-2.0.35-26.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 GeoIP-1.5.0-11.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 libXpm-3.5.11-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-1.10.2-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-all-modules-1.10.2-1.el7.noarch.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-filesystem-1.10.2-1.el7.noarch.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-mod-http-geoip-1.10.2-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-mod-http-image-filter-1.10.2-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-mod-http-perl-1.10.2-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-mod-http-xslt-filter-1.10.2-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-mod-mail-1.10.2-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 0 Jul 13 14:13 nginx-mod-stream-1.10.2-1.el7.x86_64.rpm

提示不能使用--downloadonly的请先安装yum-utils软件

[root@compute1 soft]# yum -y install yum-utils

利用yum的参数,进行只下载,不安装,同时会下载对应依赖的软件

自建仓库

将上述app复制到客户内网机器,假设目录为/usr/app

[root@iZ25vh2zuf2Z ~]# cd /usr/app
[root@iZ25vh2zuf2Z app]# createrepo .

createrepo命令不存在的,可以yum install createrepo进行安装

这样自行仓库就建立完成,然后/etc/yum.repos.d/添加对应的配置文件

[root@iZ25vh2zuf2Z yum.repos.d]# cat localself.repo
[self]
name=local
baseurl=file:///usr/app
gpgcheck=0

[root@iZ25vh2zuf2Z yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: self
Cleaning up everything
[root@iZ25vh2zuf2Z yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                          repo name                 status
self                             local                     245
repolist: 245

可以看到自行存放的245个app已经出现在仓库列表中

然后可以通过yum安装自行解决对应的依赖关系,而不是手动安装

转载于:https://www.cnblogs.com/marility/p/7278374.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值