FreeKB - Linux Files yum repos
Linux Files - yum repos

The /etc/yum.repos.d/ directory should contain one or more repository files, like this:

  • CentOS-Base.repo
  • CentOS-Media.repo
  • CentOS-Vault.repo 

Each repo files will contain the title of the repo in brackets, the name of the repo, the mirror or base URL of the repo., and 1 for enabled or 0 for not enabled. For example, near the beginning of the CentOS-Base.repo is the following markup.

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/distro/$releasever/server/$basearch/os/
enabled=1

 

Notice there are variables in the .repo file, such as $releasever and $arch and $basearch and $infra. The following command can be used to determine the value associated with each variable.

python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'

{'arch': 'ia32e',
 'basearch': 'x86_64',
 'releasever': '7',
 'infra': 'stock'}

 

Navigating to the mirror or base URL will produce a list of URLs, and each of these URLs will contains packages that can be downloaded and installed using yum.

 

For example, let's say you want to install the httpd web server. When using yum to install httpd, the yum command will use the mirror or base URL to get the list of repositories that can be used, and if one of the repositories contains the httpd package, then yum will be able to install the httpd package.

 

The yum repolist all command can be used to list the status of your repos.

~]# yum repolist all
repo id
!base/7/x86_86       CentOS-7.0.1406    enabled
!epel/x86_64         CentOS-7.0.1406    enabled
!updates/7/x86_64    CentOS-7.0.1406    enabled
base-source/7        CentOS-7.0.1406    disabled

 

Repos can be permanently enabled using the --enable option, or permanently disabled using the --disable option.

~]# yum-config-manager --enable epel

 

Repos can temporarily be enabled using --enablerepo, or temporarily disabled using --disablerepo.

~]# yum --enablerepo=epel install package_name

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 9b324 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |