Linux學習一----------Linux製作本地yum源

來源:互聯網
上載者:User

標籤:linux   yum源   

剛剛開始學習,以此作為筆記記錄自己所學

一、掛載檔案

把iso檔案放到虛擬機器裡,可以選擇共用檔案或者通過串連Linux的工具上傳上去

我的上傳在/root/CentOS-6.6-x86_64-bin-DVD1.iso

建立掛載地點:mkdir  /root/iso

掛載鏡像檔案:mount -o loop /root/CentOS-6.6-x86_64-bin-DVD1.iso /root/iso/

二、修改yum設定檔來安裝createrepo

備份yum檔案 :

cd /etc/yum.repos.d/

重新命名repo結尾的檔案:rename .repo .repo.bak *

複製一個檔案來配置yum源:cp CentOS-Base.repo.bak CentOS-Local.repo

修改配置CentOS-Local.repo檔案:vim CentOS-Local.repo  內容如下

[cento6.6-dvd1]
name=CentOS-Local
baseurl=file:///root/iso
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

清空yum源:yum clean all

查看yum源:yum repolist all

利用yum安裝軟體,分別安裝httpd和createrepo:

yum install -y httpd   

yum install -y createrepo

三、把Packas包拷貝到Apache 路徑

切換路徑:cd /var/www/html

建立檔案:mkdir centos6.6

拷貝Packages:cp -r /root/iso/Packages/  /var/www/html/centos6.6/

四、啟動Apache server服務

查看httpd狀態:services httpd status

修改CentOS-Local.repo設定檔:baseurl=file:///root/iso 改為  http://192.168.146.233/centos6.6/Packages/ 

關閉防火牆:service iptables stop

啟動httpd服務:service httpd start

網頁訪問httpd啟動是否正常:http://192.168.146.233/centos6.6/Packages/

切換到Packages目錄:cd /var/www/html/centos6.6/Packages/
#開始製作repodata資料:createrepo .(注意:createrepo後面還有一個".")

清空yum源:yum clean all

查看yum源:yum repolist all

yum源有可用包那就製作完成

其他機器要使用這個yum的安裝包,只要修改/etc/yum.repos.d/裡的CentOS-Local.repo檔案的baseurl路徑指向這裡就行,這樣就不用每台機器都訪問網路了

Linux學習一----------Linux製作本地yum源

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.