Package Management in CentOS and create own respository

Package management is an important task for administrators. Using this post, you will learn package management using rpm command and yum.
Packages can be delivered into two primary ways –

  • Some source code
  • pre-compiled binary files

Now we are more dependent on packages generally bundled, actually, one file wraps up with everything needed to make software to run on our system or comes with references to where the system can find what is the need.
Packages contains source code, binaries, scripts and metadata.
Some packages require other packages to work properly called dependencies and can be handled automatically by the package management software. Repositories are a huge list of packages that are downloaded and installed. Linux distros come with official repositories and you can add more if required. Package Management Software keeps track what version of packages is installed. You can remove and update the package.
Installation process follows some steps –

  1. Request to install
  2. check if already installed
  3. search for local repolist for matching packages
  4. Download required packages
  5. Follow the installation procedure (some scripts will run, some code will be compiled and files copied at the location)
  6. Some cleanup scripts can run

RPM (RPM Package Manager) originally called Red Hat Package Manager is a package management system. You require full root access privileges to perform package management tasks. RPM install and manages individual packages on CentOS, RHEL and fedora. Yum is an earlier implementation of earlier package manager yup (yellowdog updater) which was done at Duke University.
We have advantages using yum are

  • Yum manages dependencies automatically
  • yum saves work and time
  • Searching a package

you have different options to search a package like –

  • Browser the web and download the rpm file
  • Search with management software

using the browser, you can visit the website and download the rpm package according to the architecture. For example, you can download namp package from NMAP website page.

Page contains a different kind of packages for the 32bit and 64 architectures. Right now my architecture is X86_64 which is 64 bit so I download 64bit package of nmap. You can download directly copying the link in your browser.
[code]https://nmap.org/dist/nmap-7.60-1.x86_64.rpm[/code]
Another option using the browser is to open the website contains packages like rpmfind.net, for the practical purpose search nano package and download for the CentOS system.
you can directly download using the following link
[code]ftp://195.220.108.108/linux/centos/6.9/os/x86_64/Packages/nano-2.0.9-7.el6.x86_64.rpm[/code]

SEARCH PACKAGE USING YUM

DOWNLOAD A PACKAGE
You can download the package using wget on the command line. you can also download package using yum instead of install.

after download, you can find the package at

or you can use locate command to find uuid package.

if locate command is giving some error, then execute the following command to update the database

FINDING PACKAGE INFORMATION
If you need more information about the package like name, architecture, version and description of package. use

 

CHECK THE FILES UNDER RPM FILE

FIND THE FILES OF INSTALLED PACKAGE

CHECK FILES WITH SCRIPTS (Generally, runs after install and remove the package)

EXPLORE PACKAGE DEPENDENCIES

INSTALL A PACKAGE
You can install a downloaded package using yum and rpm command or you can directly install package from repository using yum command.

CHECK WHAT HAS INSTALLED

You can check that what package / packages are installed on your linux system.

Output show that package is available for the installation not installed. Also you can get the complete list of installed packages.

You will notice that package names have different color which is following –

  • Normal text – Installed version matches with repo verson
  • Bold – Installed is older than repo version
  • yellow Bold- Installed is newer than repo
  • Red Bold – Installed package is not found in repo
  • Blu Bold – Upgrade is abvailable in repo
  • Cyan color – Downgrade is available in repo
  • Green Bold – Repo verson matches installed version.

INSTALLING GROUP OF PACKAGES
Instead of installing multiple packages one by one, you can install package groups which are like roles. Find the group and install the group. It will install all the required packages according to the role.

 

You got the list of all the installed and available groups. If you want to get information about the group

Installed group like a role.

REMOVING PACKAGES USING YUM AND RPM
You can remove the installed package using yum and rpm command.

UPGRADING A PACKAGE
Installation a package is not the end. New features and security updates are often made available.
Check update for installed packages

HOLD BACK A PACKAGE
Exclude a package from upgrade

 

1 comment to Package Management in CentOS

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">