1. An overview of the

Advanced Packaging Tool (APT) is a software package management program in Debian/Ubuntu Linux system. It can be used to find the desired software package, and it is easy to install, uninstall and update. It can also be used to upgrade Ubuntu; The source file of APT is sources.list in /etc/apt/.

2. Modify the data source

Due to the problem of domestic network environment, we need to change the data source of Ubuntu to domestic data source. The procedure is as follows:

2.1 Viewing the System Version

Command:

lsb_release -a
Copy the code

The output is as follows:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic
Copy the code

Note: Codename is bionic, which is the name of our Ubuntu system and is needed to modify the data source

2.2 Editing a Data Source

Command:

vi /etc/apt/sources.list
Copy the code

Delete all contents and change to:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted  universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverseCopy the code

Figure:

During the system installation, the data source link has been set, so the system is configured by default. If it is not set, it can be modified in this form.

2.3 Updating data Sources

apt-get update
Copy the code

3. Common APT command

  • Installation Package:apt-get install <Package Name>
  • Deleting a software package:apt-get remove <Package Name>
  • Update the software package list:apt-get update
  • Upgrade a system where updates are available (careful) :apt-get upgrade
  • Search:apt-cache search <Package Name>
  • Obtain package information:apt-cache show <Package Name>
  • Delete packages and configuration files:apt-get remove <Package Name> --purge
  • Learn about using dependencies:apt-cache depends <Package Name>
  • To see which packages are dependent:apt-cache rdepends <Package Name>
  • Install the relevant compilation environment:apt-get build-dep <Package Name>
  • Download the source code:apt-get source <Package Name>
  • Clean up useless bags:apt-get clean && apt-get autoclean
  • Check for corrupt dependencies:apt-get check

The above.