環境-centos6.7 【本機yum搭建提早備好,不作介紹】ios
[root@nagios ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)sql
本地yum源的搭建通常有兩種形式,http和ftp,這裏咱們選擇使用http方式搭建centos
[root@nagios ~]# yum install -y createrepo httpdbash
[root@nagios ~]# mkdir -p /yum/centos6.7/Packageside
拷貝iso鏡像中全部rpm包到yum源目錄網站
[root@nagios ~]# cp -a /media/Packages/* /yum/centos6.7/Packagesurl
而後生產建立倉庫spa
[root@nagios ~]# createrepo /yum/centos6.7
Spawning worker 0 with 3204 pkgs
Workers Finished
Gathering worker resultsrest
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs completecode
[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