Article Title: Use createrepo to create your own yum source. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Why use rpm to manage software packages? Compared with the shell script, the method of compiling and installing the source code removes the efficiency factor caused by the scale. the maintainability of the script is worse than that of rpm, of course, using rpm requires an in-depth understanding of rpmbuild and spec documents, which does not seem simple. However, in the long run, the maintainability of rpm and yum sources is more reliable than that of "scripts. In this article, the flowers bloom shared the operation steps for creating a yum source, used to manage "customized" software packages on the system. The following is the text.
Creating a yum source requires an ftp or http service. In view of the annoying firewall policy of ftp (improper firewall configuration and ftp MODE-improper active/initial use, services become unavailable ), we recommend that you use the http service.
To manage the yum source, you need a tool createrepo, which is installed using yum:
Yum-y install createrepo and then you can start:
1. Plan and create the yum source directory.
For example, create a yum directory under the root directory of the http://www.bsdmap.com to save the yum source data.
Observe the directory planning of the official yum source. For example, yum cannot maintain arch by itself, that is, it cannot distinguish i386 from x86_64 by itself, so it is placed in different directories separately.
I maintain a CentOS Linux 5-based package. The planned directory is as follows:
$ Mkdir-p yum/centos/5/{i386, x86_64} 2. initialize repodata information:
$ Createrepo-p-d-o yum/centos/5/i386 yum/centos/5/i386
$ Createrepo-p-d-o yum/centos/5/x86_64 yum/centos/5/x86_64 at this time, A repodata directory is displayed in the yum/centos/5/i386 and yum/centos/5/x86_64 directories. This is the Meta data of the yum source, yum can perform "Data Information" with this "Source.
Of course, this source is empty at this time, and no package can be installed. The following describes how to provide the installation package in the yum source.
3. Configure the local yum to use the self-built yum source.
Simply put, create a configuration file in the local/etc/yum. repos. d directory (you can also add the configuration statement to an existing file. Repo is a file name suffix, such as bsdmap. repo, And the content is roughly as follows:
[Bsdmap-yum]
Name = bsdmap-yum
Baseurl = http://www.bsdmap.com/yum/centos/?releasever/?basearch/
Enabled = 1
Gpgcheck = 0
Gpgkey = explanation:
[…] The name of the database. It must be unique and cannot be repeated.
Name = is the description of this database. It does not have much practical significance. It is just a field description.
Baseurl = specifies the transmission mode and path. The available methods include file: //, ftp: //, http: //, etc. For baseurl variables, you can view yum. conf Manual: man yum. conf, which is described in detail in the last section of the manual.
Enabled = 1 indicates that this update library is enabled. 0 indicates that this update library is not enabled.
Gpgcheck = 1 indicates that the gpg file is used to check the package signature.
Gpgkey = indicates the location where the gpg file is stored. The location can also be http.
Then, when we use yum repolist, we can see the bsdmap-yum source.