A Basic Guide To Linux Packages

Linux Packages
Linux Packages.

Introduction

Whether you use a Debian based Linux distribution such as Debian, Ubuntu, Mint or SolyDX, or you use a Red Hat based Linux distribution such as Fedora or CentOS the way that applications are installed onto your computer are the same.

The physical method for installing the software might be different. For example the graphical tools in Ubuntu are the Software Centre and Synaptic whereas in Fedora there is YUM Extender and openSUSE uses Yast.

Command line tools include apt-get for Ubuntu and Debian or yum for Fedora and zypper for openSUSE.

The one thing they all have in common is the fact that the applications packaged up to make them easier to install. 

Debian based distributions utilise the .deb package format whereas Red Hat based distributions utilise rpm packages. There are many other different package types available but in general they work in a similar way.

What Are Repositories?

A software repository contains software packages.

When you search via the Software Centre or use a tool like apt-get or yum you are shown a list of all the packages within the repositories available to your system.

A software repository can store its files on one server or across many different servers known as mirrors.

How To Install Packages

The easiest way to find packages is through the graphical tools provides by your distribution's package manager.

 

The graphical tools help you resolve dependency issues and to validate that the installation has worked correctly.

If you prefer to use the command line or you are using a headless server (i.e. there is no desktop environment / window manager) then you can use command line package managers.

It is of course possible to install individual packages.

Within Debian based distributions you can use the dpkg command to install .deb files. Within Red Hat based distributions you can simply use the rpm command.

What Is In A Package

To see the contents of a Debian package you can open it in archive manager. The files contained within a package are as follows:

  • Control
  • Data
  • Debian-binary

The Debian-binary file contains the Debian format version number and the contents are almost always set to 2.0.

The control file is generally a zipped up tar file. The contents of the control file define important features of the package as follows:

  • Package Name
  • Version Number
  • Architecture
  • Maintainer
  • Installed-Size
  • Dependencies
  • Section (i.e. graphics)
  • Priority
  • Homepage
  • Description

The data file which is also a zipped up tar file provide a folder structure for the package. All the files in the data file are expanded to the relevant folder in the Linux system.

How Can You Create Packages

To create a package you need to have something that you want to deliver in a packaged format.

A developer may have created source code which works under Linux but which isn't currently packaged for your version of Linux. In this instance you may wish to create a Debian package or RPM package.

 

Alternatively maybe you are the developer and you wish to make packages for your own software. In the first instance you need to compile the code and make sure it works but the next step is to create the package.

Not all packages require source code. For instance you might create a package containing wallpaper images of Scotland or a specific icon set.

This guide shows how to create .deb and .rpm packages.