背景
客戶服務器為內網機器,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安裝自行解決對應的依賴關系,而不是手動安裝