KC7MM Wiki

Amateur Radio with KC7MM

User Tools

Site Tools


linuxusernet:inside_linux:install_sw_1

A Look Inside Linux series

A series of short topics on how Linux works and how to make it work the way you want it to, which I present during the weekly sessions of the Linux User Net. The target audience is Hams who are new to Linux and want to know more about it, as well as experienced Linux users who can learn more about their chosen operating system. These are my notes for the presentations. (Russ, KC7MM)

20: Installing software in Linux, part 1

Part 1: Installing from software packages.

Part 2 will cover installing from source code.

Introduction

After we have installed and configured an operating system on a computer, we're ready to install the applications that will make it useful to us.

The most common method of installing applications in Linux is to install pre-compiled software that has been organized into packages.

  • Packages can be handled individually or via a repository.
  • Package manager is used to manage all software: install, upgrade, delete, synchronize.

How do applications work?

If you were around when we looked at how a Linux system is structured, you'll recall that:

  • The kernel is the lowest layer of the software stack. It works directly with the system's hardware and provides interfaces that give software access to it.
  • On top of the kernel is a layer of programs that make use of the hardware. They provide various functions that are used by application programs to do their work.
  • For example, a network service implements standard protocols that give apps access to Ethernet and Wifi. Such functional implementations are made up of collections of code that can be used by any program that needs them. These collections are called libraries.

When an application program is developed, it is built with the expectation that certain services and/or libraries are installed on the system that will run it. That way, the developer needs to write only the code that implements that app, and not the entire platform.

  • For example, a programmer who writes an application that needs access to a network can utilize existing network services and won't have to code hardware drivers and network protocols from scratch.
  • The process of incorporating these things into a program is termed linking.
  • The expected services and libraries are termed dependencies: the program depends on their being present when it runs.

How do packages work?

  • Software that has been compiled into its final form, as an executable or library, and stored in a software repository.
  • Dependencies can be handled in two ways:
    1. Dynamic linking:
      • When the application is run, it links to other software that is installed on the system it's dependencies.
      • These dependencies are installed from separate packages in a software repository.
      • If a dependency is missing, or is outdated (the app needs a function contained in a newer version), the application fails to run.
      • The application itself may be contained in multiple packages: extensions of the basic app, images, documentation.
      • This is the method used by repositories that use package managers such as APT and PACMAN. A major function of the package manager is to identify and install dependencies.
      • Advantages: economy of package size and disk space.
      • Disadvantages:
        • The difficulty of assuring that a shared library will match up with the version required by multiple applications: dependency hell.
        • Often not the latest version.
    2. Static linking:
      • All dependencies are included in the package.
      • This is used by Snap, Flatpak, Appimage.
      • Advantages:
        • All dependencies are guaranteed to be met.
        • Easy to keep up with version changes.
      • Disadvantage: much greater download size and disk space usage. Snaps make modifications to the Linux file system that differ from the customary file locations.

Package Sources

Packages may be obtained from either a repository of related software, or directly from the application developer.

Repository package source

  • A collection of software packages that is controlled by a package manager application: APT, Pacman, FlatPak, etc.
  • Maintained by:
    1. The developers of a specific Linux distribution: Debian, Arch, etc.
    2. Distributors of specific types of packages developed by other people: e.g., FlatPaks and Docker images.
  • Package organization within a repository depends on the type of packages it employs: interdependent vs. standalone.
    1. Interdependent: These are for dynamically-linked applications, where the packages contain libraries that are linked at runtime. All the packages that make up the program must be present when it is executed. This is the system pioneered by Debian and currently used by most Linux distros.
    2. Standalone: These packages are complete in themselves, containing all the libraries required for the application, statically-linked at compile time. They have no external dependencies. Snaps and FlatPaks are examples.

Developer package source

In order to make their products easily available to users, Open Source software developers can organize them into packages that are compatible with existing package managers. These may come in different forms.

  1. Downloadable packages: The end user downloads a compatible package, and uses the package manager of the Linux distribution to install it. Example: a “.deb” file that can be installed on Debian-based systems.
  2. Personal Package Archive (PPA): Developed by Ubuntu, a PPA is a sort of independent repository that can be treated by the APT package manager as if it were part of the distribution's repository. That includes handling dependencies and updates. A PPA can be set up by any developer. Works with Ubuntu and derivatives (such as Linux Mint).
  3. Manually add package repositories: Debian, Red Hat, and other distros allow the sysadm to edit its list of repositories from which packages are drawn. (For Debian, the file is /etc/apt/sources.list.) Thus, developer package repositories can be added to the list, producing the same effect as Ubuntu's PPAs.

Using these techniques, you can:

  1. Install software that isn't in your distro's repository.
  2. Install newer versions of software than the one contained in the distro's repository.

Package managers

A package manager is an application that performs the entirety of installation and maintenance for a specific packaging system. In general, a package manager will:

  • Manage packaged software: download, installation, upgrade, and removal.
  • Identify a package's dependencies and automatically install them.
  • Work with packages from a repository or from individual sources (e.g., a .deb file).
  • Co-exist on a system with other package managers, e.g., APT and Snap and Flatpak can all be used on a single host.
  • Determine where files contained in packages are installed in the Linux file system.

User interfaces: All package managers can be run from the command line. Many distributions provide graphical front ends that make it easier to locate and maintain software in the repository.

Packages everywhere!

Owing to their extraordinary utility, software package systems have proliferated wildly.

We've been looking only at software management for Linux distros, but package repositories and package managers are now used pretty much everywhere in the software world. For example:

  • Programming languages use them to distribute language libraries: pip for Python, npm for Javascript.
  • Virtualization systems such a Docker use them to distribute runnable images.
  • Software “stores” such a Apple Store and Google Play.
  • Gaming systems, such as Steam.

Appimage

  • An Appimage is a type of software package that differs from all the types we have looked at so far, in that it doesn't use a package manager. The installation process consists of downloading an Appimage package to disk and granting it executable permissions. This makes Appimages essentially independent of the underlying Linux distribution – although they do rely on the Linux system to provide basic services such as video, networking, and disc access.

Finally

We've seen that the primary method of installing software on Linux systems – including the system itself – is by encapsulating programs into packages which are installed and maintained by a package manager.

But that's not the only way to do it. We'll look at other methods in next Look Inside Linux.

Return to series index

linuxusernet/inside_linux/install_sw_1.txt · Last modified: 2022/08/17 17:55 by KC7MM