Ubuntu install, uninstall, and view installed software

Source: Internet
Author: User
Tags bz2 pack unpack

Original address: http://www.cnblogs.com/forward/archive/2012/01/10/2318483.html

Description: Because of graphical interface method (such as Add/remove ... and synaptic Package Manageer) is relatively simple, so here is a summary of the terminal through the command-line approach to the installation, uninstall and removal of software packages.

Software Installation method in Ubuntu

1, Apt Way

(1) Ordinary installation: Apt-get install softname1 softname2 ...;

(2) Repair installation: apt-get-f install softname1 softname2 ...;(-f atemp to correct broken)

(3) Reinstall: Apt-get--reinstall install softname1 softname2 ...;

2, Dpkg Way

(1) General installation: Dpkg-i Package_name.deb

3, the source code installation (. Tar, tar.gz, tar.bz2, tar. Z)

First unzip the source compression package and then through the TAR command to complete

A Solution Xx.tar.gz:tar ZXF xx.tar.gz
b Solution Xx.tar.z:tar ZXF Xx.tar.z
C Solution Xx.tgz:tar ZXF Xx.tgz
D Solution Xx.bz2:bunzip2 xx.bz2
E Solution Xx.tar:tar XF Xx.tar

Then go to the extracted directory, we recommend that you read the Readme and so on, because there is no homologous code package or precompiled package may be different, and then recommend the use of ls-f--color or LS-F command (in fact, I only need the L command) to view the executable file, The executable file will be marked with the tail of the * number.

Generally executed sequentially./configure

Make

sudo make install

You can complete the installation.

Second, the software package in Ubuntu Uninstall method

1, Apt Way

(1) Removal uninstall: Apt-get remove softname1 softname2 ...; (Removal of packages, when the tail of the package is +, intended to install)

(2) Clear uninstall: Apt-get--purge remove softname1 softname2 ...;(clear configuration at the same time)

Purge Uninstall: Apt-get purge sofname1 softname2 ...;(ditto, also clear configuration file)

2, Dpkg Way

(1) Removal uninstall: Dpkg-r pkg1 pkg2 ...;

(2) Clear uninstall: Dpkg-p pkg1 pkg2 ...;

Third, the software package in Ubuntu Query method

Dpkg uses a text file as a database. The generic term is in the/var/lib/dpkg directory. A generic term for storing software state and controlling information in the status file. Back up the control file in the info/directory, and record the installation file list under the. mdasums file, under the. MD5 encoding of the file.

It's time to experience using a database:

$ dpkg-l Desired=unknown/install/remove/purge/hold | Status=not/installed/config-files/unpacked/failed-config/half-installed |/err?= (none)/Hold/Reinst-required/X= Both-problems (Status,err:uppercase=bad) | | /Name Version Description +++-===========-================-======================================== II AALIB1 1.4P5-28 ASCII Art library-transitional Package II AddUser 3.85 ADD and remove users and groups Ii. alien Install -native Packages with dpkg ... 

Each record corresponds to a package, paying attention to the first, two, three characters of each record. This is the status identification of the package, which is the package name, version number, and a simple description. The first character is expected, which includes: U state is unknown, which means that the package is not installed and the user has not issued the installation request. I user requests installation package. R user requests Uninstall package. P user requests to clear the package. H user requests to keep package version locked. The second column is the current state of the package. This column includes the six states of the package. The n package is not installed. I package installs and completes the configuration. The C package was previously installed and is now deleted, but its configuration file remains in the system. The U package was unpack but not yet configured. F attempted to configure the package, but failed. H package installation, but not successful. The third column identifies the error state and can be summed up in four states. The first status identification is not a problem and is empty. The other three kinds of symbols identify the corresponding problem. The H package is enforced because there are other packages that depend on the requirements and cannot be upgraded. The R package is corrupted and may need to be reinstalled for normal use (including deletion). The X Soft package is damaged and is forced to remain.

You can also do fuzzy queries in wildcard mode, such as I'm looking for all packages starting with the Nano character:

$ dpkg-l nano* Desired=unknown/install/remove/purge/hold | Status=not/installed/config-files/unpacked/failed-config/half-installed |/err?= (none)/Hold/Reinst-required/X= Both-problems (Status,err:uppercase=bad) | | /Name Version Description +++-==============-==============-============================================ II Nano 1.3.10-2 free Pico clone with some new features PN Nano-tiny <none> (no description available) UN nanoblogger <no Ne> (no description available) 

The above status Description: The system installed Nano version for 1.3.10-2, installed Nano-tiny, and then cleared; Nanoblogger has never been installed.

If you feel dpkg too many parameters, is not conducive to memory, you can use Dpkg-query for dpkg database query.

Application Example: A file in the query system that is Nano: $ dpkg--listfiles Nano or $ dpkg-query-l nano View software Nano Details: $ dpkg-s Nano or $ dpkg-query-s nan O View package status in the system, support Fuzzy query: $ DPKG-L or $dpkg-query-l view the ownership package for a file: $ dpkg-query-s nano or $ dpkg-s nano

Iii. Summary of other applications

Apt-cache Search #------(Package searching package)
Apt-cache Show #------(Package get information about the package, such as description, size, version, etc.)
Apt-get Install #------(Package installation package)
Apt-get Install #-----(Package--reinstall Reinstall package)
Apt-get-f Install #-----(Forced installation, "-F =--fix-missing" when repairing installation bar ...)
Apt-get Remove #-----(Package Delete package)
Apt-get Remove--purge #------(Package delete packages, including deleting profiles, etc.)
Apt-get autoremove--purge #----(Package delete packages and their dependent packages + configuration files (valid for 6.10, strongly recommended))
Apt-get Update #------Updates Source
Apt-get Upgrade #------Update installed Packages
Apt-get Dist-upgrade #---------Upgrade System
Apt-get Dselect-upgrade #------Use Dselect Upgrade
Apt-cache depends #-------(Package understand usage dependencies)
Apt-cache Rdepends #------(Package understand a specific dependency when it is to see which packages are dependent on it ...)
Apt-get BUILD-DEP #------(Package Installation-related compilation environment)
Apt-get Source #------(package download the source code for the package)
Apt-get clean && apt-get AutoClean #--------cleans up archive of downloaded files && only cleans obsolete packages
Apt-get Check #-------checking for corrupted dependencies
Dpkg-s filename-----Find which package filename belongs to
Apt-file Search filename-----Find out which package filename belongs to
Apt-file List PackageName-----List The contents of the package
Apt-file Update--Updating the Apt-file database

dpkg--info "Package Name"-Lists package names after package unpack.
Dpkg-l-Lists all packages in the current system. Can be used with the parameter less to view in a split screen. (similar to RPM-QA)
Dpkg-l |grep-i "Package name"--View the package associated with the package name in the system.
Dpkg-s queries the details of the installed package.
DPKG-L queries the installed location of the installed packages in the system. (similar to RPM-QL)
Dpkg-s query which package a file belongs to in the system. (similar to RPM-QF)
Dpkg-i Query Deb Package details, after a package download to the local to see the use of the installation (see).
Dpkg-i Manually install the package (this command does not solve the dependency problem before the package), if you encounter a software dependency problem when installing a package, you can use apt-get-f install to solve the problem of trust.
Dpkg-r Uninstall package. It is not a full uninstall and its configuration file still exists.
Dpkg-p Uninstall all (but still cannot solve the problem of the dependencies of the package)
Dpkg-reconfigure reconfiguration


Apt-get Install
Download packages, and all dependent packages, while installing or upgrading packages. If a package is set to hold (stop flag, it will be put on one side (that is, it will not be upgraded). More hold details please look below.
Apt-get Remove [--purge]
Remove and any other packages that depend on the package.
--purge indicates that the package should be completely cleared (purged), please see dpkg-p for more information.

Apt-get Update
Upgrade the list of packages from a Debian mirror, and if you want to install any software for the day, run it at least once a day, and each time you modify the
After/etc/apt/sources.list, it must be performed.

Apt-get upgrade [-u]
Upgrade all installed packages to the latest available version. New or removed old packages are not installed. If a package changes dependencies and requires a new package to be installed, it will not be upgraded, but rather marked as hold. Apt-get update does not upgrade packets that are flagged as hold (this is the meaning of hold). See below how to manually set the package to hold. I suggest using the '-u ' option at the same time, because you can see which packages will be upgraded.

Apt-get Dist-upgrade [-u]
Similar to Apt-get upgrade, except that Dist-upgrade installs and removes packages to satisfy dependencies. Therefore, there is a certain danger.

Apt-cache Search
In the package name and description, search for packages that contain XXX.

Apt-cache Show
Displays a complete description of a package.

Apt-cache showpkg
Displays more details about the package, as well as relationships with other packages.

Dselect
Console-apt
Aptitude
Gnome-apt
APT's several graphical front ends (some of which must be installed before use). Here Dselect is undoubtedly the most powerful, is also the oldest, the most difficult to master.

Common Dpkg Usage
Dpkg-i
Install a Debian package file, such as the one you downloaded manually.

Dpkg-c
The contents listed.

Dpkg-i
Extract package information from.

Dpkg-r
Remove an installed package.

Dpkg-p
Completely clears an installed package. Unlike remove, remove only deletes data and executable files, purge also removes all configuration files.

Dpkg-l
Lists all the files that are installed. Also, see Dpkg-c to check the contents of a. deb file.

Dpkg-s
Displays information about the package that was installed. Also, see Apt-cache display package information in the Debian archive and dpkg-i to display package information extracted from a. deb file.

Dpkg-reconfigure
Reconfigure an already installed package if it is using debconf (debconf provides a uniform configuration interface for package installation). You can reconfigure debconf itself, such as you want to change its front end or ask for priority. For example, to reconfigure the debconf, use a dialog front-end, and simply run:

Dpkg-reconfigure--frontend=dialog debconf (if you choose the wrong installation, this can be changed back yo:)

echo "Hold" | Dpkg--set-selections
The state of the setting is Hlod (command line)

Dpkg--get-selections ""
The current state of the Fetch (command line method)

Wildcard characters are supported, such as:
debian:~# dpkg--get-selections *wine*
Libwine hold
Libwine-alsa hold
Libwine-arts hold
Libwine-dev hold
Libwine-nas hold
Libwine-print hold
Libwine-twain hold
Wine hold
Wine+ hold
Wine-doc hold
Wine-utils hold

For example:
Everyone is now using gaim-0.58 + Qq-plugin, in order to prevent Gaim from being upgraded, we can use the following methods:

Method One:
debian:~# echo "Gaim hold" | Dpkg--set-selections
Then use the following command to check:
debian:~# dpkg--get-selections "Gaim"
Gaim hold
Now the status of the flag is hold, can not be upgraded.

What if you want to recover?
debian:~# echo "Gaim Install" | Dpkg--set-selections
debian:~# dpkg--get-selections "Gaim"
Gaim Install
The status flag is then reset to install and can continue to be upgraded.

Comrades will ask, which of these status symbols are written in which file?
In/var/lib/dpkg/status, you can also implement hold by modifying this file.

Sometimes you will find that some software status symbol is purge, don't be surprised.
For example: aMSN has been installed in advance and then unloaded.
Apt-get Remove--purge amsn
Then the status symbol changes from install to purge.

Method Two:
Manually build a preferences file under/etc/apt
Content:
Package:gaim
Pin:version 0.58*
Save

Dpkg-s
Look it up in the package database and tell you which package contains the file. (Note: Looking for a previously installed package)

--------------------------------------------
Debian Package management tool command incomplete list
--------------------------------------------
All package information in the Debian system is under/var/lib/dpkg. The information and management files of each package are saved in the/var/lib/dpkg/info directory. The function of each file is as follows:
The list of configuration files for the package that ends with ". Conffiles".
The file list of the package is recorded in the file at the end of ". List", where the user can find the specific installation location of the package file.
The MD5 information is recorded in a file that ends with ". Md5sums" and is used for packet validation.
The file that ends with ". config" is the installation configuration corner book for the package.
The ". Postinst" Corner is the configuration work after the Debian package has been unpacked and is typically used to perform a reboot of the commands and services associated with the installed package.
The ". Preinst" Corner is run before Debain unpack, primarily to stop the package services that are about to be upgraded until package installation or upgrade is complete.
The ". Prerm" script is responsible for stopping the daemon service associated with the package and executing before deleting the package associated file.
The ". Postrm" script is responsible for modifying a package link or file association, or for deleting a file created by it.

/var/lib/dpkg/available is the description information for the package.
Includes all packages in the Debian installation source used in the current system, and includes packages that are already installed and not installed on the current system.

1.DPKG Package Management Tools

Dpkg-r Uninstall package. It is not a full uninstall and its configuration file still exists.
dpkg--info "Package Name"-Lists package names after package unpack.
Dpkg-l-Lists all packages in the current system. Can be used with the parameter less to view in a split screen.
Dpkg-l |grep-i "Package name"--View the package associated with the package name in the system.
Dpkg-s queries the details of the installed package. DPKG-L queries the installed location of the installed packages in the system.
Dpkg-s query which package a file belongs to in the system.
Dpkg-i Query Deb Package details, after a package download to the local to see the use of the installation (see).
Dpkg-i Manually install the package (this command does not solve the dependency problem before the package), if you encounter a software dependency problem when installing a package, you can use apt-get-f install to solve the problem of trust.
Dpkg-reconfigure reconfiguration
Dpkg-p Uninstall all (but still cannot solve the problem of the dependencies of the package)


2. Apt Advanced package management tool
   (1) GTK graphics "synaptic", which is apt's front-end tool.
   (2) "aptitude", which is apt's front-end tool.
   with APT management tools for package management, there are several ways to do the source:
   (1) Take the installation disk to do the source, the following methods:
         Apt-cdrom ident        scan disc Information
         Apt-cdrom add          Add disc source
   (2) This is also the most common method is to add the source to the/etc/apt/source.list, and then update the column Apt-get update


APT Management tools Common commands
Apt-cache plus the use of different subcommand and parameters can be used to find, display software, packet information and packet trust relationships and other functions.
Apt-cache Stats displays statistics for all the Debain data sources used by the current system.
Apt-cache Search + "package name", you can find the relevant software package.
Apt-cache Show + package name to display detailed information for the specified package.
Apt-cache depends + package name to find the dependencies of the package.
Apt-get Upgrade Update All packages in the system to the latest version
Apt-get Install installation package
Apt-get--reindtall Install Reinstall package
Apt-get Remove Uninstall Package
Apt-get--purge Remove Full Uninstall Package
Apt-get Clean eliminates unwanted packages
Before you apt-get install with the command, you download the package to the/var/cache/apt/archives before you install it. So we can use apt-get clean to clear the/var/cache/apt/ Packages in the Archives directory.


Source Pack Installation
Apt-cache SHOWSRC Find the file information for the source pack (before downloading)
Apt-get source Download Source package.
Apt-get BUILD-DEP + "package name" to build the compilation environment for the source package.

To clear a package that is in the RC state

Dpkg-l |grep ^rc|awk ' {print $} ' |tr [' \ n '] ['] | sudo xargs dpkg-p-forward.molly. Treasure Son walk Alone

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.