Skip to content

Instantly share code, notes, and snippets.

@surajsaini95
Created April 3, 2020 09:27
Show Gist options
  • Save surajsaini95/773adefd3c636449744300b4c9898e4c to your computer and use it in GitHub Desktop.
Save surajsaini95/773adefd3c636449744300b4c9898e4c to your computer and use it in GitHub Desktop.
this blog gives an understanding on how package management is done in Ubuntu

How Ubuntu manage packages

Past

In the early day software was provided either via FTP or mailing lists as source code, along with the required man pages, the necessary configuration files and only a few small files contained the instructions to create a binary (normally in a tar file).

Evolution

Now a days package manager deals with packages, distributions of software and data in archive files.Package managers are charged with the task of finding, installing, maintaining or uninstalling software packages upon the user's command.

Lets introduce Package

Ubuntu works with the 'Deb' packages as it comes from the Debian linux distribution, and is widely considered the best package format for system-level libraries and applications with rich and dynamic dependencies.

The aim of packaging is to allow the automation of installing, upgrading, configuring, and removing computer programs in a consistent manner.

Package manager

If a certain package requires a certain resource such as a shared library, or another package, it is said to have a dependency. All modern package management systems provide some method of dependency resolution to ensure that when a package is installed, all of its dependencies are installed as well.Typical functions of a package manager include:

  • Working with file archivers to extract package archives

  • Ensuring the integrity and authenticity of the package by verifying their digital certificates and checksums

  • Looking up, downloading, installing, or updating existing software from a software repository or app store

  • Grouping packages by function to reduce user confusion

  • Managing dependencies to ensure a package is installed with all packages it requires, thus avoiding "dependency hell"

Linux repository

A Linux repository is a collection of software hosted on a remote server and intended to be used for installing and updating software packages on Linux systems.They provide a high degree of security, since the software included is thoroughly tested and built to be compatible with a particular distribution and version. So, you can expect the updates to occur with no unexpected "side effects."

How package manager works

In order to perform the task of package management effectively,you need package manager working at 2 levels:

  • low-level package manager handle the backend the actual installation, upgrade, and removal of package files and dpkg is an example.

  • high-level package manager gives some intelligence to low-level package manager and handle the tasks of dependency resolution and metadata searching -”data about the data”- are performed.Example apt,appitude ,etc.

dpkg - A low-level package manager

dpkg can install, remove, provide information about and build *.deb packages but it can’t automatically download and install their corresponding dependencies on Debian-based systems.

dpkg itself is controlled entirely via command line parameters, which consist of exactly one action and zero or more options. The action-parameter tells dpkg what to do and options control the behavior of the action in some way.

Some of the use cases are :

# to install a package
	$ dpkg -i file.deb 

# to upgrade a package from a compiled file
	$ dpkg -i file.deb

# to list installed packages
	$ dpkg -l

# to locate a specific package
	$ dpkg -l package_name

# to determine if a package is installed
	$ dpkg --status package_name

# to view the content of a Package
	$ dpkg -c package_name

# to remove a Package
	$ dpkg -r package_name

APT - a high-level package manager

apt provides a simple way to retrieve and install packages, including dependency resolution, from multiple sources using the command line for Debian and derivatives. Unlike dpkg, apt does not work directly with *.deb files, but with the package proper name.

Some of the use cases are :

# to update packages
	$ sudo apt update

# to upgrade packages
	$ sudo apt upgrade

# to find a package
	$ apt search search_string

# to view info about specific package
	$ apt show package

# to install package from linux repository
	$ sudo apt install package

# to remove packages
	$ sudo apt remove package

Popular universal package managers

AppImage , the format for distributing portable software on Linux without needing superuser permissions to install the application

Flatpak , package management for Linux offering a sandbox environment in which users can run application

Snappy , designed to work for internet of things, cloud and desktop computing.

The above discussed topics will help any beginner to understand package management in Ubuntu.

Keeping exploring !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment