ubuntu install and uninstall software

dpkg install and uninstall software

deb package format file is installed debian linux distribution systems, as well as debian-based systems and other systems hairstyle version of ubuntu deb format is used in the installation package, we can use the dpkg command to install deb installation package to manage these files.

Method /
Ubuntu install software
here do I use ubuntu system demonstration, first deb files into a folder, for example, I have here dolphin_emu file.


Right in the file folder "in the terminal open."

3. Use the dpkg command to install.

sudo dpkg -i deb file name


The experience will be reported error dependent relationship Usually, we can repair the installation by using the following commands.

sudo apt-get install -f

 

 

sudo dpkg -l viewing software already installed

Ubuntu uninstall the software
if you want to uninstall applications installed our viewing software has been installed by "sudo dpkg -l", and find the name of their software installed.

Finally, use the "sudo dpkg -r software name" to uninstall.



apt-get method

apt-get command is  Ubuntu  system package management tool that can be used to install, uninstall package, can also be used to upgrade package, can also be used to upgrade to the new version. This article describes the apt-get command of basic usage, demonstration environment for Ubuntu 18.04.

The basic syntax
syntax:
APT-GET [Options] the Command

Profile:
Early apt-get default profile for /etc/apt/apt.conf, but the current system default Ubuntu does not have this file.
If /etc/apt/apt.conf file exists, apt-get will still read it. But now the idea is to design the configuration files are placed in the rear partition /etc/apt/apt.conf.d directory, it is easier to manage.

Common options:

-h, --help // help documentation
-v, --version // see the apt-get version
-y // yes in response to needs identified in the scene
-s, --dry-run // execution and analog outputs
-d, --download-only // The package is downloaded to the cache without installing
--only-upgrade // update the current version of the package rather than installing a new version
--no-upgrade // when executing the install command, do not install the update installed packages
-q, --quiet // reduce output
--purge // with the remove command to remove the package configuration file
--reinstall // re-install or have installed a new version of the package

Common sub-command:
Update
Update command is used to resynchronize the package index file, / etc / apt / sources.list configuration file specifies the source of the package index file. Update the package index files after you can get updated information available package and the new package information. We have a local such information: What version of the software which can be from somewhere (source) installation.
update command should always be executed before the installation or upgrade package.

the install
the install command to install or upgrade package. Each package has a package name, rather than a fully qualified filename (e.g., the Debian system, parameters are provided apt-utils, instead apt-utils_1.6.1_amd64.deb). The packages are installed package depends will also be installed. /Etc/apt/sources.list configuration file contains the source (server) for obtaining the package. install command can also be used to update the specified package.

upgrade
upgrade command for the latest versions of all packages installed on the source system from the list of currently installed /etc/apt/sources.list. In any case, the currently installed packages will not be removed, not yet installed packages will not be retrieved and installed. Upgrading the case if the new version of the currently installed package can not be installed without changing the status of another package, and it will keep the current version. Update command must be executed in advance in order to know whether the apt-get package installed a new version is available.
Note the difference between update and upgrade:
update is to update the list of software, upgrade software is updated.

dist-upgrade
in addition to performing an upgrade functions, dist-upgrade also changes intelligently handle dependencies new version of the package with. apt-get has a "smart" conflict resolution system, if necessary, it will attempt to upgrade the most important packages at the expense of less important package for the price. Therefore, distr -upgrade command may remove some packages. Therefore, when the system update package, the following recommendations are sequentially executed commands:
$ APT-GET Update
$ APT-GET upgrade -Y
$ APT-GET-DIS upgrade -Y

the Remove
the Remove and install similar, except that instead of deleting the package installation package. Note that using a package will remove command to remove its configuration files remain on the system.

purge
purge command to remove a similar command, purge command to delete the package also removes the configuration files package.

autoremove
autoremove command is used to remove packages automatically installed, these packages had to satisfy dependencies of other packages it installed, and now no longer needed.

download
download command to download binary file specified package to the current directory. Note that this is similar to the * .deb package file.

Clean
Clean command clears retrieved in the local library package. It is from / var / cache / apt / archives / and / var / cache / apt / archives / partial / directory delete everything except lock files.

autoclean
similar clean command, autoclean command clears the local repository of retrieved package files. The difference is that it only can not delete the downloaded package file, and these files are largely useless. This allows long-Maintenance Cache, which is not the size of the out of control.

Source
Source packet command to download the source code. Default downloads the latest available version of the source code to the current directory.

ChangeLog
ChangeLog command attempts to download and display update log package.

Common usage

Our help documentation

$ apt-get -h

Update package index files

$ sudo apt-get update

Installation package

$ sudo apt-get install nginx

In response to needs identified in the scene yes
most of the package before installation requires interaction with the user, continue with the installation only after user confirmation. In automated tasks is no way to interact with the user. -y options can play a role in such a scenario, the effect is as if the user confirms the same installation operations:

$ sudo apt-get install -y nginx

Mounting system update packages

$ sudo apt-get update
$ sudo apt-get upgrade -y
$ sudo apt-get dis-upgrade -y

Reinstall installed packages
if we believe that a package is not working properly, you can try to re-install it, add --reinstall option for the install command on it. In addition, if installed packages with updates or new versions, you can also use this method to package upgrade to the latest version:

$ sudo apt-get install --reinstall curl

Updates the specified package
is rather strange that the update package is not actually specified by the upgrade command completed, but the use intall command Note: install command is:

$ sudo apt-get install vim

Simulation execution command and outputs the result
after applying the -s option does not actually execute the command, it will execute and analog outputs, such as the following example:

$ sudo apt-get update
$ sudo apt-get -s upgrade

After you add the -s option, upgrade command output to be updated software but it will not really perform the upgrade operation.

Check the version of a package
can view the version of the package has been installed or will install packages by the following command:

$ sudo apt-get -s install vim

The following is an example of an installed package:

The following is an example of a package is not installed:

Install the specified version of the package
Note that this refers to the version number of the package:

$ sudo apt-get install tree=1.7.0-5

把包下载到缓存中而不安装
选项 -d, --download-only 告诉命令只把包下载到缓存中而不安装它们,主要用在把下载包和安装包分开的场景,比如系统默认的自动化更新:

$ sudo apt-get install -d nginx
$ sudo apt-get upgrade -d
$ sudo apt-get dist-upgrade -d

删除包
remove 命令的特点是只删除程序文件,保留相关的配置文件:

$ sudo apt-get remove vim

如果要彻底清除包,可以使用 purge 命令,它会同时删除程序文件及其配置文件:

$ sudo apt-get purge vim

autoremove 命令用于删除自动安装的软件包,这些软件包当初是为了满足其他软件包对它的依赖关系而安装的,而现在已经不再需要了。因此在删除包后执行一下 autoremove 是个不错的选择:

$ sudo apt-get autoremvoe

清除系统中缓存的包安装文件
安装包的过程实际上是先把包安装文件下载到缓存目录,然后执行安装。久而久之系统中会存在大量无用的包安装文件,clean 命令可以清除这些缓存的包安装文件:

$ sudo apt-get clean

clean 命令从 /var/cache/apt/archives/ 和 /var/cache/apt/archives/partial/ 目录删除除锁文件之外的所有内容。

autoclean 命令与 clean 命令类似。不同之处在于,它只删除不能再下载的软件包文件,而且这些文件在很大程度上是无用的。这允许长时间维护缓存,而不至于大小失控:

$ sudo apt-get autoclean

在执行 remove 命令时使用 --purge 选项的效果等同于执行 purge 命令:

$ sudo apt-get remove --purge vim

在执行  install/remove 命令时使用 --autoremove 选项,可以同时删除无用的依赖包,类似在执行完  install/remove 命令后再执行一次 autoremove 命令:

$ sudo apt-get remove --autoremove vim

在执行 install/upgrade 命令时显示更详细的版本信息
通过 -V 选项,可以让 install/upgrade 命令输出包的具体版本,下面是默认的输出:

$ sudo apt-get upgrade -s

下面是添加 -V 选项后的输出:

$ sudo apt-get upgrade -V -s

减少输出
既然可以增加详细的输出信息,也可以灵活地使用 -q 选项来减少输出的信息:

$ sudo apt-get install  -q curl
$ sudo apt-get install  -q=2 curl

查看已安装包的更改日志
可以通过 changelog 命令来查看包的更新记录:

$ apt-get changelog tree

下载包的源代码(source code)
apt-get source 命令用来下载包的源代码。要让 apt-get source 命令起作用需要先更新 /etc/apt/sources.list 文件,添加 deb-src 配置,其实就是取消掉原本被注释掉的以 deb-src 开头的行。在 desktop 版的系统中,还可以通过  "Software & Updates" UI 来做同样的事情,在 "Ubuntu Software" 选项卡中选中 "Source code" 项即可:

Now and then execute the command apt-get source and specify the name of the package, you can download the source code for this package is the:

$ apt-get source tree

View version apt-get

$ apt-get -v

Shown here is actually apt, too wonderful work! Then look at:

The original apt-get, apt-cache and apt-config functions are provided by the apt command.

View update records system
log file records the update history /var/log/apt/history.log system. You can view it all through the installation performed by the command apt, upgrade, delete records:

$ less /var/log/apt/history.log

 

 

 

Guess you like

Origin www.cnblogs.com/kinwing/p/11829546.html
Recommended