头图

foreword

In Linux distributions based on Debian , the default software manager is the Advanced Packaging Tool, which is apt . This article will briefly describe the following commands for adding and removing software:

 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

A server that holds software for a specific Linux distribution is called a software repository. Your system stores the searched repositories in the sources.list file. To check if a package is available for you to download:

 apt-cache search keyword

Let's search using the snort keyword:

 apt-cache search snort

image.png

Several options are returned, depending on whether we can ensure that the correct option is selected for the installation.

apt-get install command

Once we know which package we want to install, we can use:

 apt-get install packagename

to install the specified package. Let's install snort based on the previous command result. snort is a flexible network intrusion detection system package.

image.png

snort is already installed on my machine, so I wasn't asked to Y/n install it, the output may be different for you.

apt-get remove command

If you need to remove a package, you can use:

 apt-get remove packagename

remove command does not delete configuration files, for this we can use purge .

apt-get purge command

To keep things modular, many Linux packages are broken down 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 these files we use the purge command:

 apt-get purge packagename

If I want to remove the snort package, and all its dependencies, I can do:

 apt-get purge snort

image.png

I don't want to delete it completely, as long as you understand the meaning.

apt-get update command

It is used to search all packages on the system and check if they are updated. If there is an update, download the update.

 apt-get update

image.png

So how do we install these updates?

apt-get upgrade command

This command will update all the packages you know on your system apt .

 apt-get upgrade

image.png

You will get an estimate of the hard drive space required for the upgrade. Enter Y if you want to continue.

sources.list file

This file tells the system which repositories to search for software from. I will use VI to see it.

 vi /etc/apt/sources.list

image.png

When you download a package, apt will look in order in your sources.list and stop when it finds the package.

Warehouses are of the following categories:

  • main : Contains supported open source software.
  • universe : Contains community maintained open source software.
  • multiverse : Contains software that is restricted by copyright or other legal issues.
  • restricted : Contains proprietary device drivers.
  • backports : Contains later versions of the software.

You can add repositories by editing this file.


chuck
303 声望41 粉丝