Yum (Yellow Dog Updater, modified) is a software package manager similar to APT, used in Linux ora, RedHat, Suse, centos, and other Linux releases.
The Software Package Manager can solve the dependency management problem of rpm, making it easier to install and upgrade the software.
Yum uses the repository (central repository) as the most software source and management software package. Each Linux system connects to this source through the yum configuration to obtain the software package.
Table of contents
- 1 reason
- 2. Planning
- 3. Erection
- 4. Use
1 Reason
Although many free images provide Yum source services, it is necessary to establish your own Yum server, mainly for the following considerations:
- Network speed: access to the Internet may be slow
- Bandwidth saving: if a large number of servers exist, setting up your own Yum source can effectively save Internet bandwidth.
- Network restrictions: Some Intranet servers cannot connect to the Internet.
- For RHEL (Redhat Enterprise Linux), you need to purchase services
- Easy to publish self-developed RPM packages
2 Planning
The company's server operating systems are mainly RHEL and centos, so we hope to provide Yum sources for these operating systems at the same time.
Because the RHEL service is not purchased, the RHEL source uses files in the DVD to build a "static" source.
Centos can synchronize with a released source to maintain updates. Officially recognized image service can be in http://www.centos.org/modules/tinycontent/index.php? Id = 32: Search for images that are faster and support rsync, but I found a domestic image not in this list: mirrors.ustc.edu.cn/centos/. This image supports rsync and can be synchronously updated.
Plan the yum source as follows: http://dev.mycompony.com/mirrors/ centos/centos source with the same directory structure as other mirror sites
RHEL/RHEL source 6 server/5 erver/OS/x8664/# mount the RHEL DVD's ISO disc file to this directory updates/x8664/# synchronize custom/x8664/From the ftp://ftp.redhat.com/redhat/linux/updates/rhn/5Server/x86_64/ using the Export DIR/ # self-developed internal use packages/# package RPM file repodata/# RPM-GPG-KEY-redhat-5Server RPM-GPG-KEY-redhat-6Server CentOS-mycompany.repo RHEL-mycompany.repo with the index file generated by createrepo
3 Erection
Yum sources can use HTTP or FTP to provide services. nginx is used as webserver to provide HTTP access.
1. Create the planned directory structure in/path/to/Your/mirrors.
- For centos, run the following command:
Rsync-AVRT rsync: // mirrors.ustc.edu.cn/centos/-exclude = debug/-exclude = i386/-exclude = ISOs // path/to/Your/mirrors/centos
Synchronization can be implemented. You can also add this command to crontab. The period I set is daily synchronization.
- For RHEL, there are several parts:
1) A basic software package is provided with a DVD image file. You only need to mount the rhel dvd iso file to the corresponding directory, you can copy the RPM-GPG-KEY file to the/path/to/Your/mirrors/RHEL directory and name it by version.
2) You can also create an image for the updates provided by RHN. Because redhat.com does not provide the rsync service, you need to use the synchronized dir for synchronization:
Export dir ftp://ftp.redhat.com/redhat/linux/updates/rhn/5Server/x86_64//var/files/mirrors/RHEL/5 Server/updates/x86_64
If you have not installed the export Dir, you can download from the http://genotec.linux.tucows.com/files/mirrordir-0.10.49.tar.gz. This command can also be added to the scheduled task of crontab to implement regular synchronization.3) If you have a software package developed internally, you can create a custom folder, place the published RPM to the packages directory, and run the following command:
CDPath/to/Your/mirrors/RHEL/5 Server/custom/x8664 createrepo-o. Packages
Create an index file
4 Use
For ease of use, you only need to put the prepared repo file in the/etc/yum. Repos. d/directory and then execute Yum update. Here the CentOS-mycompany.repo and RHEL-mycompany.repo are created in the/path/to/Your/mirrors directory for centos and RHEL, respectively.
You can use variables in the repo file to improve universality. Common variables include:
$ Releasever: Release Version
$ Arch, CPU system (the Division is too detailed, generally not used in repo files, but the following $ basearch is used)
$ Basearch: Basic CPU system group
My two repo files are referenced as follows:
RHEL-mycompany.repo:
[Base] Name = RHEL-mycompany-basebaseurl = Http://dev.mycompany.com/mirrors/rhel/?releasever/ OS /?basearch/ Enabled = 1 Gpgcheck = 1 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-redhat-$Releasever [updates] Name = RHEL-mycompany-updatebaseurl = Http://dev.mycompany.com/mirrors/rhel/?releasever/updates/?basearch/ Enabled = 1 Gpgcheck = 1 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-redhat-$ Releasever [extras] Name = RHEL-mycompany-extrabaseurl = Http://dev.mycompany.com/mirrors/rhel/?releasever/extras/?basearch/ Enabled = 1 Gpgcheck = 1 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-redhat-$ Releasever [custom] Name = RHEL-mycompany-custombaseurl = Http://dev.mycompany.com/mirrors/rhel/?releasever/custom/?basearch/ Enabled = 1 Gpgcheck = 1 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-redhat-#releasever
CentOS-mycompany.repo:
[Base] Name = Centos-mycompany-basebaseurl = Http://dev.mycompany.com/mirrors/centos/?releasever/ OS /?basearch/ Gpgchecksever = 1Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-centos-$ Releasever # Released updates [update] Name = Centos-mycompany-updatesbaseurl = Http://dev.mycompany.com/mirrors/centos/?releasever/updates/?basearch/ Gpgcheck = 1 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-centos-$ Releasever # Additional packages that may be useful [extras] Name = Centos-mycompany-extrasbaseurl = Http://dev.mycompany.com/mirrors/centos/?releasever/extras/?basearch/ Gpgcheck = 1 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-centos-$ Releasever # Additional packages that extend functionality of existing packages [centosplus] Name = Centos-mycompany-plusbaseurl = Http://dev.mycompany.com/mirrors/centos/?releasever/centosplus/?basearch/ Gpgcheck = 1 Enabled = 0 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-centos-$Releasever # Contrib-packages by centos users [contrib] Name = Centos-mycompany-contribbaseurl = Http://dev.mycompany.com/mirrors/centos/?releasever/contrib/?basearch/ Gpgcheck = 1 Enabled = 0 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-centos-$ Releasever # Packages of mycompany [custom] Name = Centos-mycompany-custombaseurl = Http://dev.mycompany.com/mirrors/centos/?releasever/custom/?basearch/Gpgcheck = 1 Enabled = 0 Gpgkey = Http://dev.mycompany.com/mirrors/centos/rpm-gpg-key-centos-#releasever
Author: Holbrook Wong <wanghaikuo@gmail.com>
Date: 2012-08-17 15:17:22 CST
HTML generated by org-mode 6.33x in Emacs 23