Like the application store provided by windows or the application market provided by mobile phones that we use every day, most modern Unix-like operating systems also provide a centralized mechanism for searching and installing software. Software is usually stored in a repository and distributed externally in the form of packages. The work of handling packages is called package management. The package provides the basic components of the operating system, as well as shared libraries, applications, services, and documentation. This is called a package management system. In addition to installing software, it also provides tools to update the installed packages.
Most package systems are built around a collection of package files. A software package file is usually an archive file that contains compiled binaries and other software resources, as well as installation scripts. Package files also contain valuable metadata, including their dependencies, and a list of other packages needed to install and run them.
Although the functions and advantages of these package management systems are roughly the same, the packaging formats and tools vary by platform (different Linux distributions), as shown in the following table:
Operating System | Format | Tools |
---|---|---|
Debian | .deb | apt, apt-cache, apt-get, dpkg |
Ubuntu | .deb | apt, apt-cache, apt-get, dpkg |
CentOS | .rpm | yum |
Fedora | .rpm | dnf |
FreeBSD | Ports, .txz | dmake, pkg |
As can be seen from the above table, Debian and its derivatives, such as Ubuntu, which I use now, have a package format of .deb. APT is an advanced software package management tool that provides most common commands such as searching the repository, installing software packages and their dependencies, and managing upgrades, etc.
In the system, we can also use the dpkg program to install a single deb file. The APT command is used as the front end of the underlying dpkg, and sometimes it is called directly.
Most of the currently released debian derivatives include the apt command, which provides a simple and unified interface that can be used for common operations usually handled by the apt-get and apt-cache commands. This command is optional, but using it can simplify some tasks.
The last section introduced the package management system. This section follows the content of the previous section and introduces the apt command in the package management system.
We are accustomed to using windows systems and smart phones, both of which are very easy to download and install software. But how to install software under Ubuntu? The Ubuntu installation software is not like under Windows, just double-click the .exe file to start the installation. Generally speaking, many softwares under Ubuntu need to provide their own source code first, use the source code to compile by themselves, and use the command "install" to install into the system after the compilation is complete. Of course, there are other software installation methods under Ubuntu. The most used method is to compile the source code and install it, especially for embedded Linux development. The format of the command "install" is as follows:
install [Options]...[-T]Source file target file
install [Options]...Source File...table of Contents
install [Options]...-t directory source files...Or: install[Options]...-d directory...
The "install" command is to copy a file (usually a compiled file) to the destination. In the above three forms, copy the source file to the target file or copy multiple source files to an existing directory at the same time Set its ownership and permission mode. In the fourth form, the specified directory will be created. The command "install" is usually used in combination with the command apt-get.
In fact, we can directly install a lot of software & games in Ubuntu, but for those who are new to the Linux system, we often don’t know how to install and install software. In fact, we can directly download and install all certified software by using the software package management system. The most download tool we use: APT download tool, APT download tool can realize software automatic download, configuration, installation of binary or source code functions.
The combination of the APT download tool and the "install" command explained above constitutes the most commonly used method of downloading and installing software under Ubuntu. And it solves a defect of the software installed under the Linux platform: that is, the problem of interdependence between software.
APT adopts the C/S mode, that is, the client/server mode. Generally speaking, our PC is used as a client. When downloading is required
The software is requested from the server, so we need to know the address of the server, also known as the software source or update source. This generally uses a foreign software source (server) by default. Because we are in China, if you do not choose a Chinese server, it may cause very slow download speed or even download failure. So we need to modify the software source to a domestic server, here are two ways to modify:
The "Download from" under the "Ubuntu Software" tab in the figure above is the installation source of the APT tool.
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
Open the sources.list file to modify and select the appropriate source, replace the content of the original file, save the edited file, take Alibaba Cloud update server as an example:
Open the sources.list file
sudo vim /etc/apt/sources.list
Edit the /etc/apt/sources.list file and add the Alibaba Cloud mirror source at the top of the file:
# Aliyuan
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-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/Ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/Ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/Ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/Ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/Ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/Ubuntu/ bionic-backports main restricted universe multiverse
When we use the APT tool to download, install or update software, we will first compare it with the native software in the download list to see which software needs to be downloaded or upgraded. By default, APT will download and install the latest software package , Other software that the installed software package depends on will also be downloaded, installed or updated, which is very smart and worry-free.
Recommended Posts