Creating A Local Yum Repository (CentOS)
2012-08-08 16:11
218 查看
Sometimes it can be handy to set up your own repository to prevent from downloading the remote repository over and over again. This tutorial shows how to create a CentOS mirror for your local network. If you have to install multiple systems in your local network then all needed packages can be downloaded over the fast LAN connection, thus saving your internet bandwidth.
Create the Directories:
mkdir -pv /var/www/html/centos/4/{os,updates}/i386
Replacing 4 and i386 with your major version and architecture.
Additionally you'll need some deeper directories. This is the correct location to copy the CD/DVD rpms.
Quote:
Create the base repository headers:
createrepo /var/www/html/centos/4/os/i386/
For example: rsync://ftp.belnet.be/packages/centos/
The mirrors share a common structure for updates. Simply append /updates/<d version>/<base arch>.
Rsync to create the updates-released repository:
/usr/bin/rsync -avrt rsync://ftp.riken.jp/centos/4/updates/i386 --exclude=debug/ /var/www/html/centos/4/updates/
This will create a complete update repository at /var/www/html/centos/4/updates/i386. The repodata directory will be created with all of the headers.
You can additionally pipe this into mail to receive an email when updates are available.
Next I would advise to setup a cron job to run the rsync (above). In this manner your repository is kept updated and only new updates and headers will be downloaded to your repository.
vi /etc/yum.repos.d/CentOS-Base.repo
That's it.
转载自:http://www.howtoforge.com/creating_a_local_yum_repository_centos
Create the Directories:
mkdir -pv /var/www/html/centos/4/{os,updates}/i386
Replacing 4 and i386 with your major version and architecture.
Additionally you'll need some deeper directories. This is the correct location to copy the CD/DVD rpms.
Quote:
mkdir -pv /var/www/html/centos/4/os/i386/CentOS/RPMS/ |
The Base Repository
Copy the RPMs from the CDs/DVD to /var/www/html/centos/base.Create the base repository headers:
createrepo /var/www/html/centos/4/os/i386/
The Updates Repository
Select an rsync mirror for updates: check out this list of aviable mirrors: Centos OS Mirror list and these are identified with rsync.For example: rsync://ftp.belnet.be/packages/centos/
The mirrors share a common structure for updates. Simply append /updates/<d version>/<base arch>.
Rsync to create the updates-released repository:
/usr/bin/rsync -avrt rsync://ftp.riken.jp/centos/4/updates/i386 --exclude=debug/ /var/www/html/centos/4/updates/
This will create a complete update repository at /var/www/html/centos/4/updates/i386. The repodata directory will be created with all of the headers.
You can additionally pipe this into mail to receive an email when updates are available.
/usr/bin/rsync -avrt rsync://ftp.riken.jp/centos/4/updates/i386 --exclude=debug /var/www/html/centos/4/updates/ | /bin/mail you@example.com -s "New Repo Updates" |
Yum Configuration
Edit yum.conf:vi /etc/yum.repos.d/CentOS-Base.repo
[base] name=CentOS-$releasever - Base baseurl=http://192.168.*.*/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #released updates [update] name=CentOS-$releasever - Updates baseurl=http://192.168.*.*/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
That's it.
转载自:http://www.howtoforge.com/creating_a_local_yum_repository_centos
相关文章推荐
- Creating A Local Yum Repository (CentOS)
- Setup Local Yum Repository On CentOS 7
- Create Local YUM repository on CentOS 7 / RHEL 7 using DVD
- Setup Local Yum Repository On CentOS 7
- Creating a yum repository (repo) and Creating a yum group to install + kickstart
- 【疑难杂症】-CentOS-yum错误: Cannot retrieve repository metadata (repomd.xml) for repository:
- centos--change the repository to a local directory
- [CentOS]使用yum命令报出Error: Cannot retrieve repository metadata (repomd.xml) for repository的解决方法
- centos6.6安装mysql5.7.6(采用MySQL Yum Repository)—(先看最后一行)
- Creating a yum repository (repo) and Creating a yum group to install + kickstart
- yum错误:file://media/CentOS_5.2_Final/repodata/repomd.xml:[Error 5]......Cannot retrieve repository metadata(repomd.xml) for repos
- yum—repo—How to Enable EPEL Repository for RHEL/CentOS 7/6/5
- centos下运行yum报错:Error: Cannot retrieve metalink for repository: epel. Please verify its path
- “-bash: /usr/local/bin/npm: No such file or directory” centos7 nodejs yum安装包损坏的修复
- centos6.5 yum安装lamp后php页面显示空白
- Centos6.5使用yum安装svn
- centos 7 yum安装kubernetes cluster 1.0
- CentOS 7 YUM 安装 LNMP 环境
- 点滴记录——Centos 6.5 yum安装Ganglia
- CentOS 7 通过 yum 安装 nodejs 和 npm