Use a self-made repo source on centos to install the specified version of rpm package

Source: Internet
Author: User

Use a self-made repo source on centos to install the specified version of rpm package

To achieve unified planning and management, we generally expect to use the same software version on each server to deploy services. Directly use a common image source (such as Alibaba and 163) and install the latest version of the software package. This will lead to different installed versions due to the upgrade of the software package. For example, for Docker installation, because the docker community is very active and the version update is very fast, the installation versions of docker in the test environment are available from 1.6 to 1.10.

To avoid the above problems, we will take installing docker on centos7 as an example to create a repo source.
1. Get the rpm package
Set/etc/yum. in the conf configuration file, after the value of keepcache is set to 1, the installed rpm package is saved to the specified local directory (/var/cache/yum/x86_64/7 /), we can use these downloaded rpm packages as the yum software source.

2 self-made repo
The createrepo tool must be installed for self-made repo:

yum install createrepo

Then, go to the directory with the rpm package, and run the createrepo command:

cd /tmp/install_docker_1.10.3_centos7createrepo .

After execution, a repodata directory is generated under the directory. The directory structure is roughly as follows: to obtain the yum source through url, you can put the source directory created under ftp, then, specify the ftp url in the repo file:

[install_docker_1.10.3_centos7]name=install_docker_1.10.3_centos7baseurl=ftp://ftp_server_ip/install_docker_1.10.3_centos7/enabled=1gpgcheck=0

3. Set the repo priority. Put the self-made repo file under/etc/yum. repos. d. However, when other repo sources coexist, you need to set the priority to prioritize self-made repo.

To set the priority, you need to install the yum plug-in:

yum install yum-plugin-priorities

Then, set in the repo file:

Priority = N // N is an integer from 99 to 1. The smaller the value, the higher the priority.

Set priority = 1 in the self-made repo file. If the value of priority is set to greater than 1 in other repo files, the self-made repo source will be used preferentially during installation.

[install_docker_1.10.3_centos7]name=install_docker_1.10.3_centos7baseurl=ftp://ftp_server_ip/install_docker_1.10.3_centos7/enabled=1gpgcheck=0priority=1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.