本地局域網yum源搭建-centos/redhat


 

環境-centos6.7  【本機yum搭建提前備好,不做介紹】

[root@nagios ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)

本地yum源的搭建一般有兩種形式,http和ftp,這里我們選擇使用http方式搭建

[root@nagios ~]# yum install -y createrepo httpd

[root@nagios ~]# mkdir -p /yum/centos6.7/Packages

拷貝iso鏡像中所有rpm包到yum源目錄

[root@nagios ~]# cp -a /media/Packages/* /yum/centos6.7/Packages

然后生產創建倉庫

[root@nagios ~]# createrepo /yum/centos6.7
Spawning worker 0 with 3204 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

[root@nagios ~]# ls /yum/centos6.7/
Packages  repodata  TRANS.TBL

啟動httpd服務並加入開機啟動

[root@nagios ~]# service httpd start | chkconfig httpd on

修改http網站根目錄

DocumentRoot "/yum"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
 Order Deny,Allow
 Allow from all
</Directory>

以及

  # This should be changed to whatever you set DocumentRoot to.
  #
<Directory "/yum">

 本地http方式查看

 

至此搭建完成,可以將各種需要的rpm包統統放進此配置目錄

其他主機yum源配置將路徑修改為http://ip/centos6.7/即可

 

eg:客戶端上yum源配置如下


[2.11] name=centos baseurl=http://192.168.2.11/centos6.7/ enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM