生產環境中有一次遇到兩臺服務器不能聯外網,而上傳鏡像做本地源由於鏡像特別大導致特別浪費時間,這時另外一臺服務器可以採用http的方式實現軟件下載。 |
ip:172.16.1.112,172.16.1.100
系統版本:Centos7
[root@localhost ~]# mount /dev/cdrom /mnt
在/etc/yum.repos.d/ 下新建123.repo文件
[123] name=123 baseurl=file:///mnt gpgcheck=0 enabled=1
[root@localhost ~]# yum install -y telnet 已加載插件:fastestmirror Loading mirror speeds from cached hostfile 正在解決依賴關係 ... 依賴關係解決 =============================================================================================== Package 架構 版本 源 大小 =============================================================================================== 正在安裝: 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 完畢! [root@localhost ~]#
[root@localhost ~]# yum install -y httpd
在/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
在瀏覽器訪問
在/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源。