How to add a CentOS repo, having URL of Packages
Solution 1
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/
Solution 2
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!
Related videos on Youtube
Comments
-
forzagreen over 1 year
In Centos 7, I want to install some packages that I see in the following URL:
http://mirror.centos.org/centos/7.4.1708/extras/x86_64/Packages/
How can I add this URL to my
yum
package manager ?PS: downloading a single rpm file doesn't work, because it looks recursively for dependencies with the same version.
-
Ignacio Vazquez-Abrams almost 6 yearsThat repo is already in the base set of repos for CentOS 7.
-
Ignacio Vazquez-Abrams almost 6 yearsWhy do you want to pin the repo to a specific version?
-
forzagreen almost 6 yearsI want a specific package version that exists only in this repo version.
-
Ignacio Vazquez-Abrams almost 6 yearsForce the releasever and then pin the package.
-
forzagreen almost 6 years@IgnacioVazquez-Abrams can you give an example please ?
-
mattdm almost 6 yearsThat's an entirely different question than the one in the question title or body.
-
-
mattdm almost 6 yearsSince this is an official repository, that seems unnecessary.
-
vonbrand almost 6 yearsThe question was about unofficial repositories...
-
pacoverflow over 5 yearsI was trying to install lftp. I found that the name of the repo file in /etc/yum.repos.d and the name within brackets in the file does not matter. Then all I needed to install lftp was to run
sudo yum install lftp
.