16 Managing Software in Linux

Mr. Hardik Joshi

epgp books

 

 

1.  Introduction

Any computer is incomplete without an operating system and desired software to work with the system. In this module, we will focus on installation of software using different tools and techniques in Linux. We will start the study by understanding terms like package manager and dependencies. Later we will understand the concept of repositories. Finally, we will review different techniques that can be used to install and manage software in Linux OS.

  1. Selection of software during installation of OS

In previous modules, we have reviewed the GUI available with Linux OS. The installation of Linux has various steps; one of the steps includes selection of software while installing Linux. Most of the Linux installations provide a selection screen to select the preferable software that are required in our system. During the installation of OS, it prompts to select the desktop environment like GNOME, KDE, XFCE etc. and also prompts for the selection of software packages like office suite, development suite, different servers etc. The selection of software may vary according to the distribution of Linux. Figures 1 and 2 illustrates few sample screens that we may come across while installing of distributions like CentOS and Ubuntu. This is the most preferable way to install various software as it does not require internet connection and most of the existing software can be locally installed from the installation media. However, it is desirable to update the software once the OS is installed. Figures 1 and 2 demonstrate sample screens of installation of CentOS and Ubuntu OS.

 

Figure 1: Installation Screen of CentOS

Figure 2: Installation screen of Ubuntu

  1. Packages, Package Managers and Dependencies

In Linux distributions, a “package” refers to a compressed file (usually in archive format) containing all of the files that come with a particular application. Packages contain executable binaries, metadata, such as the name of software, description and its purpose, version number, vendor, checksum, and a list of dependencies necessary for the software to run properly. Files like “.rpm”, “.deb” etc. are package files that contain specific application to be installed.

Different package formats are used by different Linux distributions. So, a package intended for one distribution cannot be installed on any other line of distribution. Once the Linux OS is installed, we can selectively install different applications by downloading packages and installing them individually.

 

There are tools to locate packages and install them or manage them on Linux. Such tools are known as “package managers”. For different lines of distributions, the tools differ. Few package managers have a graphical user interface while others work using command line interface. A package manager or package management system (PMS) is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer’s operating system in a consistent manner. Furthermore, package management tools keep track of dependencies that are required, regular updates and upgrades required so that users like us do not have to locate and install updates or seek information about bug and security fixes.

Figure 3: Illustration of Package Manager

 

A dependency occurs when one package depends on other package(s), libraries and files. Sometimes when we install programs, they rely on other programs to work, these other programs are called dependencies. Without package management system, users must ensure on regular basis that all of the required dependencies for the desired software are installed and are up -to -date. User must also manage configuration and dependencies for each piece of software. Figure 4 illustrates the dependencies (libraries and binaries) required by “nmap” application.

Figure 4: Dependencies of nmap application

 

Package management systems (PMS) attempts to solve the dependencies problems and they provide set of tools and utilities through which users can maintain the overall quality and integrity of operating system. The major features that most package management applications provide are as follows:

  • Package downloading
  • Dependency resolution
  • A standard binary package format across distribution
  • Comon installation and configuration locations
  • Additional system-related configuration and functionality
  • Quality control

A repository contains collection of packages. The repositories can be created on server within an organization, can be on a local system or can be available over the Internet. Each Linux distribution has a repository provided by the vendor, apart from which, a user can configure repositories as per his choice.

Figure 5: Software installation workflow using Package Manager

 

A package management system (PMS) is configured to work with one or more repositories. It locates the required software to be installed, downloads the software and all its required dependencies from the repository and later installs and configures the software as per the requirement of the application. PMS automates the tedious task of downloading and managing software. Without the package management system, users may feel frustrated by downloading each software package, resolving its dependencies and again downloading the dependencies one by one and installing them. More tedious task is to manage updates of the software that have been installed.

  1. Software installation using Package Management System

Package management system can be classified as GUI or CLI based tools. The GUI based tools are easier to use as they provide an interface to list the packages according to alphabetical order, view the versions, size etc. in a single window. These tools provide an interface to install, remove or upgrade packages by single click of a mouse. Figure 6 illustrates a package manager known as “synaptic package manager” that is available with Ubuntu distributions.

Figure 6: Synaptic Package Manager available in Ubuntu

 

As we can see in the above figure, the tool lists the packages with details like the version that is installed, latest version that is available to be downloaded from the repository, size and brief description of the package. It provides an interface to search for the packages and mange packages. Various packages can be marked to upgrade using a single mouse click.

 

4.1 Package Management in RHEL based distributions

 

Distributions like Fedora and CentOS are derived from Red Hat Enterprise Linux (RHEL) and hence they are closely related. CentOS uses “yum” utility where “yum” is an abbreviation of “Yellowdog Updater, Modified”. Yum is wrapper command to “rpm” utility, it is a front end that interacts with system repositories and install various dependencies. It includes a low level tool called “rpm”, which allows us to manage individual packages. In fact, we can also say that yum is a wrapper to rpm. Version 22 of Fedora and its subsequent versions uses the “dnf” package manager rather than “yum” to interact with rpm. The “dnf” package manager supports most of the commands as in “yum” with some slight changes.

 

4.1.1 YUM Utility

 

Yum is a package management utility for Red Hat Enterprise Linux. As of now, yum is the default package and repository management tool for a number of operating systems that includes RedHat based distributions. We can use the following commands to interact with yum:

 

4.1.2 RPM Package Manager (RPM)

 

Package managers like “yum” and “dnf” are wrappers to a lower level tool called “rpm”. Although it is very likely that we need not interact with RPM, but few commands might be of certain help while we are dealing with dependencies. The commands that install or remove packages should be executed as a super user:

 

RPM utility does not check for dependencies while installation, so we must resolve each dependency and install them manually.

 

4.2 Package Management in Debian and Ubuntu

 

The PMS(package management system) for Debian based distribution is based on a tool called “dpkg” which uses “apt” system which is a very popular method to manage packages. Apart from Debian, few other widely used distributions of Linux are derived from the Debian system are like Ubuntu, Edubuntu, Kubuntu etc.

 

4.2.1 The “apt” command

 

In all Debian based distributions, the “apt-get” command interacts with the operating system using the advanced packaging tool. Few widely used commands to manage packages in Debian are listed in following table:

4.2.2 The “aptitude” command

 

Aptitude  is  a  wrapper  interface  for  “apt” command.  Apart  from  providing  a  GUI,aptitude utility provides a command line interface for most of the APT functionality.Few widely used commands options for the aptitude command are:install, update, remove, clean, or purge, download, search or show.

 

Aptitude tool is a front-end of advanced packaging tool (apt). Aptitude also provides a menu driven interface as well as commands to manage packages. Aptitude command also includes safe upgrading of packages, which means it does not remove existing packages, which prevents the system from upgrading specific packages.

 

4.2.3 The “dpkg” command

 

Commands like apt-get are wrapper programs that executes in front-end and provide a better interface and connections to various repositories for the package management tool called “dpkg”. It is out of scope in this module to study all functionalities provided by the command. Some important commands are listed in following table:.

 

5    Installation from Source

 

The advantage of using open source software is that we can customize the software according to our needs and use them. To customize the software, we need to modify the code, recompile it according to our hardware and install the software. Most of the open source software contains multiple files and directories that are required to compile. The collections of files are called “tarball”. The files are combined using “tar” command and often compressed using “zip” functionality.

 

A tarball is a file (usually in compressed format) that contains a set of files and/or directories of source code. The application used to create these tarballs is called tar (Tape ARchive). Tarballs have file extensions that normally indicate how the archive was compressed. Examples include tar.gz or tar.tgz for gzip and tar.bz2 or tar.tbz for bzip2 compression. The following steps are involved to install software from its source code:

 

1) Download or acquire the source code (Mostly wget command is used to download the code from web)

2) Extract the tarball (provided the source code is in compressed format)

3) Configure the source code that checks the dependencies and system state required by the software to be installed

4) Compile the source code files using “make” command.

5) Install and place the binaries appropriately using the “make install” command.(Note: the installation may require super user privileges)

 

Let us see an example where we install the “nmap” software that is used for security purpose. It is open source software widely used as a port-scanner. The following are sequence of commands that are required to be executed to download the nmap software and install in on our system:

 

1) wget https://nmap.org/dist/nmap-7.40.tar.bz2

2) tar xvjf nmap-7.40.tar.bz2

3) cd nmap-7.40

4) less INSTALL (optional – to refer the help before installation)

5) ./configure –help (optional – to display help file)

6) ./configure

7) make

8) sudo make install

9) nmap (To launch the application)

Note: Kindly check the download link to ensure that the proper version of nmap is available on the given URL of first step.

 

Keywords

 

Dependencies, packages, package manager Commands: apt-get, aptitude, make, rpm, yum

 

Summary

 

The key concepts covered in this module are:

  • Concept of packages and dependencies.
  • How repositories are helpful to locate and install packages.
  • Tools like yum and aptitude are wrappers of rpm and dpkg for Red Hat and Debian based systems.
  • Use of tarball to install from source code.
you can view video on Managing Software in Linux

    References

  1. Tom. Adelstein and Bill. Lubanovic. 2007. Linux system administration, O’Reilly.
  2. Sam R. Alapati. 2016. Modern Linux Administration How to Become a Cutting-edge Linux Administrator., Oreilly & Associates Inc.
  3. Kirk. Bauer. 2003. Automating UNIX and Linux administration, Apress.
  4. Richard Blum. 2008. Linux command line and shell scripting bible, Wiley Pub.
  5. M. Carling, Stephen. Degler, and James. Dennis. 2000. Linux system administration, New Riders.
  6. Chuck. Easttom and Serge N. Palladino. 2012. Essential Linux administration : a comprehensive guide for beginners, Course Technology/Cengage Learning.
  7. Richard Fox. Linux with operating system concepts,
  8. Aeleen. Frisch. 2002. Essential system administration, O’Reilly.
  9. Marcel. Linux system administration : a user’s guide, Addison-Wesley.
  10. Juliet. Kemp. 2009. Linux system administration recipes : a problem-solution approach, Apress.
  11. Olaf. Kirch and Terry. Dawson. 2000. Linux network administrator’s guide, O’Reilly.
  12. Olaf. Kirch and Terry. Dawson. 2000. Linux network administrator’s guide, O’Reilly.
  13. Mark (Mark F… Komarinski, Cary. Collett, and Inc. Red Hat. 2000. Red Hat Linux administration handbook, Prentice Hall PTR.
  14. Chris Negus. Linux bible,
  15. Roderick W. Smith. 2007. Linux administrator street smarts : a real world guide to Linux certification skills, John Wiley.
  16. Wale Soyinka. Linux administration : a beginner’s guide,
  17. Vicki. Stanfield and Roderick W. Smith. 2002. Linux system administration, Sybex.
  18. Nicholas. Wells. 2000. Guide to Linux installation and administration, Course Technology, Thomson Learning.
  19. Matt. Welsh, Matthias Kalle. Dalheimer, Terry. Dawson, and Lar. Kaufman. 2003. Running Linux, O’Reilly.