How to add a CentOS repo, having URL of Packages

80,650

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!

Share:
80,650

Related videos on Youtube

forzagreen
Author by

forzagreen

Data Engineer

Updated on September 18, 2022

Comments

  • forzagreen
    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
      Ignacio Vazquez-Abrams almost 6 years
      That repo is already in the base set of repos for CentOS 7.
    • Ignacio Vazquez-Abrams
      Ignacio Vazquez-Abrams almost 6 years
      Why do you want to pin the repo to a specific version?
    • forzagreen
      forzagreen almost 6 years
      I want a specific package version that exists only in this repo version.
    • Ignacio Vazquez-Abrams
      Ignacio Vazquez-Abrams almost 6 years
      Force the releasever and then pin the package.
    • forzagreen
      forzagreen almost 6 years
      @IgnacioVazquez-Abrams can you give an example please ?
    • mattdm
      mattdm almost 6 years
      That's an entirely different question than the one in the question title or body.
  • mattdm
    mattdm almost 6 years
    Since this is an official repository, that seems unnecessary.
  • vonbrand
    vonbrand almost 6 years
    The question was about unofficial repositories...
  • pacoverflow
    pacoverflow over 5 years
    I 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.