How to install, uninstall, and manage packages under the "Go" ubuntu command line

Source: Internet
Author: User
Tags bz2

Original URL: http://oss.org.cn/html/47/n-67447.html

One UbuntuSoftware Installation Method 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 in Stall softname1 softname2 ...; 2, dpkg mode (1) General installation: Dpkg-i package_name.deb3, source installation (. Tar, tar.gz, tar.bz2, tar. Z) First unzip the source tarball and then complete a with the tar command. 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 and then into 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 (actually I only need l command) to view the executable file, the executable file will be marked with the tail of the * number. General execution ./configure                      make   &nbsp ;                 The sudo make install to complete the installation. Second, the uninstall method of the software package in Ubuntu 1, Apt mode (1) Removal uninstall: Apt-get remove softname1 softname2 ...; (Remove 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 ...;(ibid., also clear profile) 2, dpkg mode (1) Remove uninstall: Dpkg-r pkg1 pkg2 ...; (2) Clear type unloading: dpkg-p pkg1 pkg2 ...;   The Query method of software packages in Ubuntu dpkg use text files as database . Commonly known in the/var/lib/dpkg directory. The generic term stores the state of the software and controls information in the status file. Back up the control file under the info/directory and record the list of installation files under the. list file under the. Mdasums Save the MD5 encoding of the file. Time to experience using the database: $ dpkg-ldesired=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         &NBSP;ASCII Art Libr Ary-transitional packageii  adduser    3.85              add and Remov E Users and Groupsii  alien      .63               Install Non-nati ve packages with dpkg ... ...   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, which includes: U state is unknown, which means that the package is not installed and the user has not issued an installation request. User request to uninstall softwarePackage. P user requests that the package be purged. h the user requests to keep the package version locked. The second column is the current state of the package. This column includes the six states of the package. The package is not installed. The C package was installed and is now removed, but its configuration file is still in the system. The package was unpacked but not yet configured. F tried to configure the package, but failed. h package installation, but no success. 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 problem. h packages are 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 the wildcard pattern. For example, I want to find 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     & nbsp Free Pico clones with some new featurespn  nano-tiny      <none>         (no Description available)    un  nanoblogger    <none>   &NBSP     (no description available)    The above status Description: The system installed the nano version of 1.3.10-2, installed Nano-tiny, and then cleared; Nanoblogger has never been installed. If you feel dpkg too many parameters, not conducive to memory, you can use the Dpkg-query to dpkg database query. Application Example: Querying files belonging to the Nano in the system: $ dpkg--listfiles nanoor$ Dpkg-query-l Nano View software Nano Details: $ dpkg-s nanoor$ dpkg-query-s Nano View System Package status, Support Fuzzy query: $ dpkg-lor$dpkg-query-l View the attribution of a file Package: $ dpkg-query-s nanoor$ dpkg-s Nano III, other applications summary Apt-cache Search #------(Package search pack) Apt-cache Show #------(package acquisition of related letters (such as description, size, version, etc.) apt-get Install #------(Package Install pack) apt-get Install #-----(Package--reinstall Reinstall pack) 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 packages and their dependent packages + profiles (only valid for 6.10, highly recommended)) Apt-get Update #------updating source Apt-get Upgrade #------Update installed packages Apt-get Dist-upgrade #---------Upgrade System Apt-get Dselect-upgrade #------Use Dselect upgrade Apt-cache depends #-------(package understands use dependency) 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 #------(packages download the source code for the bundle) Apt-get clean && apt-get aut Oclean #--------Clean up the archive of downloaded files && only clean up outdated packages apt-get Check #-------Checks if there is a corrupted dependent dpkg-s filename----- Find out which package filename belongs to apt-file search filename-----Find out which package the filename belongs to apt-file list PackageName-----List The contents of the package Apt-file Update--Updates apt-file database  dpkg--info "package name"--lists package names after package unpacking. 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 that is associated with the package name in the system. Dpkg-s query the details of the installed package. Dpkg-l Query the location of installed packages installed in the system. (similar to RPM-QL) dpkg-s query the system for which package a file belongs to. (similar to RPM-QF) dpkg-i query the details of the Deb package, and after a package has been downloaded to the local, take a look at the installation (look at it). Dpkg-i Install the package manually (this command does not solve the dependency problem before the package), If you encounter software dependencies when installing a package, you can use apt-get-f install to solve the problem of reliability. Dpkg-r Uninstall the package. It is not completely uninstalled, and its configuration file still exists. Dpkg-p All Uninstall ( However, it is still not possible to resolve the dependencies of the package) Dpkg-reconfigure reconfigure the   apt-get install download 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] divideAnd 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 upgrades 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 must be executed after each modification of/etc/apt/sources.list.  apt-get upgrade [-u] upgrades 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] and Apt-get upgrade are similar 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, find the package containing XXX.  apt-cache Show shows the complete description of a package.  apt-cache showpkg shows more details about the package, as well as relationships with other packages. Several graphical front ends of the  dselectconsole-aptaptitudegnome-aptapt (some of which need to be installed before use). Here Dselect is undoubtedly the most powerful, is also the oldest, the most difficult to control.   General Dpkg Usage Dpkg-i Install a Debian package file, such as a file you manually downloaded.  dpkg-c the contents listed. The  dpkg-i extracts the package information from it.  dpkg-r removes an installed package.  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. &NBSP;DPKG-L Lists all installed file listings. Also see Dpkg-c to check the contents of a. deb file. &NBSP;DPKG-S displays information about the installed package. Also see Apt-cache shows the package information in the Debian archive, as well as dpkg-i to show from A. DebThe package information that is extracted from the file.  dpkg-reconfigure to reconfigure 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, re-debconf, using a dialog front-end, simple to 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)  dpkg--get-selections "" The Current state (command line)   Support wildcard characters, such as: debian:~# dpkg-- Get-selections *wine*libwine holdlibwine-alsa holdlibwine-arts holdlibwine-dev holdlibwine-nas holdlibwine-print Holdlibwine-twain holdwine holdwine+ holdwine-doc holdwine-utils hold  For example: Everyone is now using gaim-0.58 + Qq-plugin, in order to prevent Gaim Be upgraded, we can use the following method:  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 on, can not be upgraded.   What if we want to recover? debian:~# echo "Gaim Install" | dpkg--set-selectionsdebian:~# dpkg--get-selections "Gaim" Gaim install then the status flag is reset to install, you can continue to 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'll find that there are software status labelsZhi is 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 content under/etc/apt: Package:gaimPin:version 0.58* Save  dpkg-s in the package database and tell you which package contains the file. (Note: Look for packages that have been installed beforehand)  -------------------------------------------- The Debian Package management tool commands are not fully listed--------------------------------------------all package information in the Debian system is under/var/lib/dpkg. where/var/lib/ The Dpkg/info directory holds information and management files for each package. Each file functions as follows: A list of the configuration of the file record package with ". Conffiles"     end. ". List"           At the end of the file lists the package file, where the user can find the specific installation location of the package file. Files with ". Md5sums"       are documented with MD5 information used for verification of the package. with ". Config "        End of file is the installation configuration corner of the package.". Postinst "     , this is the configuration after the Debian package has been unpacked, Typically used to perform a restart of the commands and services associated with the installed package. with ". Preinst"       Debain before unpacking, the main effect is to stop the package service from being upgraded until the package installation or upgrade is complete. Prerm "        script is responsible for stopping the daemon service associated with the package and executing it before deleting the package associated file.". Postrm "        The script is responsible for modifying the package link or file association, or deleting the file created by it.  /var/lib/dpkg/available isDescription of the package. Includes all packages from all Debian installations used in the current system, including packages installed and not installed on the current system .         &NBSP;1.DPKG package management tools dpkg -R Uninstall the package. Not a full uninstall, its configuration file also exists. dpkg--info "package name"--lists package names after package unpacking. 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   Query the installed location of the installed packages in the system. Dpkg-s   Query the system for which package the file belongs to. dpkg-i   Query The details of the Deb package, after a package has been downloaded to the local to see if you need to install it (take a look) . dpkg-i Install the package manually (this command does not solve the dependency problem before the package), if you have encountered a software dependency problem when installing a package, you can use apt-get-f install to solve the problem of reliability. dpkg-reconfigure Reconfigure  dpkg-p all uninstall (but still not solve the problem of dependency of package)   2. APT Advanced package management tools    (1) GTK Graphical "synaptic", which is apt's front-end tool .   (2) "aptitude", which is also APT's front-end tool .   the management of packages with APT management tools, can be used in the following ways to do the source:    (1) Take the installation disk as the source, the method is as follows:        apt-cdrom ident         scanning disc information    & nbsp    apt-cdrom add           Add disc source    (2) This is also the most common way to add the source to the/etc/apt/ Source.list, after the update column Apt-get UPDATE&NBSP;APT management tools commonly used commands Apt-cache plus the use of different subcommands and parameters can be implemented to find, display software, package information and package trust relationships and other functions. Apt-cache stats Displays statistics for all debain data sources used by the current system. Apt-cache Search + "package name" to find related packages. Apt-cache show   + package name to display details of the specified package. Apt-cache Depends + "package name", you can 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 installed Reinstall Package Apt-get Remove Uninstall Package Apt-get--purge Remove full Uninstall Package Apt-get clean clear useless package download the package to Apt-get before using the command/var/install Cache/apt/archives, then install it later. So we can use apt-get clean to clear the/var/cache/apt/archives directory package .  source package installation    Apt-cache showsrc Look up the source package file information (before downloading)    apt-get source Download source Package .   Apt-getBUILD-DEP + "Package name" build source package compilation Environment .  clear the RC State package dpkg-l |grep ^rc|awk ' {print $} ' |tr ["\ n"] ["] | sudo xargs dpkg-p-

Go to the Ubuntu command line to install, uninstall, and manage packages

Related Article

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.