自制 yum 源倉庫

轉自:https://www.cnblogs.com/marility/p/7278374.htmlhtml

背景

客戶服務器爲內網機器,centos7系統,且沒法與外網鏈接。須要部署對應的LANMP環境及其它軟件nginx

解決思路

1.在阿里雲服務器,利用阿里雲的yum源倉庫,下載對應軟件及關聯軟件。centos

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 

利用yum的參數,進行只下載,不安裝,同時會下載對應依賴的軟件app

自建倉庫

將上述app複製到客戶內網機器,假設目錄爲/usr/app阿里雲

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

createrepo命令不存在的,能夠yum install createrepo進行安裝url

這樣自行倉庫就創建完成,而後/etc/yum.repos.d/添加對應的配置文件centos7

[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已經出如今倉庫列表中spa

而後能夠經過yum安裝自行解決對應的依賴關係,而不是手動安裝code

相關文章
相關標籤/搜索