Package management commands

yum: Check and update all the packages:

  • yum check-update
  • yum list updates
  • yum update      (Update but preserve obsolete packages, safer option)
  • yum upgrade    (Update plus forcefully remove obsolete packages)

yum: Install or update, list and get details of a package:

  • yum install|update|remove|erase  pckg   (erase removes pckg and its config files)
  • yum localinstall  httpd-tools.rpm                     (Install rpm package from filesystem)
  • yum info lvm2*     (List a description and summary info about available package)
  • yum search [all] lvm2       (Search a package based on description)
  • yum provides lvcreate|*/logrotate.conf    (Find package based on a cmd or config file)
  • yum deplist httpd
  • yum verify pckg
  • yum history [info 3] [undo 3]    (Show history of installed or removed packages)
  • repoquery -qil pckg                    (List contents of the package)

yum: List available or installed packages:

  • yum list  all|installed|updates|available  [lvm2*]
  • yum list installed “kernel*”
  • yum list “kernel*”
  • yum verify-all

yum: Group of packages:

  • yum grouplist
  • yum groupinfo “GNOME Desktop”
  • yum groupinstall “GNOME Desktop”
  • yum groupremove “”GNOME Desktop”
  • yum langavailable|langlist | langinstall code   (Installs Language Pack)

yum: Repository list and Config files

  • yum install epel-release          (Installs or enable EPEL repo)
  • yum repolist
  • yum-config-manager –add-repo=http://repo.com [–enable|–disable]
  • reposync -p /var/www/html/repo  -r <repoid> -l
  • createrepo /var/www/html/repo
  • /etc/yum.conf
  • /etc/yum.repos.d/

Install well-known services:

  • yum update        (Recommended to update systems, before service installation)
  • yum install   telnet-server  telnet     (Installs telnet server and client)
  • yum install   httpd              (Installs Apache server)
  • yum install   vsftpd  ftp     (Installs FTP server)
  • yum install   nfs-utils         (Installs NFS server)
  • yum install   samba-client  samba-common  cifs-utils   (Installs Samba)
  • yum install   postfix  dovecot        (Installs Postfix agent and Dovecot mail server)
  • yum install   squid  squidGuard   (Installs Squid proxy server)
  • yum install   mariadb  mariadb-server  (Installs MariaDB server)

rpm: Install, Upgrade and Remove a package:

  • rpm -ivh httpd-2.4.6-45.el7.centos.4.x86_64    (Install a package)
  • rpm -Uvh httpd-2.4.6-45.el7.centos.4.x86_64   (Upgrade a package)
  • rpm -e httpd                                                           (Remove a package)

rpm: Query and List package files:

  • rpm -qa | grep httpd*              (Query all installed packages)
  • rpm -qil httpd                             (Query, info and list files in a installed package)
  • rpm -qc httpd                             (Query only package config files)
  • rpm -qd httpd                             (Query package docs)
  • rpm -qf /etc/logrotate.conf       (Query an installed package based on a config file)
  • rpm -q httpd –scripts               (List scripts that may run before or after pkg install)
  • rpm -q httpd  –changelog        (Query package change log)

rpm: Verify packages:

  • rpm -Va                                        (Verify all installed packages)
  • rpm -V httpd

rpm: List and extract the files inside a package:

  • rpm2cpio httpd.rpm | cpio -t        (List contents of a package)
  • rpm2cpio httpd.rpm | cpio -ivd   (Extract contents of a package)

rpm: Naming format and convention of RPM package:

  • <name>-<version>-<release>.<distro>.<architecture>.rpm
  • sed-4.2.1-10.e16.x86_64.rpm
Advertisements

About Ishtiaque

I am IBM Certified Infrastructure Systems Architect, Linux Foundation Certified System Administrator, Oracle Certified Programmer in Java and Web Component Developer, and TOGAF 9 certified with over 10 years of support and development experience in IBM middleware software and Java. Additionally, have a sound grip in databases and OpenStack administration. I hold the following certifications: IBM Certified Infrastructure Systems Architect Linux Foundation Certified System Administrator (LFCS) TOGAF 9 Certified Oracle Certified Expert, Java EE6 Web Component Developer Oracle Certified Professional – Java 6 Programmer ITIL v3 Foundation Certified IBM Certified Solution Architect – Cloud Computing Infrastructure V1 IBM Certified System Administrator – WebSphere Portal V8, V7, V6.1, V6 IBM Certified System Administrator – WebSphere Application Server V7, V6.1 IBM Certified System Administrator – AIX V7 IBM Certified System Administrator – WebSphere MQ V7 IBM Certified Deployment Professional – Business Process Manager Advanced V7.5 IBM Certified Solution Advisor – Cloud Computing Architecture V3 IBM Certified Solution Developer – WebSphere Portal V5.1
This entry was posted in LFCE, LFCS, Linux and tagged , . Bookmark the permalink.