Now let's talk about the Ubuntu package manager, which is apt.
So APT is the Ubuntu equivalent to Yum.
It's the advanced package tool and it's a newer replacement of all the utilities like APT Cache and apt. Get in the
documentation every now and then you will find reference to those, but APT in general should have replaced all of it.
So you should be safe if you just use APT like Yum. APT was developed to work with packages in an intuitive way.
And APT is also using repositories which are defined in etc. APT Sources
list Before moving on, I need to quickly show you these repositories.
So I'm using LS on etc.
To show what is going on. And there you can see there's a sources list, but there's also a
sources list D. And it's important to realize that because this sources list D contains drop in files.
This is a generic trend that you find in Linux a lot. You have a main configuration file
like in this case the sources list. And this main configuration file is provided by your distribution.
Now you don't want to change the main configuration file because during update it might get updated and your changes will get lost.
And that's why the recommendation is to put your own stuff in the drop in directory.
And these drop in directories are normally shaped as name of the original file
followed by D. And there you put the files that you want to use.
Now it is important if you work with these drop in directories that you respect the file format.
Sometimes it is very specific for repositories or red hat. For instance, they need to
end in dot repo for for repositories in Ubuntu. In this directory the name needs
to end in sources, otherwise it won't get recognized. Let's get back to the slides.
So what do you need to know to work with apt?
Well, first you need to make sure that the local list of packages
is updated to the most recent version of the packages using APT Update.
There is the list of the packages in the repository. There is the list of the packages
on your system. And APT Update makes sure that your system knows if newer versions are available.
Next, you can use APT Search to search for packages or APT Install to install packages.
Now, on Ubuntu, if a package contains a service, it will be started and enabled automatically. So
normally after installing your services, you don't have to do a sudo, systemctl, enable and so on.
You can use APT Upgrade to upgrade packages.
And sometimes packages are installed as dependencies but no longer required. If that's
the case, use APT AutoRemove to remove them. That will clean your system.
You might also want to use APT cache Search on a file
name to search packages that contain a specific file. Let me demonstrate.
Let me start with the sudo apt update that's
going to fetch all these package index files.
140 packages can be upgraded
well, sudo apt list upgradable.
Let's follow the prompt showing which packages that are.
I'm not going to do that now because I don't want to waste time.
I'm going to search for packages. So sudo apt cache search on iotop I
o top is a utility that allows me to monitor I O performance.
And app cache search is powerful because it allows you
to search for files that are contained within the package.
Now, in this case, the result is a little bit simple. The name of the package
that contains iotop is also iotop. Okay, so then I know that I need sudo apt
install iotop to install it and that will install it. And now my iotop is available.
Is there anything else? Yeah, maybe sudo apt auto remove.
That's for these dependencies that are no longer required.
Now there are no dependencies that are no longer required. So the result of this command is
a little bit disappointing for the rest of it. Apps like DNF was developed to be intuitive.
I would say check on the help and try what you can do with it. It's not that
hard. In the next video, you'll learn about a new way to work with software packages on Ubuntu.