Package Managers

Installing open source software is incredibly easy on the command line with the use of package managers. In a single command, you can install some of the world's best software in an instant. Package managers operate by connecting to repositories all around the globe, and then downloading and installing pre-compiled executables and libraries.

Ubuntu and other Debian based distributions use the apt package manager. To use apt, you type the program name apt and then issue a subcommand to apt. The first thing to do with the apt package manager is issue the "update" subcommand, which updates the local machine's information about available packages. Because installing and updating packages makes large changes to the system, superuser privileges are required.

# apt update

Now, it's time to install software in a single command. Let's install the git version control system. Most open source projects use git to keep track of changes and coordinate between developers.

# apt install git

Notice that this command has asked whether you want to install many different "packages". Package managers handle dependencies between software, so if you need extra libraries or programs in order to run your desired program then your package manager will make sure everything that's required is installed. Now let's try to install two different packages at the same time.

# apt install vim emacs

Vim is a terminal based text editor renowned for its difficulty. Emacs is another editor whose main feature is it's programmability and flexibility. These editors are examples of ancient tools that still have a sizeable following because of their power, but the respective user communities are engaged in an eternal editor war.

Certain packages are grouped under a name. By asking app to install the group name, you receive a whole ecosystem of packages. For example, type the following apt command:

# apt install build-essential

The "build-essential" package group installs the basic GNU compiler toolchain. Most of the software we are using was built using this compiler toolchain.

Occasionally, package repositories are updated with newer versions of software. Your package manager can upgrade all packages with available upgrades with:

# apt upgrade

The apt package manager also has search capabilities, although it's usually just easier to search on the internet what specific keyword to use to install a particular package in apt.

# apt search youtube

Last modified: Tuesday, 16 June 2020, 4:13 AM