In Debian-based Linux distributions, the default software manager is the Advanced Packaging Tool,
Let's take a look at
apt-cache search apt-get install apt-get remove apt-get purge apt-get update apt-get upgrade /etc/apt/sources.list
apt-cache search command
Servers that hold the software for particular distributions of Linux are known as repositories. The repositories your system will search in are stored in the sources.list file. To check if a package is available for you to download:
apt-cache search keyword
Let's search for the
apt-cache search snort
Several options were returned, it's up to us to make sure we select the correct one to install.
apt-get install command
Once we know which package we want to install, we can use
apt-get install packagename
to install it, let's install the
snort - flexible network intrusion detection system package, from our previous command results.
apt-get install snort
Snort is already installed on my machine so I am not asked Y/n to install it, output might be different for you.
apt-get remove command
If you need to remove a command, use:
apt-get remove packagename
remove command doesn't remove configuration files, for that we use
apt-get purge command
To keep things modular, many Linux packages are broken into software units that many different programs can share. When you install a package, you also install any dependencies or libraries it needs to run, in order to remove all those files, we use the purge command
apt-get purge packagename
If I wanted to remove snort and all it's dependencies, I can do
apt-get purge snort
I don't want to, but you get the idea.
apt-get update command
It's used to search through all the packages on your system and check if updates are available for them, if so, it downloads the updates.
Now how do we actually install these updates?
apt-get upgrade command
This command will upgrade every package on your system that apt knows about
You'll get an estimate of amount of hard drive space necessary for the upgrade. Enter Y if you want to continue.
This file tells your system which repositories to search for software from. I'll use VI to view it.
When you download a package, apt will look sequentially through your sources.list, it stops when it finds the package.
There are a few categories for repositories
- main: Contains supported open source software.
- universe: Contains community-maintained open source software.
- multiverse: Contains software restricted by copyright or other legal issues.
- restricted: Contains proprietary device drivers.
- backports: Contains packages from later releases.
You can add a repository by editing this file.