Usage of apt-get commands in ubuntu

Source: Internet
Author: User


Apt-get Command Introduction

Apt-get is a linux command, applicable to deb package-managed operating systems. It is mainly used to automatically search, install, upgrade, and uninstall software or operating systems from the software warehouse on the Internet.

Apt-get command usage

1. deb package installation:

Install the. deb package:

Code: sudo dpkg-I package_file.deb


Uninstalling the. deb package:

Code: sudo dpkg-r package_name


2. Installation using apt-get:
Install

Code: sudo apt-get install package_name


Reverse installation

Code: sudo apt-get remove package_name

Common apt-get commands

APT command parameters used:

Apt-cache search package

Apt-cache show package obtains package information, such as description, size, and version.

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

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"

Set http proxy for apt-get

You can set http proxy for apt-get in three ways.

Method 1

This is a temporary method. If you only need to use apt-get through http proxy temporarily, you can use this method.
Before using apt-get, enter the following command in the terminal (replace yourproxyaddress and proxyport according to your actual situation ).

The code is as follows: Copy code
Export http_proxy = http: // yourproxyaddress: proxyport

Method 2

This method requires the apt. conf file in the/etc/apt/folder. If you want apt-get (instead of other applications) to always use http proxy, you can use this method.
Note: In some cases, the apt configuration file is not created during system installation. The following operations modify the existing configuration file or create a new configuration file as needed.

The code is as follows: Copy code
Sudo gedit/etc/apt. conf

Add the following line to your apt. conf file (replace yourproxyaddress and proxyport according to your actual situation ).

The code is as follows: Copy code
Acquire: http: Proxy "http: // yourproxyaddress: proxyport ";

Save the apt. conf file.

Method 3

This method adds two lines to the. bashrc file in your home directory. If you want apt-get and other applications such as wget to use http proxy, you can use this method.

The code is as follows: Copy code
Gedit ~ /. Bashrc

Add the following content at the end of your. bashrc file (replace yourproxyaddress and proxyport according to your actual situation ).

The code is as follows: Copy code
Http_proxy = http: // yourproxyaddress: proxyport
Export http_proxy

Save the file. Close the current terminal and then open another terminal.
Use apt-get update or any network tool you want to use to test the proxy. I use firestarter to view active network connections.
If you modify the configuration file again to correct the error, close the terminal and open it again.

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.