Typically, there are four main ways to install software on Linux:
- Online installation
- Installing the Deb package from disk
- Installing from a binary package
- Compiling the installation from source code
APT Package management tool Introduction
APT is the abbreviation for the Advance Packaging tool (advanced packaging tools) and is the package manager for Debian and its derived distributions, and apt can automatically download, configure, install binary or source-code packages, thus simplifying the process of managing software on UNIX systems. Apt was originally designed as the front end of the dpkg to handle packages in the Deb format. Now that the APT-RPM organization has been modified, APT can be installed in the RPM-enabled system management RPM package. This Package Manager contains apt-
several tools to start with, such as, for apt-get
apt-cache
apt-cdrom
use in the release of the Debian series.
When you perform the installation, the apt-get
tool will first search the local database for information about the w3m
software and download the software installation on the relevant server based on that information, and here are a few questions: Since the software is installed online, Why search in a local database? To explain the problem, you have to mention a few nouns:
- Software source mirror server
- Software source
We need to download a list of packages from the server on a regular basis, using sudo apt-get update
commands to keep the list of local packages up-to-date (sometimes you also need to do this manually, such as replacing a software source), and this table will have a record of software-dependent information, for software dependencies, Let me give an example: when we install the w3m
software, and this software needs libgc1c2
this package to work properly, this time when apt-get
installing the software will be installed for us, in order to ensure that w3m
the normal work.
Apt-get
apt-get
is a common assembly for working with packages, which apt
we can use to install, uninstall, and upgrade packages online, and some of the tools that are commonly used are listed below apt-get
:
Tools |
Description |
install |
followed by a package name for installing a package |
update |
Download/update the list of packages used to update the local software source from the software source mirror server |
upgrade |
Upgrade all locally updatable packages, but will not be upgraded if there is a dependency problem, and will usually be executed once before the updateupdate |
dist-upgrade |
Resolve Dependencies and upgrade (there is a risk) |
remove |
Remove installed packages, including packages that are dependent on the removed package, but do not contain a configuration file for the package |
autoremove |
Remove packages that were previously dependent on other packages but are no longer being used |
purge |
Same as remove, but completely removes the package, including its configuration file |
clean |
Remove the installed packages that are downloaded to the local, which are saved by default in/var/cache/apt/archives/ |
autoclean |
Remove older versions of installed software packages |
The following are some apt-get
common parameters:
Parameters |
Description |
-y |
It is useful to use this parameter in some automated installation scripts to automatically respond to the option to install packages. |
-s |
Analog installation |
-q |
Silent installation, specifying multiple q or -q=# , #表示数字, to set the level of silence, which is useful when you do not want to have too much screen output when you install a package |
-f |
Repairing a corrupted dependency |
-d |
Download-Only not installed |
--reinstall |
Reinstall installed packages that may have problems |
--install-suggests |
Install the recommended package installed by apt at the same time |
Software Search
When you just know a software, want to download the use, need to confirm the software warehouse inside there is no, you need to use the search function, the command is as follows:
sudo apt-cache search softname1 softname2 softname3……
apt-cache
command is a tool for local data related operations, as the search
name implies in the local database to find relevant softname1
softname2
... Information about the relevant software.
Using dpkg
Dpkg is the foundation of the Debian Package Manager, which was created in 1993 by Ian Murdock. The dpkg is very similar to RPM and is also used to install, unload, and supply information related to. deb packages.
Dpkg itself is a bottom-level tool. The upper-level tools, like APT, are used to remotely retrieve packages and handle complex package relationships. "Dpkg" is a shorthand for "Debian package".
We can often see packaged packages on the Web deb
and need to use dpkg
commands to install them.
dpkg
Common Parameters Introduction:
Parameters |
Description |
-i |
Install the specified Deb package |
-R |
followed by a directory name for installing all of the Deb installation packages in this directory |
-r |
Remove, removing an installed package |
-I |
Displaying deb information about a package file |
-s |
Display information for installed software |
-S |
Search for installed Packages |
-L |
Display directory information for installed packages |
Installing the Deb package with dpkg
We first use the apt-get
plus -d
parameter only download not installed, download the Emacs Editor's Deb package, after the download is complete, we can view the contents of the/var/cache/apt/archives/directory, such as:
Then we'll copy the first one deb
to the home directory and use the dpkg
installation
$ cp /var/cache/apt/archives/emacs24_24.3+1-4ubuntu1_amd64.deb ~# 安装之前参看deb包的信息$ sudo dpkg -I emacs24_24.3+1-4ubuntu1_amd64.deb
As you can see, this package also relies on a few packages, which means that if the host does not currently have these dependent packages, the direct use of the DPKG installation may have some problems because the dpkg
dependencies cannot be resolved for you.
# 使用dpkg安装$ sudo dpkg -i emacs24_24.3+1-4ubuntu1_amd64.deb
As expected, here you may have some errors:
How we're going to fix this error, it's going to work apt-get
, use its -f
parameters, fix the dependency installation
-f install
Without any errors, so that we install successfully, then you can run the Emacs program
Software installation of lab building Linux