In this lesson, we're going to
discuss package managers
and their use in the Linux operating system.
These days, one of the most important elements
of a computer is its software.
The Linux operating system is known for its diversity
and adjustability because of all the different pieces
of software that you can install.
Nevertheless, installing new software might be frustrating
in the beginning for new users.
But soon, as a Linux user and administrator,
you're going to realize the unlimited options that you have
in your hands, by being able to understand how
to install different pieces of software.
One thing you should be aware
of upfront is that Linux does have multiple different ways
of installing pieces of software.
And these are known as package managers.
Now package management is really important in Linux
because each distribution does it slightly differently.
And knowing how to use these different package managers
can be really, really important
for you as a power user or system administrator
because you're going to have to download
and install all these different pieces
of software from repositories, update them,
handle their dependencies,
and then later on, uninstall that software
when you no longer need it.
And all this is done different ways
depending on what distribution
and what package manager you're going to be using.
So in order to become a true Linux geek,
it's really important to understand how
these major Linux distributions handle packages
in order to install the necessary applications
and keep them updated over time.
Linux distributions really rely on two different methods
of managing software throughout its lifecycle.
Package managers and compiling software.
Now package managers refer to programs that install,
update, inventory and uninstall package software.
This governs the entire software lifecycle
for you and makes it much easier
for you to control what software is being installed,
how you can manage software versions,
and then later on, uninstall that software
when you no longer need it.
Now, when you compile software manually from source code,
this is actually much more difficult.
Because of the open source nature of Linux,
this means that you can download any piece
of code off the internet,
you can compile it and then run it on Linux.
But this is much more difficult than simply using
a package manager and installing
a pre-packaged piece of software.
Now, many Linux applications are considered modular
and they depend on other pieces of software that
are already present on your system in order for them to run.
The great thing about using a package is that it's already
going to list out the dependencies, the required components,
without you having to figure out all those things yourself.
The package manager is going to check those dependencies
before it installs the software from the package.
And if you're missing any of them,
it's going to go grab those dependencies
and install them first.
On the other hand, if you're manually compiling
the software yourself, you're going to have to go
and work through all those dependencies on your own.
On modern Linux systems,
there are two dominant methods
for managing software packages.
The first method is known as RPM,
or the Red Hat package manager.
The second is known as dpkg,
which is the Debian package system.
These two managers are significantly different
from each other, but the functionality they use
is actually going to be the same.
As a Linux user,
your choice will usually be driven
by your preferred Linux distribution.
For example, if you're using CentOS or Red Hat,
you're going to be using RPM or the Red Hat package manager.
If you're using something that is Debian based,
like Kali Linux, or Debian, you're going to be using dpkg,
or the Debian package management system.
Now for the most part, you're probably going to be using one
of these two package systems instead
of compiling the code yourself from source.
But there are some cases where you may want
to compile things from source.
This is because of the open source nature of Linux.
You have access to the source code,
and maybe there's some options that
you want to enable or disable.
You want to customize some choices inside
of that software and things like that.
In those cases, you can create those modifications
to the source code and then compile the source code
on your own system to run it.
But again, manually compiling software does require
more effort and more knowledge,
but it can give you something that is really customized
to your own needs.
For the most part, though, probably 99% of the time
you're going to be just fine using packages using
either RPM or dpkg.
Let's talk a little bit more about RPM.
Now, RPM is the Red Hat package manager,
and it's still in use today by many system administrators.
Software packages that are prepared
for RPM will have a file extension of .rpm.
RPM is very flexible and very powerful.
And one of the most useful features is the ability
for it to inventory software on your system.
This enables the system administrator to easily
see what software is installed and what versions
of those pieces of software are installed on a given system.
There's actually a newer and more advanced package manager
than the RPM.
And this is also supported by all Red Hat derivatives
including Red Hat Linux, and CentOS.
This is known as YUM, the Yellowdog Updater, Modified.
Now YUM does rely on RPM,
and it still uses .rpm package files,
but it offers a more elegant set
of commands and greater flexibility
for using software repositories
and handling dependencies for you.
Now just like YUM has replaced RPM,
there's a newer version called DNF that is replacing YUM.
DNF stands for the Dandified YUM package manager.
It's an improved version of YUM and uses fewer resources
while still maintaining support for
the fundamental RPM package manager underneath.
Most people find that DNF is easier to use than YUM
because it has a more simplified set of commands
while still being backwards compatible to most
of the YUM sub commands if you're used to those.
If you've been using YUM,
moving to DNF is pretty easy.
To install a package using DNF,
simply type in dnf install and the package name.
For example, dnf install Apache2 would install
the Apache2 web server.
If you want to uninstall a DNF package,
simply type in dnf remove package name.
So dnf remove Apache2 would uninstall
the Apache2 web server from that Linux system.
Now another package manager you may run across
is known as Zypper.
Zypper is a package manager that supports repositories,
dependencies and management of the software lifecycle
on an openSUSE system.
This still does support .rpm packages,
but it is specific to that Linux distribution.
It's very efficient and it does a great job
of managing package dependencies for you.
But if you're not on an openSUSE system,
you're probably not going to be using it.
If you are on an openSUSE system, you can install a package
by simply typing in zypper in and the package name.
To uninstall a package, simply type in zypper rm
and that package name.
If you're using a Debian based Linux system though,
you're going to be using dpkg,
which is the Debian package manager.
This is available in all Debian
and Debian based Linux distributions.
For example, Kali Linux is based
on Debian and therefore it uses dpkg.
The dpkg manager can control the entire software lifecycle
for you just like RPM can, but it's done on a Debian system.
Software packages are going to have the .deb file extension
if they're able to be used with the dpkg software,
because it's .deb for Debian package manager.
The preferred method of package management, though,
on Debian based systems today is actually using a tool known
as APT, the advanced package tool.
This is a more flexible tool than the dpkg package manager,
but it still relies on .deb packages.
Much like YUM still uses RPM, APT still uses .deb files.
Okay, so as you can see
there are lots of different package managers out there.
But what it comes down to is
that package managers are an easy way for you to install
or remove software on a given Linux system.
If you're using something that is Red Hat based,
like CentOS or Red Hat,
you're going to be using .rpm files using either the DNF
or YUM package managers.
If you're using a Debian based distribution,
you're going to be using .deb files as your packages,
and using tools like APT or the older dpkg.