You are on page 1of 22

Chapter 04:

Managing Packages

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages Edited by Mr. Kim No
RPM Package Management

RPM (Red Hat Package Manager) is an default open
source and most popular package management utility
for Red Hat based systems like (RHEL, CentOS and
Fedora).

The tool allows system administrators and users to
install, update, uninstall, query, verify and manage
system software packages in Unix/Linux operating
systems.

The RPM formerly known as .rpm file, that includes
compiled software programs and libraries needed by
the packages. This utility only works with packages that
built on .rpm format.
By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 2
RPM Package Management
Query packages:

How to check an Installed RPM Package

Using -q option with package name, will show
whether an rpm installed or not.
# rpm -q samba

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 3


RPM Package Management
Query packages:

How to List all files of an installed RPM package

To view all the files of an installed rpm packages, use
the -ql (query list) with rpm command.
# rpm -ql <package name>

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 4


RPM Package Management
Query packages:
• How to Query a Information of Installed RPM Package
Let’s say you have installed an rpm package and want to know
the information about the package.
The following -qi (query info) option will print the available
information of the installed package.
# rpm -qi <package name>

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 6


RPM Package Management
Installing and update packages (RPM):
Offline Installation

• For installing an rpm software package, use the following


command with -i option.
• For example, to install an rpm package called
samba
# rpm -ivh <PackageName.rpm>
RPM command and options
-i : install a package
-v : verbose for a nicer display
-h: print hash marks as the package archive is unpacked.
By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 7
RPM Package Management
Installing and update packages (RPM):
Online Installation


To install a package and its dependencies:
– yum install package
#yum install httpd

To install an update for an individual package:
– yum update package

To update all packages run:
– yum update
By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 8
RPM Package Management
How to Remove a RPM Package
To un-install an RPM package, for example we
use the package name not the original package
name samba-3.6.9-151.el6.i686.rpm The -e
(erase) option is used to remove package.
# rpm -e samba
#rpm -e vsftpd

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 9


RPM Package Management

If you want to remove a package with the
rpm command, then you may need to
remove manually other packages, as well,
due to the dependencies between
packages.

To remove a package and the packages
that depend on it:
yum remove package

#yum remove vsftpd


By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 10
Managing Packages with YUM
YUM (Yellowdog Updater Modified) is an open source
command-line as well as graphical based package
management tool for RPM (RedHat Package Manager)
based Linux systems.
It allows users and system administrator to easily
install, update, remove or search software packages on
a systems.
It was developed and released by Seth Vidal under
GPL (General Public License) as an open source,
means anyone can allowed to download and access
the code to fix bugs and develop customized
packages.
By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 12
Managing Packages with YUM

Install a Package with YUM
To install a package called Firefox, just run the below
command it will automatically find and install all
required dependencies for Firefox.
#yum install firefox

Removing a Package with YUM
To remove a package completely with their all
dependencies, just run the following command as
shown below.
# yum remove firefox
By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 13
Managing Packages with YUM

Updating a Package using YUM
Let’s say you have outdated version of MySQL
package and you want to update it to the latest
stable version. Just run the following command it
will automatically resolves all dependencies issues
and install them.
#yum update mysql

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 14


Managing Packages with YUM

List a Package using YUM
Use the list function to search for the specific package
with name. For example to search for a package called
openssh, use the command.
# yum list openssh

To make your search more accurate, define package
name with their version, in case you know. For
example to search for a specific version openssh-
4.3p2 of the package, use the command.
# yum list openssh-4.3p2
By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 15
Managing Packages with YUM

Search for a Package using YUM
If you don’t remember the exact name of the package, then
use search function to search all the available packages to
match the name of the package you specified. For example, to
search all the packages that matches the word .
# yum search ftpd

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 16


Managing Packages with YUM

Get Information of a Package using YUM
Say you would like to know information of a
package before installing it. To get information of
a package just issue the below command.
# yum info firefox

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 17


Managing Packages with YUM
• Check for Available Updates using Yum

To find how many of installed packages on your system have


updates available, to check use the following command.
# yum check-update
• Update System using Yum

To keep your system up-to-date with all security and binary


package updates, run the following command. It will install all
latest patches and security updates to system.
# yum update

By Msc. Khiev Sopheaktra Chapter 04: Managing Packages 18


Scheduling with crond

 30 05 1-31/3 * * execute_this
 30 05 */3 * * execute_this
0 */2 * * * execute this
By Msc. Khiev Sopheaktra Chapter 04: Managing Packages and Process
grep

The grep command is used to search text or searches the


given file

#grep test file.txt


chmod

#chmod [ u g o a ] [file name]


End of Ch4

THANKS

24

You might also like