Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Red Hat Enterprise Linux 9 Essentials Book now available.

Purchase a copy of Red Hat Enterprise Linux 9 (RHEL 9) Essentials

Red Hat Enterprise Linux 9 Essentials Print and eBook (PDF) editions contain 34 chapters and 298 pages

Preview Book

1.3.2. Setting [repository] Options

You can define individual Yum repositories by adding [repository] sections (where repository is a unique repository ID, such as [my_personal_repo]) to /etc/yum.conf or to .repo files in the /etc/yum.repos.d/directory. All .repo files in /etc/yum.repos.d/are read by yum; best practice is to define your repositories here instead of in /etc/yum.conf. You can create new, custom .repo files in this directory, add [repository] sections to those files, and the next time you run a yum command, it will take all newly-added repositories into account.
Here is a (bare-minimum) example of the form a .repo file should take:
[repository_ID]
name=A Repository Name
baseurl=https://path/to/repo or ftp://path/to/repo or file://path/to/local/repo
Every [repository] section must contain the following minimum parts:
[repository_ID]
The repository ID is a unique, one-word (no spaces; underscores are allowed) string of characters (enclosed by brackets) that serves as a repository identifier.
name=<My Repository Name>
This is a human-readable string describing the repository.
baseurl=https://path/to/repo, ftp://path/to/repo, file://path/to/local/repo
This is a URL to the directory where the repodata directory of a repository is located. Usually this URL is an HTTP link, such as:
baseurl=https://path/to/repo/releases/$releasever/server/$basearch/os/
Yum always expands the $releasever, $arch and $basearch variables in URLs. See the following section for explanations of all Yum variables: Section 1.3.3, “Using Yum Variables”.
  • If the repository is available over FTP, use: ftp://path/to/repo
  • If the repository is local to the machine, use file://path/to/local/repo
  • If a specific online repository requires basic HTTP authentication, you can specify your username and password in the https://path/to/repo by prepending it as username:password@link. For example, if a repository on https://www.example.com/repo/ requires a username of "user" and a password of "password", then the baseurl link could be specified as:
    baseurl=https://user:password@www.example.com/repo/
    
The following is another useful [repository] directive:
enabled=<value>
...where <value> is one of:
0 — do not include this repository as a package source when performing updates and installs. This is an easy way of quickly turning repositories on and off, which is useful when you desire a single package from a repository that you do not want to enable for updates or installs.
1 — include this repository as a package source.
Turning repositories on and off can also be performed quickly by passing either the --enablerepo=<repo_name> or --disablerepo=<repo_name> option to yum, or easily through PackageKit's Add/Remove Software window.
Many more [repository] options exist. Refer to the [repository] OPTIONS section of man yum.conf for the exhaustive list and descriptions for each.

 
 
  Published under the terms of the Creative Commons License Design by Interspire