1. 程式人生 > >centos7 搭建http網絡源

centos7 搭建http網絡源

生成 repos repo pre 過去 web頁面 reat web 服務器

存放yum包的服務器:172.22.10.237
測試服務器:172.22.10.234

172.22.10.237需要安裝http或者其他web工具,可以打開web頁面即可;
    yum install httpd httpd-devel -y
還需要安裝 createrepo 工具,用於創建本地源:
    yum install createrepo* -yum
    創建apache用戶和apache用戶組
例:如果將包放在 /var/www/html/centos/ 文件夾下,
    cd /var/www/html/
    createrepo centos/
    這樣會在centos文件夾裏生成一個repodata文件夾;

完成以上工作後,將yum的包上傳到centos文件夾裏,為測試效果明顯,
    可以將少量的包上傳過去,便於對比;

客戶端將 /etc/yum.repos.d/ 下的所有文件轉移備份到其他地方,
    為測試效果明顯,不受其它 .repo 文件影響;
創建 http.repo :
    [base]
    name="CentOS7 HTTP YUM"
    baseurl=http://172.22.10.237/centos/
    gpgcheck=0
    enabled=1
    [updates]
    name="CentOS7 HTTP YUM"
    baseurl=http://172.22.10.237/centos/
    gpgcheck=0
    enabled=1

清空yum緩存:    yum clean all
重啟http服務;
查看軟件源:    yum repolist (yum repolist all)
查看yum源倉庫裏面的安裝包:    yum list
    *可能需要給 http.repo 執行權限;

centos7 搭建http網絡源