centos 建立本地yum源搭建本地yum倉庫 親測可用

來源:互聯網
上載者:User

標籤:yum 倉庫 源 centos

  現在如果我們需要大規模部署洗個系統,或者系統需要安裝一個什麼軟體如nginx之類的軟體。有的時候你的環境限制你上外網,或者是外網很慢的時候。我們考慮搭建本地yum倉庫,內網機器可以直接快速安裝所需的軟體,解決linux下面的包的依賴,方便,快捷。

  下面我們來搭建一下根底yum倉庫:

系統:centos6.5

搭建yum倉庫有很多種方法,我們這裡使用yum外掛程式yum-downloadonly外掛程式來下載我們所需的rpm包。使用createrepo來建立倉庫檔案。

開始:

我們需要安裝zabbix監控,nignx web伺服器,但是我們的本地的yum沒有zabbix,nignx 的包。我們安裝呢。找一台可一上網的機器:

yum install -y yum-plugin-downloadonly createrepo

建立倉庫地址我們這裡使用/data/mirrors作為倉庫目錄。

mkdir -p /data/mirrors/centos/6/{os,updates}/i386/RPMS

mkdir -p /data/mirrors/centos/6/{os,updates}/x86_64/RPMS

之後就可以下載rpm包到制定目錄:

yum install nginx zabbix-server -y --downloadonly --downloaddir= /data/mirrors/centos/6/os/x86_64/RPMS

cp /data/mirrors/centos/6/os/x86_64/RPMS/*.rpm /data/mirrors/centos/6/updates/x86_64/RPMS

建立倉庫檔案:

createrepo /data/mirrors/centos/6/os/x86_64/RPMS/

createrepo /data/mirrors/centos/6/updates/x86_64/RPMS/

使用nignx對外提供web伺服器:

yum install -y nginx


vi /etc/nginx/conf.d/mirros.conf

server {

listen 80;

server_name CentOS6.dengchao.com;###你機器的網域名稱映射

root /data/mirrors;

index index.html;

}

建立repo檔案:

vi mirrors.repo

[mbase]

name=CentOS-6 -Base

baseurl=http://CentOS6.dengchao.com/centos/6/os/x86_64/

enabled=1

gpgcheck=0


#released updates 

[mupdates]

name=CentOS-6 - Updates

baseurl=http://CentOS6.dengchao.com/centos/6/updates/x86_64/

enabled=1

gpgcheck=0

cp mirrors.repo  /etc/yum.repos.d/

 到此我們的yum源搭建完成。

只要內網可以跟這台機器相通,直接使用mirrors.repo放到/etc/yum.repos.d/,就可以開始安裝nginx以及你想安裝的任何軟體了


本文出自 “nginx安裝最佳化” 部落格,謝絕轉載!

centos 建立本地yum源搭建本地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.