Ubuntu software package installation and uninstallation commands

Source: Internet
Author: User
Tags bz2

I. Package installation commands

Install software in. bin format./test. bin (run)

Install software in the. deb format (install to the specified directory) dpkg-I aa. deb-instdir = Directory

Apt-get install online software installation such as apt-get install vsftpd

Dpkg-r aa. deb uninstall software

Dpkg-l aa. deb uninstall the software (the configuration file is not retained)

2. Some software installation examples

1. Install software in Ubuntu
1. APT mode
(1) General installation: apt-get install softname1 softname2 ...;
(2) fix and install: apt-get-f install softname1 softname2.... (-f Atemp to correct broken dependencies)
(3) reinstall: apt-get -- reinstall install softname1 softname2 ...;
2. Dpkg mode
(1) General installation: dpkg-I package_name.deb
3、source code installation (.tarw.tar.gz?tar.bz2, tar. Z)
Decompress the source code package and run the tar command.
A. xx.tar.gz: tar zxf xx.tar.gz
B. xx.tar. Z: tar zxf xx.tar. Z
C. Solution xx. tgz: tar zxf xx. tgz
D. xx.bz2: bunzip2 xx.bz2
E. xx.tar: tar xf xx.tar
Then go to the decompressed Directory. We recommend that you read the instructions files such as README first, because there may be differences between different source code packages or pre-compiled packages, we recommend that you use the 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 sign.
Execute./configure in sequence.
Make
Sudo make install
To complete the installation.
II. How to uninstall the software package in Ubuntu
1. APT mode
(1) detachable upon removal: apt-get remove softname1 softname2 ...; (Remove the software package. When + exists at the end of the package, it indicates installation)
(2) clear uninstall: apt-get -- purge remove softname1 softname2. .. (clear configuration at the same time)
Clear uninstall: apt-get purge sofname1 softname2. .. (same as above, also clear the configuration file)
2. Dpkg mode
(1) detachable: dpkg-r pkg1 pkg2 ...;
(2) cleanup unload: dpkg-P pkg1 pkg2 ...;
 
III. Query methods of software packages in Ubuntu
Dpkg uses text files as databases. the general name is in the/var/lib/dpkg directory. the general name stores the software status and control information in the status file. back up the control file in the info/directory and. the list file records the list of installation files, under which. mdasums stores the MD5 code of the file.
It's time to experience using the 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. 63 install non-native packages with dpkg
......

 


Each record corresponds to a software package. Note the first, second, and third characters of each record. This is the status identification of the software package, followed by the software package name, version number, and simple description.
The first character is the expected value, which includes:
The u status is unknown, which means that the software package is not installed and the user has not sent an installation request.
I. The user requested to install the software package.
R user requests to uninstall the software package.
P User request to clear the software package.
H. The user requests to keep the software package version locked.
The second column is the current status of the software package. This column includes six states of the software package.
N software package not installed.
Install the I software package and complete the configuration.
The c package has been installed before and is deleted, but its configuration file remains in the system.
The u software package is unwrapped, but not configured yet.
F tried to configure the software package, but failed.
H software package installation, but not successful.
The third column identifies the error status, which can be summarized as four states. The first type of status identity is normal and empty. The other three symbols identify the problem.
The h software package is forcibly maintained because it cannot be upgraded due to dependency requirements of other software packages.
The r package is damaged and may need to be re-installed for normal use (including deletion ).
X soft package is damaged and forcibly maintained.
You can also perform fuzzy search in the unified character mode. For example, I want to find all the software packages starting with nano:
$ 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 <none> (no description available)

 


The above status description: nano version 1.3.10-2 is installed in the system, nano-tiny is installed, and then deleted. nanoblogger is never installed.
If you think that too many dpkg parameters are difficult to remember, you can use dpkg-query to query the dpkg database.
Example:
Nano files in the query system:
$ Dpkg -- listfiles nano
Or
$ Dpkg-query-L nano
View the software nano details:
$ Dpkg-s nano
Or
$ Dpkg-query-s nano
Check the status of software packages in the system. Fuzzy search is supported:
$ Dpkg-l
Or
$ Dpkg-query-l
View the owner package of a file:
$ Dpkg-query-S nano
Or
$ Dpkg-S nano


Some common apt command parameters (for more information, see the help documentation ):

Apt-cache search package
Apt-cache show package obtains package information, such as description, size, and version.
Sudo apt-get install package installation package
Sudo apt-get install package--reinstall re-installation package
Sudo apt-get-f install fix and install "-f =-fix-missing"
Sudo apt-get remove package Delete package
Sudo apt-get remove package--purge delete a package, including deleting a configuration file.
Sudo apt-get update source
Sudo apt-get upgrade updates installed packages
Sudo apt-get dist-upgrade system
Sudo apt-get dselect-upgrade using dselect
Apt-cache depends package for dependency usage
Apt-cache rdepends package is used to check which packages are dependent on this package.
Sudo apt-get build-dep package installation-related compilation environment
Apt-get source package download the source code of the package
Sudo apt-get clean & sudo apt-get autoclean clear useless packages
Sudo apt-get check whether any corrupted dependency exists

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.