码迷,mamicode.com
首页 > 其他好文 > 详细

yum 源本地化

时间:2015-02-07 10:17:15      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

First of all, you need to prepare the rpm packages, we can download them with yum command, in that way, the dependencies needed by the rpm will also be downloaded.

For example, you are trying to download memcached rpm

yum install --downloadonly --downloaddir=/tmp/atomicdownload memcached

The above command will download the corresponding rpm packages into /tmp/atomicdownload directory.

 

The second step is to create the repo.

[root@localhost atomicdownload]# createrepo -p -d -o /tmp/atomicdownload /tmp/atomicdownload
Spawning worker 0 with 1 pkgs
Spawning worker 1 with 0 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

-p means pretty output

-d means database

-o means output

 

The last step is to edit the repo file.

vi /etc/yum.repos.d/CentOS-Base.repo

The file content is like below:

[base]
name=da_repo
baseurl=file:///opt/da/da_yum_repo
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

The important configuration is

baseurl  which is the url pointing to the repository

enabled=1 will set this repository active

gpgcheck=0 disable the check

 

yum 源本地化

标签:

原文地址:http://www.cnblogs.com/kramer/p/4278374.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!