AllTechWiki



A Place for All Technical Stuff Linux Cloud etc

RPM and YUM command sheet for RHEL 6 and RHEL 7

Below are the list of commands which we use on daily basis for troubleshooting in RHEL 6/7 and SUSE 12/15.


All rpm commands can be used in RHEL 6,RHEL 7 , RHEL 8 and RHEL 9 and also we can use it in SUSE 12 and SUSE 15 as well.


Command

Description

RHEL OS

SUSE OS

1

rpm -qa

List All installed packages.

RHEL6/7/8/9

SUSE12/15

2

rpm -qa --last

List All installed packages sorted by installation date.

RHEL6/7/8/9

SUSE12/15

3

rpm -q package_name

Check if a specific package is installed.

RHEL6/7/8/9

SUSE12/15

4

rpm -qi package_name

Get detailed information about an installed package.

RHEL6/7/8/9

SUSE12/15

5

rpm -ql package_name

shows list of all files installed by a package.

RHEL6/7/8/9

SUSE12/15

6

rpm -qf /path/to/file

Find which package owns a specific file.

RHEL6/7/8/9

SUSE12/15

7

rpm -V package_name

Verify the integrity of a specific package (checks for changes or missing files).

RHEL6/7/8/9

SUSE12/15

8

rpm -qR package_name

List dependencies of a package.

RHEL6/7/8/9

SUSE12/15

9

rpm -Va

Verify all installed packages.

RHEL6/7/8/9

SUSE12/15

10

rpm --checksig package_file.rpm

Verify the signature of an RPM file.

RHEL6/7/8/9

SUSE12/15

11

rpm --setperms package_name

Resets the file permissions and ownership of all files in the installed packages to the values defined in the RPM database.

RHEL6/7/8/9

SUSE12/15

12

rpm --setugids package_name

Resets the user and group ownership of files to the values defined in the RPM package metadata.

RHEL6/7/8/9

SUSE12/15

13

rpm --restore package_name

Restores all file attributes, including permissions, ownership, and SELinux contexts if applicable.

RHEL6/7/8/9

SUSE12/15

14

rpm --restore --all

Restores all file attributes, including permissions, ownership, and SELinux contexts if applicable.

RHEL6/7/8/9

SUSE12/15

15

rpm --rebuilddb

Rebuild the RPM database (useful if it is corrupted).

RHEL6/7/8/9

SUSE12/15

16

yum install package_name

Install a package along with dependencies

RHEL6/7


17

yum update package_name

Update a specific package.

RHEL6/7


18

yum remove package_name

Remove a package.

RHEL6/7


19

yum update

Update  All package or complete patching

RHEL6/7


20

yum list available

To check for available software (not installed)

RHEL6/7


21

yum list installed

To check for software/package being already installed

RHEL6/7


22

yum list all

To check for all software (available and installed)

RHEL6/7


23

yum list package_name

Search for packages whether it is installed or available

RHEL6/7


24

yum search keyword

Search for a package by name or description.

RHEL6/7


25

yum -v search keyword

Detailed search for a package by name or description.

RHEL6/7


26

yum check-update

List available updates for all packages.

RHEL6/7


27

yum list updates

List available updates for all packages.

RHEL6/7


28

yum info package_name

Show detailed information about a package.

RHEL6/7


29

yum history

Show transaction history of package management.

RHEL6/7


30

yum history info transaction_id

View details of a specific transaction.

RHEL6/7


31

yum history undo transaction_id

Undo a specific transaction.

RHEL6/7


32

yum deplist package_name

Check dependencies for a package.

RHEL6/7


33

yum install package_name --skip-broken

Install a package, skipping broken dependencies.

RHEL6/7


34

yum clean all

Clear all cached data used by yum

RHEL6/7


35

yum localinstall file.rpm

Install a local .rpm package with dependency resolution.

RHEL6/7


36

yum -v install package_name

Enable verbose output during installation for debugging purposes.

RHEL6/7


37

yum repolist all

To list all repositories (including disabled ones)

RHEL6/7


38

yum repolist

This will list all enabled repositories

RHEL6/7


39

yum-config-manager --disable <repo_id>

disable the repo for permanent/all sessions

RHEL6/7


40

yum-config-manager --enable <repo_id>

enable the repo for permanent/all sessions

RHEL6/7


41

yum update --disablerepo "*" --enablerepo=baseos

disable all repos and enable only baseos repo in current session -  temporarly only on logged session

RHEL6/7


42

yum update --disablerepo=baseos

disable only one repo baseos and go for update with all enabled respos- temporarly only on logged session

RHEL6/7


43

yum update -y --disablerepo='*' --enablerepo='*microsoft*'

disable all repos and enable all respos with *microsoft*

RHEL6/7


44

yum install --downloadonly --downloaddir packge-download/ nmap

download only packages in directory

RHEL6/7


45

yum --disablerepo=* localinstall *.rpm

disable all repos and local install from downloaded directory

RHEL6/7









Post a Comment

Previous Post Next Post

Basic Useful Links