淺談:配置本地yum源(centos)

來源:互聯網
上載者:User

刪除YUM的所有配置資訊
[root@server yum.repos.d]#rm -rf *


現在手動設定:
1.在根目錄下建立檔案夾centos-yum;
[root@server /]#mkdir centos-yum
2.將掛載盤中的Packages包拷貝到centos-yum檔案夾中;
[root@server yum.repos.d]#cp -rv /media/CentOS_6,3_Final/Packages/* /centos-yum
3.通過rpm命令手動安裝createrepo軟體
[root@server centos-yum]#rpm -ivh createrepo-0.9.8-5.el6,noarch.rpm deltarpm-3.5-o.5.20090913git.el6.i686.rpm python-deltarpm-3.5-0.5.2.20090913git.el6.i686.rpm
4.建立索引
[root@server centos-yum]#createrepo /centos-yum
[root@server centos-yum]#ls -ld repodata
[root@server centos-yum]#filelists.xml.gz other.xml.gz primary.xm.gz repomd.xml(索引檔案夾下的檔案不要動)

如果有分組資訊,則在運行命令的時候使用-g參數指定分組檔案
createrepo -g /tmp/*comps.xml /rpm-directory
CentOS/RHELd分組資訊儲存在光碟片repodata目錄下,檔案名稱以comps.xml結尾的xml檔案


5.配置YUM
[root@server ~]#cd /etc/yum.repos.d
[root@server yum.repos.d]#vim yum.repo

[test-yum]
name=centos-test-yum
baseurl=file:///centos-yum
enabled=1
gpgcheck=0 (本地可以不用校正)


[root@server yum.repos.d]#yum clean all (每次運行安裝或查詢類命令會重建YUM緩衝,清理緩衝)
[root@server yum.repos.d]#yum list | wc -l (測試查看本地YUM庫中有多少rpm包)

 

 

END

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.