How to add a CentOS repo, having URL of Packages

Yum utils is a package which provides yum-config-manager. A quick and easy way to add a repo without the hassle writing a repo file and enabling is to use this as a sudo user

yum-config-manager --add-repo=http://vault.centos.org/centos/7.4.1708/extras/x86_64/

This will create the file and enable it for you.

P.S. Guide to install yum-utils if you don't have it already. It's part of the base CentOS repo. Usually on most yum systems, yum-utils is a must have!


I had to add a new repo file: e.g. /etc/yum.repos.d/myrepo.repo with repo configuration:

[myrepo]
name=My extras packages for CentOS 7.4.1708
baseurl=http://mirror.centos.org/centos/7.4.1708/extras/x86_64/
enabled=1

Then, to install for example docker-1.12.6-55.gitc4618fb.el7.centos run:

$ sudo yum install -y docker-1.12.6-55.gitc4618fb.el7.centos        

Options --disablerepo=* with --enablerepo=myrepo can be used to enforce only the new repo file to be considered.

--- UPDATE ---

Package version 7.4.1708 doesn't exist anymore in mirror.centos.org. You should rather use: baseurl=http://vault.centos.org/centos/7.4.1708/extras/x86_64/