Yum is the repository management tool which fetches the appropriate package for your particular version of linux.
Actionable Yum commands:-
- Yum list : list all the installed and available packages
- yum list installed : list all the installed packages
- yum list available : list all the available packages in enabled repos, ready to be installed.
- yum repolist/repoinfo : list all the enabled repos
- yum info <package_name> : list information about mentioned package
- yumd info <package_name> : Querying yum database for more detailed information.
- yum install mysql* : install all the mysql related packages
- yum provides <package_name> : will list the path where it is installed and other imp details.
- yum localinstall <package_name> : to install the package that was already downloaded
- yum remove <package_name> : to remove the package
- Package group: A package group is a collection of packages that serve a common purpose, for instance System Tools.
- yum group list <filter> : View all the available and Installed group.
- yum group info <filter> : to list all the mandatory and optional package from the group.
- yum group install <group_name> : installs the group
- yum group remove <group_name> : removes group
- Yum Transaction History: The
yum history
command enables users to review information about a timeline of yum transactions, the dates and times they occurred, the number of packages affected, whether these transactions succeeded or were aborted, and if the RPM database was changed between transactions. Additionally, this command can be used to undo or redo certain transactions. All history data is stored in the history DB in the/var/lib/yum/history/
directory. - yum history list : list last 20 transactions
- yum history list all : list all transactions
- yum history list <filter>
- yum history info <id> : Examine any transaction in more detail
- Repeating or Undoing transaction using history: Apart from reviewing the transaction history, the
yum history
command provides means to revert or repeat a selected transaction. - yum history undo <id> : it will revert the transaction mentioned by ID
- yum history redo <id> : it will repeat the transaction mentioned by ID
- Yum Configuration :
- The configuration information for yum and related utilities is located at
/etc/yum.conf
- Yum cache and database file are kept by default at : /var/cache/yum/$basearch/$releasever/
- Default yum log file : /var/log/yum.log
- Repo Configuration : All
.repo
files contain repository information (similar to the[repository]
sections of/etc/yum.conf
). Yum collects all repository information from.repo
files and the[repository]
section of the/etc/yum.conf
file to create a master list of repositories to use for transactions. Ifreposdir
is not set, yum uses the default directory/etc/yum.repos.d/
. Basic repo configuration in repo.d are as follows, name
=repository_name :Here, repository_name is a human-readable string describing the repository.baseurl
=repository_url :Replace repository_url with a URL to the directory where the repodata directory of a repository is located:enabled
=value : This is a simple way to tell yum to use or ignore a particular repository
Note: Turning repositories on and off can also be performed by passing either the--enablerepo=repo_name
or--disablerepo=repo_name
option toyum
- Yum variables: You can use and reference the following built-in variables in
yum
commands and in all yum configuration files (that is,/etc/yum.conf
and all.repo
files in the/etc/yum.repos.d/
directory): - Default/Build-in Variables:
- $releasever
- $arch
- $basearch
- Custom Variables: To define a custom variable or to override the value of an existing one, create a file with the same name as the variable (without the “
$
” sign) in the/etc/yum/vars/
directory, and add the desired value on its first line. - Adding a yum repository: To define a new repository, you can either add a
[repository]
section to the/etc/yum.conf
file, or to a.repo
file in the/etc/yum.repos.d/
directory. All files with the.repo
file extension in this directory are read by yum, and it is recommended to define your repositories here instead of in/etc/yum.conf
. - To view/modidy global configuration: $yum-config-manager
- yum-config-manager —add-repo repository_url : Yum repositories commonly provide their own
.repo
file. To add such a repository to your system and enable it. - yum-config-manager —enable repository : To enable any repository.
- yum-config-manager --enable \* : Enable all the repos
- Creating New/Local yum repos:
- Install createrepo package yum install createrepo
- Copy all packages that you want to have in your repository into one directory, such as
/mnt/local_repo/
Change to this directory and run the following command:
createrepo -—database /mnt/local_repo This creates the necessary metadata for your yum repository, as well as the sqlite database for speeding up yum operations.
NOTES-
- use backslash sign before any regex expression [ /* OR /?]
- Most, if not all, commands will need root privileges to execute.
- This blog contains the list of the yum commands that you will gonna use on day to day basis as a Linux developer, however, you will need more depth if you are Linux Admin.
No comments:
Post a Comment