Three ways to install the program under ubuntu summarize the of recommendations

  • 2020-05-14 05:53:47
  • OfStack

The introduction

There are three ways I know of installing an application in ubuntu: apt-get, dpkg installing deb, and make install installing source packages. The following are examples for each method.

apt - get method

Using apt-get install to install an application is one of the most common installation methods. For example, I will install build-essential. Using the following, he will help me install all the dependent packages.


sudo apt-get install build-essential

After executing the above command, we can see 1 message, The following extra packages will be installed: represents all dependent packages that need to be reinstalled.


sudo apt-get install build-essential
[sudo] password for enadmin: 
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following extra packages will be installed:
 binutils cpp cpp-4.6 dpkg-dev fakeroot g++ g++-4.6 gcc gcc-4.6
 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
 libc-bin libc-dev-bin libc6 libc6-dev libdpkg-perl libgomp1 libmpc2 libmpfr4
 libquadmath0 libstdc++6-4.6-dev linux-libc-dev manpages-dev
Suggested packages:
 binutils-doc cpp-doc gcc-4.6-locales debian-keyring g++-multilib
 g++-4.6-multilib gcc-4.6-doc libstdc++6-4.6-dbg gcc-multilib autoconf
 automake1.9 libtool flex bison gdb gcc-doc gcc-4.6-multilib
 libmudflap0-4.6-dev libgcc1-dbg libgomp1-dbg libquadmath0-dbg
 libmudflap0-dbg binutils-gold glibc-doc libstdc++6-4.6-doc
The following NEW packages will be installed:
 binutils build-essential cpp cpp-4.6 dpkg-dev fakeroot g++ g++-4.6 gcc
 gcc-4.6 libalgorithm-diff-perl libalgorithm-diff-xs-perl
 libalgorithm-merge-perl libc-dev-bin libc6-dev libdpkg-perl libgomp1 libmpc2
 libmpfr4 libquadmath0 libstdc++6-4.6-dev linux-libc-dev manpages-dev
The following packages will be upgraded:
 libc-bin libc6
2 upgraded, 23 newly installed, 0 to remove and 101 not upgraded.
Need to get 36.3 MB of archives.
After this operation, 83.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? y

The various parameters of apt-get are given below:

apt-get install xxx install xxx. With parameters, -d means download only, and -f means mandatory installation
apt-get remove xxx uninstall xxx
Update the software information database
apt-get upgrade system upgrade
apt-cache search search package

Tips: it is recommended that you frequently update your software information database with the "apt-get update" command

In theory, apt-get is required to be connected to the Internet. However, if you make a local source, you don't need to be connected to the Internet. For making a local source, please refer to ubuntu for making a local source

dpkg installs the deb package

The Ubuntu software package format is deb. The installation method is as follows:

sudo dpkg -i package.deb

There are many detailed ways to use dpkg on the Internet. Here are a few:

dpkg -i package.deb 安装包
dpkg -r package 删除包
dpkg -P package 删除包(包括配置文件)
dpkg -L package 列出与该包关联的文件
dpkg -l package 显示该包的版本
dpkg �unpack package.deb 解开 deb 包的内容
dpkg -S keyword 搜索所属的包内容
dpkg -l 列出当前已安装的包
dpkg -c package.deb 列出 deb 包的内容
dpkg �configure package 配置包

According to the Ubuntu Chinese BBS, apt - get method is used to install the software, all deb package download cache to/var cache apt/archives directory, so backup can take common deb package, and even made ISO toolkit, engraved plate, after installing a Ubuntu can in the absence of the network environment. The following command is copy archives this directory to/var/cache apt/directory, replacing the original archives


enadmin@ubuntu-server:~/ftp$ sudo cp -r archives/ /var/cache/apt/

make install source code installation

To install make, you must install the build-essential dependency package, as described earlier. After the installation, we can do the source installation. The installation of the source code can be roughly divided into three steps :(./configure) and > compilation (sudo make) and installation (sudo make install) and > installation (sudo make install).

1. Configuration: this is the first step in compiling the source code through the./configure command. Perform this step to prepare for compiling the source code. Common options are --prefix=PREFIX, which specifies where to install the program. More options are available through --help. There are also programs that do not need to perform this step.

Once the configuration is approved, the make instruction can be used to execute the compilation of the source code immediately. Depending on the software, the time required to compile it will vary, so all we have to do is wait and see. This step is a simple command, but sometimes the problems are ten percent complex. It is more common to see a program fail to complete in the middle of its compilation. At this point, you need to analyze the error to find a solution.

3. Installation: if there is no problem with the compilation, then sudo make install can be installed into the system by executing sudo make install.

Let's take installing nagios as an example.


//1. unzip 
tar -zxf nagios-4.0.2.tar.gz 
//2. Enter the directory 
cd nagios-4.0.2
//3. configuration 
./configure --prefix=/usr/local/nagios 
//4. compile 
make all
//5. The installation 
make install && make install-init && make install-commandmode && make install-config

That's how the source code is installed.


Related articles: