Ubuntu Install and view installed
Description: Because of graphical interface methods (such as Add/remove ... and synaptic package Manageer) is relatively simple, so here is a summary of how the terminal packages are installed, uninstalled, and deleted through the command line.
First, the software installation method in Ubuntu
1. Apt mode
(1) General installation: Apt-get install softname1 softname2 ...;
(2) Repair installation: apt-get-f install softname1 softname2 ...;(-f atemp to correct broken dependencies)
(3) Reinstall: Apt-get--reinstall install softname1 softname2 ...;
2, Dpkg Way
(1) General installation: Dpkg-i Package_name.deb
3, source installation (. Tar, tar.gz, tar.bz2, tar. Z)
Unzip the source Tarball first and then complete it with the tar command.
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, it is recommended to read the Readme and other documents, because at this time 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 trailing sign of the * number.
Generally executed in turn./configure
Make
sudo make install
To complete the installation.
Second, the uninstall method of software package in Ubuntu
1. Apt mode
(1) Remove type unloading: Apt-get remove softname1 softname2 ...; (Remove the package, when the end of the package has +, meaning to install)
(2) Clear uninstall: Apt-get--purge remove softname1 softname2 ...;(also clear the configuration)
Clear uninstall: Apt-get purge sofname1 softname2 ...;(ditto, also clear config file)
2, Dpkg Way
(1) Remove type unloading: dpkg-r pkg1 pkg2 ...;
(2) Clear type unloading: dpkg-p pkg1 pkg2 ...;
Third, the query method of software package in Ubuntu
Dpkg uses a text file as a database. Commonly known in the /var/lib/dpkg
directory. The generic term stores the state of the software, and control information in the status file. In the info/directory, backup the control file, and in the. list file below it, record the installation file list under the. Mdasums Save File The MD5 encoding.
The time to experience using the database is:
Each record corresponds to a package, noting the first, two, three characters of each record. This is the status identifier of the package, followed by the package name, version number, and a simple description.
- The first character is expected, it includes:
- u status is unknown, which means that the package is not installed and the user has not issued an installation request.
- i user request to install package.
- r user requests to uninstall the package.
- p the user requests that the package be purged.
- 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.
- n package is not installed.
- i package installation and complete configuration.
- c package was previously installed and is now deleted, but its configuration files remain in the system.
- u package is unpacked, but not yet configured.
- f attempted to configure the package, but failed.
- h package installed, but did not succeed.
- The third column identifies the error state, which can be summarized in four states. The first state identifies no problem and is empty. The other three symbols identify the corresponding problem.
- The H package is enforced because other packages are dependent on requirements and cannot be upgraded.
- The R package is corrupted and may need to be reinstalled for normal use (including deletion).
- X soft packages are destroyed and are forced to remain.
You can also make fuzzy queries in wildcard mode, for example, I want to find all the packages that start with the nano character:
< Span style= "" >$ 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 is installed in the nano
version 1.3.10-2
nano-tiny
, installed, and then cleared; never installed nanoblogger
.
If you feel dpkg too many parameters, not conducive to memory, you can use Dpkg-query to dpkg database query.
Application Examples:
- files belonging to the nano in the query system:
$ dpkg--listfiles Nano
or
$ dpkg-query-l Nano
- to view more information about software Nano:
$ dpkg-s Nano
or
$ dpkg-query-s Nano
- to view the status of packages in the system, support fuzzy queries:
$ dpkg-l
or
$dpkg-query-l
- to view the attribution package for a file:
$ dpkg-query-s Nano
or
$ dpkg-s Nano
Iii. Summary of other applications
Apt-cache Search #------(Package Finder)
Apt-cache Show #------(package gets information about packages, such as description, size, version, etc.)
Apt-get Install #------(Package installer)
Apt-get Install #-----(Package--reinstall Reinstall packages)
Apt-get-f Install #-----(mandatory installation, "-F =--fix-missing" When it is a repair installation ...)
Apt-get Remove #-----(Package Delete pack)
Apt-get Remove--purge #------(Package delete packages, including delete profiles, etc.)
Apt-get autoremove--purge #----(Package delete package and its dependent packages + profiles etc (only valid for 6.10, highly recommended))
Apt-get Update #------Updating source
Apt-get Upgrade #------Update an installed package
Apt-get Dist-upgrade #---------Upgrade System
Apt-get Dselect-upgrade #------Upgrade with Dselect
Apt-cache depends #-------(package understands usage dependencies)
Apt-cache Rdepends #------(Package knows 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 downloads the source of the bundle)
Apt-get clean && apt-get AutoClean #--------Cleanup the archive of downloaded files && clean up outdated packages only
Apt-get Check #-------checking for corrupted dependencies
Dpkg-s filename-----Find out 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 the package name after the package is unpacked.
Dpkg-l--Lists all packages in the current system. Can be used with the parameter less in Split-screen viewing. (similar to RPM-QA)
Dpkg-l |grep-i "Package name"--View the package associated with the package name in the system.
Dpkg-s Query the details of the installed package.
Dpkg-l the location of installed packages in the query system. (similar to RPM-QL)
Dpkg-s queries the system for which package a file belongs to. (similar to RPM-QF)
Dpkg-i Query the details of the Deb package, after a package is downloaded to the local to see the use of the installation (look at the chant).
Dpkg-i Install the package manually (this command does not solve the dependency problem before the package), if you have a software package installed in the face of the problem, you can use the Apt-get-f install to solve the problem of trust.
Dpkg-r Uninstall the package. It is not completely uninstalled, and its configuration file still exists.
Dpkg-p all uninstall (but still not solve the dependency problem of the package)
Dpkg-reconfigure re-configuration
Apt-get Install
Download the package, as well as all dependent packages, while installing or upgrading the package. If a package is set to hold (stop flag, it will be placed on one side (i.e. it will not be upgraded). See below for more hold details.
Apt-get Remove [--purge]
Remove and any other packages that depend on the package.
--purge indicates that the package should be completely cleared (purged), see dpkg-p for more information.
Apt-get Update
Upgrade the list of packages from the Debian image, if you want to install any software on the day, run at least once a day, and each time you modify the
After/etc/apt/sources.list, it must be executed.
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 the dependency and needs to install a new package, it will not be upgraded, but is flagged as hold. Apt-get Update does not upgrade the package that is flagged as hold (this is the meaning of hold). See below how to manually set the package to hold. I recommend 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, it has a certain danger.
Apt-cache Search
In the package name and description, search for the package that contains XXX.
Apt-cache Show
Displays the complete description of a package.
Apt-cache showpkg
Show the package for more details, and the relationship to the other packages.
Dselect
Console-apt
Aptitude
Gnome-apt
Several graphical front ends of APT (some of which must be installed before use). Here Dselect is undoubtedly the most powerful, is also the oldest, the most difficult to control.
Common Dpkg Usage
Dpkg-i
Install a Debian package file, such as a file you manually downloaded.
Dpkg-c
The listed content.
Dpkg-i
Extract the package information from.
Dpkg-r
Remove a package that is already installed.
Dpkg-p
Completely clears an installed package. Unlike remove, remove just deletes the data and executable files, and purge also removes all the configuration files.
Dpkg-l
Lists all installed file listings. Also see Dpkg-c to check the contents of a. deb file.
Dpkg-s
Displays information about the installed package. Also see Apt-cache displays the package information in the Debian archive, as well as dpkg-i to display the package information extracted from a. deb file.
Dpkg-reconfigure
Re-configure an already installed package if it is using debconf (debconf provides a unified configuration interface for package installation). You can re-formulate debconf it itself, as you want to change its front end or ask for priority. For example, to re-configure the debconf, use a dialog front end and simply run:
Dpkg-reconfigure--frontend=dialog debconf (if you choose the wrong installation, you can change it back yo:)
echo "Hold" | Dpkg--set-selections
Set the status to Hlod (command line mode)
Dpkg--get-selections ""
Current state of the FETCH (command line mode)
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 to be 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 that the status flag is hold, it cannot be upgraded.
What if we 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 you can continue with the upgrade.
Comrades will ask, which of these status signs 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 signs are purge, don't be surprised.
such as: aMSN has been installed in advance, and then to unload it.
Apt-get Remove--purge amsn
Then the status flag is changed 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 in the package database and tell you which package contains the file. (Note: Looking for a package that has been installed beforehand)
--------------------------------------------
Debian Package management tool commands are not fully listed
--------------------------------------------
All package information in the Debian system is under/VAR/LIB/DPKG. The/var/lib/dpkg/info directory contains information and management files for each package. The function of each file is as follows:
A list of configuration files that end with ". Conffiles" for the package.
Files ending with ". List" Record the file list of the package, where the user can find the specific installation location of the package file.
The file ending with ". Md5sums" records the MD5 information for the verification of the package.
The file ending with ". config" is the installation configuration corner of the package.
The ". Postinst" Corner is a configuration that completes the Debian package, and is typically used to perform the restart of the commands and services associated with the installed package.
The ". Preinst" angle is run before the Debain unpacking, and the main effect is to stop the package service that is about to be upgraded until the package installation or upgrade is complete.
The ". Prerm" script is responsible for stopping the daemon service associated with the package and executing it before deleting the package association file.
The ". Postrm" script is responsible for modifying the package link or file association, or deleting the file created by it.
/var/lib/dpkg/available is a description of the package.
Includes all packages from 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 the package. It is not completely uninstalled, and its configuration file still exists.
dpkg--info "Package name"--Lists the package name after the package is unpacked.
Dpkg-l--Lists all packages in the current system. Can be used with the parameter less in Split-screen viewing.
Dpkg-l |grep-i "Package name"--View the package associated with the package name in the system.
Dpkg-s Query the details of the installed package. Dpkg-l the location of installed packages in the query system.
Dpkg-s queries the system for which package a file belongs to.
Dpkg-i Query the details of the Deb package, after a package is downloaded to the local to see the use of the installation (look at the chant).
Dpkg-i Install the package manually (this command does not solve the dependency problem before the package), if you have a software package installed in the face of the problem, you can use the Apt-get-f install to solve the problem of trust.
Dpkg-reconfigure re-configuration
Dpkg-p all uninstall (but still not solve the dependency problem of the package)
(1) GTK Graphics" Synaptic ", this is the front-end tool for Apt.
(2) "aptitude", which is also the front-end tool for Apt.
with APT management tools for package management, there are several ways to do the source:
(1) Take the installation disk as the source, the method is as follows:
apt-cdrom ident Scanning disc information
apt-cdrom add Add Disc source
(2) This is also the most common way to add the source to/etc/apt/source.list, and then update the column apt-get update
APT Management tools Common commands
Apt-cache plus the use of different sub-commands and parameters can be implemented to find, display software, package information and package trust relationship and other functions.
Apt-cache Stats displays statistics about all debain data sources used by the current system.
Apt-cache Search + "package name" to find the relevant package.
Apt-cache Show + "package name" to display details of the specified package.
Apt-cache depends + "package name", you can find dependencies for packages.
Apt-get Upgrade Update All packages in the system to the latest version
Apt-get Install Package
Apt-get--reindtall Install Reinstall package
Apt-get Remove Uninstall Package
Apt-get--purge Remove Full Uninstall Package
Apt-get clean cleanup of useless packages
Before using the command Apt-get install, the package is downloaded to/var/cache/apt/archives before installation. So we can use apt-get clean to clear the/var/cache/apt/ Packages in the Archives directory.
SOURCE Package Installation
Apt-cache showsrc Look up the file information of the source package (before downloading)
Apt-get source Download Source package.
Apt-get BUILD-DEP + "package name" builds the source package's compilation environment.
Clear the software package in the RC state
Dpkg-l |grep ^rc|awk ' {print $} ' |tr ["\ n"] [""] | sudo xargs dpkg-p-
Ubuntu security loading and viewing installed software