Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Latest commit

 

History

History
103 lines (56 loc) · 6.58 KB

15.md

File metadata and controls

103 lines (56 loc) · 6.58 KB

Day 15 - Deeper into repositories...

INTRO

Early on you installed some software packages to your server using apt install. That was fairly painless, and we explained how the Linux model of software installation is very similar to how "app stores" work on Android, iPhone, and increasingly in MacOS and Windows.

Today however, you'll be looking "under the covers" to see how this works; better understand the advantages (and disadvantages!) - and to see how you can safely extend the system beyond the main official sources.

REPOSITORIES AND VERSIONS

Any particular Linux installation has a number of important characteristics:

  • Version - e.g. Ubuntu 20.04, CentOS 5, RHEL 6
  • "Bit size" - 32-bit or 64-bit
  • Chip - Intel, AMD, PowerPC, ARM

The version number is particularly important because it controls the versions of application that you can install. When Ubuntu 18.04 was released (in April 2018 - hence the version number!), it came out with Apache 2.4.29. So, if your server runs 18.04, then even if you installed Apache with apt five years later that is still the version you would receive. This provides stability, but at an obvious cost for web designers who hanker after some feature which later versions provide. (Security patches are made to the repositories, but by "backporting" security fixes from later versions into the old stable version that was first shipped).

WHERE IS ALL THIS SETUP?

We'll be discussing the "package manager" used by the Debian and Ubuntu distributions, and dozens of derivatives. This uses the apt command, but for most purposes the competing yum and dnf commands used by Fedora, RHEL, CentOS and Scientific Linux work in a very similar way - as do the equivalent utilities in other versions.

The configuration is done with files under the /etc/apt directory, and to see where the packages you install are coming from, use less to view /etc/apt/sources.list where you'll see lines that are clearly specifying URLs to a “repository” for your specific version:

 deb http://archive.ubuntu.com/ubuntu precise-security main restricted universe

There's no need to be concerned with the exact syntax of this for now, but what’s fairly common is to want to add extra repositories - and this is what we'll deal with next.

EXTRA REPOSITORIES

While there's an amazing amount of software available in the "standard" repositories (more than 3,000 for CentOS and ten times that number for Ubuntu), there are often packages not available - typically for one of two reasons:

  • Stability - CentOS is based on RHEL (Red Hat Enterprise Linux), which is firmly focussed on stability in large commercial server installations, so games and many minor packages are not included
  • Ideology - Ubuntu and Debian have a strong "software freedom" ethic (this refers to freedom, not price), which means that certain packages you may need are unavailable by default

So, next you’ll adding an extra repository to your system, and install software from it.

ENABLING EXTRA REPOSITORIES

First do a quick check to see how many packages you could already install. You can get the full list and details by running:

apt-cache dump

...but you'll want to press Ctrl-c a few times to stop that, as it's far too long-winded.

Instead, filter out just the packages names using grep, and count them using: wc -l (wc is "word count", and the "-l" makes it count lines rather than words) - like this:

apt-cache dump | grep "Package:" | wc -l

These are all the packages you could now install. Sometimes there are extra packages available in if you enable extra repositories. Most Linux distros have a similar concept, but in Ubuntu, often the "Universe" and "Multiverse" repositories are disabled by default. These are hosted at Ubuntu, but with less support, and Multiverse: "contains software which has been classified as non-free ...may not include security updates". Examples of useful tools in Multiverse might include the compression utilities rar and lha, and the network performance tool netperf.

To enable the "Multiverse" repository, follow the guide at:

After adding this, update your local cache of available applications:

sudo apt update

Once done, you should be able to install netperf like this:

sudo apt install netperf

...and the output will show that it's coming from Multiverse.

EXTENSION - Ubuntu PPAs

Ubuntu also allows users to register an account and setup software in a Personal Package Archive (PPA) - typically these are setup by enthusiastic developers, and allow you to install the latest "cutting edge" software.

As an example, install and run the neofetch utility. When run, this prints out a summary of your configuration and hardware. This is in the standard repositories, and neofetch --version will show the version. If for some reason you wanted to be have a later version you could install a developer's Neofetch PPA to your software sources by:

sudo add-apt-repository ppa:dawidd0811/neofetch

As always, after adding a repository, update your local cache of available applications:

sudo apt update

Then install the package with:

sudo apt install neofetch

Check with neofetch --version to see what version you have now.

When you next run "sudo apt upgrade" you'll likely be prompted to install a new version of neofetch - because the developers are sometimes literally making changes every day. (And if it's not obvious, when the developers have a bad day your software will stop working until they make a fix - that's the real "cutting edge"!)

SUMMARY

Installing only from the default repositories is clearly the safest, but there are often good reasons for going beyond them. As a sysadmin you need to judge the risks, but in the example we came up with a realistic scenario where connecting to an unstable working developer’s version made sense.

As general rule however you:

  • Will seldom have good reasons for hooking into more than one or two extra repositories
  • Need to read up about a repository first, to understand any potential disadvantages.

RESOURCES

Copyright 2012-2021 @snori74 (Steve Brorens). Can be reused under the terms of the Creative Commons Attribution 4.0 International Licence (CC BY 4.0).