生產環境中有一次遇到兩臺服務器不能聯外網,而上傳鏡像作本地源因爲鏡像特別大致使特別浪費時間,這時另一臺服務器能夠採用http的方式實現軟件下載。
運維實戰:兩臺服務器http方式共享yum軟件倉庫運維實戰:兩臺服務器http方式共享yum軟件倉庫
ip:172.16.1.112,172.16.1.100
系統版本:Centos7html
在172.16.1.100製做本地yum源
[root@localhost ~]# mount /dev/cdrom /mnt
在/etc/yum.repos.d/ 下新建123.repo文件linux
[123]
name=123
baseurl=file:///mnt
gpgcheck=0
enabled=1
測試
[root@localhost ~]# yum install -y telnet
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解決依賴關係
...apache
依賴關係解決瀏覽器
===============================================================================================服務器
正在安裝:
telnet x86_64 1:0.17-64.el7 123 64 k架構
安裝 1 軟件包運維
總下載量:64 k
安裝大小:113 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : 1:telnet-0.17-64.el7.x86_64 1/1
驗證中 : 1:telnet-0.17-64.el7.x86_64 1/1 測試
已安裝:
telnet.x86_64 1:0.17-64.el7 ui
完畢!
[root@localhost ~]#
172.16.1.100經過apache鏡像目錄共享
[root@localhost ~]# yum install -y httpd
在/var/www/html下面建立aaa目錄,url
/var/www/html/建立aaa目錄,將鏡像拷貝到/var/www/html/aaa
[root@localhost ~]# ls /var/www/html/aaa/
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
在瀏覽器訪問
運維實戰:兩臺服務器http方式共享yum軟件倉庫運維實戰:兩臺服務器http方式共享yum軟件倉庫
在172.16.1.112配置yum
在/etc/yum.repos.d/ 目錄下建立123.repo
[123]
name=123
baseurl=http://172.16.1.100/aaa
enabled=1
gpgcheck=0
測試
[root@localhost ~]# yum install vsftpd -y
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解決依賴關係
......
總下載量:169 k
安裝大小:348 k
Downloading packages:
vsftpd-3.0.2-22.el7.x86_64.rpm | 169 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : vsftpd-3.0.2-22.el7.x86_64 1/1
驗證中 : vsftpd-3.0.2-22.el7.x86_64 1/1
已安裝:
vsftpd.x86_64 0:3.0.2-22.el7
完畢!總結這樣就經過apache實現了http方式的yum源。