linux ubuntu software installation

DPKG
Software Installation
In Linux systems, software is usually provided in the form of source code or precompiled packages. The software source code needs to be compiled into binary machine code before it can be used. The installation is time-consuming, but you can adjust the compilation options yourself to determine the required functions or components, or make some optimizations for the hardware platform. Pre-compiled software packages are usually compiled by the software publisher, you only need to copy the software to the system. Considering the applicability of pre-compiled software packages, pre-compiled software packages are usually not optimized for a certain hardware platform. The functions and components it contains are also common combinations. In the Ubuntu system, software is usually released as a package file in deb format, which is a pre-compiled software package. In addition to the compiled software, the deb package usually includes the copy path of the software, the dependency record of other software packages, the more common configuration files, and the software description, version, author, category, space and other information.
The deb package command follows the following convention: soft_ver-rev_arch.deb
soft package name ver software version number
revUbuntu revision number
arch target architecture name
For example: azureus_2.4.0.2-0ubuntu2_all.deb
You need to use the dpkg command to manage deb packages:

dpkg -i | --install xxx.deb install deb package
dpkg -r | --remove xxx.deb remove package
dpkg -r -P | --purge xxx.deb delete along with the configuration file
dpkg -I | -info xxx.deb View package information
dpkg-Lxxx.deb View the files in the package
dpkg-l View information about installed software packages in the system
dpkg-reconfigure xxx reconfiguration package
Sometimes, when you use dpkg to install a package, the system will prompt you that the package depends on other packages. At this time, you first install other software packages until the dependencies are satisfied. Or install multiple packages at the same time
dpkg -i aaa.deb bbb.deb ccc.deb

APT
If a software dependency is too complicated, use dpkg
来安装它, 并不是一个明智的选择, 这个时候您就需要用到APT 软件包管理系统。APT 可以自动的检查依 赖关系,通过您预设的方式来获得相关软件包,并自动安装配置它。事实上,在多数情况下,我们推荐您使用 APT 软件包管理系统。
APT 系统需要一个软件信息数据库和至少一个存放着大量 deb 包的软件仓库,我们称之为 源 。 源 可以 是网络服务器,安装 CD 或者本地软件仓库。您需要修改 /etc/apt/sources.list 文件,使 APT 系统能够连接 到 源。
从以下页面中获得网络安装源的列表,并且根据您的网络环境,选择速度较快的源。 http://wiki.ubuntu.org.cn/%E5%BF%AB%E9%80%9F%E......%97/DapperDrake
APT 系统主要包括 apt-get 和 apt-cache 等命令。通常是复合命令,包含若干个子命令。

apt-get install xxx 安装 xxx
-a 仅下载
-f 强制安装
apt-get remove xxx 卸载 xxx
apt-get update 更新软件信息数据库
apt-get upgrade 进行系统升级
apt-cache search 搜索软件包
说明:建议您经常使用 sudo apt-get update 命令来更新您的软件信息数据库

APT 系统修复
由于各种意外,APT 系统可能会出现问题,使用如下命令,尝试进行修复:apt-get -f install 源码包

对于绝大多数软件,我们建议您使用 APT 系统来安装它。在少数情况下,例如某软件没有以deb 包的格式 发布,或者需要定制适合自己的软件,您可以通过编译源代码的方式安装它。 首先需要下载软件的源码包,并且将它解包为一些源代码文件。并了便于管理,建议将下载的源码包移动 到 /usr/local/src/ 目录下,并在这里解包。
sudomvxxx.tar.gz/usr/local/src 移动源码包
cd /usr/local/src 进入“/usr/local/src/”目录
sudo tar -xzvf xxx.tar.gz 解包源码
cd xxx_ver/ 进行解包后的源码目录
源码目录中通常有一个 configure 脚本,用来配置即将开始的编译过程。您可以执行它
sudo ./configure [--prefix=/usr/loca/xxx ......]
它会自动检测软件的编译环境和依赖关系,并且生成 Makefile 文件。
使用带参数的命令 ./configure --help ,或者阅读 INSTALL 文件,查看该脚本允许的参数。例如使用 --prefix=/usr/local/xxx 参数,将软件的安装目录设定为 /usr/local/xxx/
。 (如果一定要将软件安装在单独目录下,建议您安装在这里)
现在执行 make 命令,系统会根据 Makefile 文件中的设定,通过 make 工具调用编译器和所需资源文件, 将源代码编译成目标文件。
sudo make
执行 makeinstall 命令, make 工具会自动连接目标文件和库文件,将最终生成的文件拷贝到Makefile 文 件设定的路径中,并且完成更改文件的属性,删除残留文件等活动。
sudo make install 现在,编译安装已经完成,为了更方便的使用它,需要给程序的可执行文件作一个符号链接。
sudo ln -sf /usr/local/xxx/可执行文件 /usr/local/bin/可执行文件
Tip:为了顺利的进行编译,至少需要安装 build-essential 软件包。
sudo apt-get install build-essential

Guess you like

Origin blog.csdn.net/clarence20170301/article/details/76686285