Linux Apt-get appears "no Public key available ..." solution

Source: Internet
Author: User


As we all know, Linux is higher than the safety factor of windows, but it is a good habit to update it frequently (at least recently, a lot of security vulnerabilities about SSL deserve attention!). , but when running Apt-get update refresh source under Ubuntu and Debian, you often encounter the problem of "There is no public key available for the following key IDs," as shown in the following error Tips:

W:there is no public key available for the following key Ids:3b4fe6acc0b21f32,
W:there is no public key available for the following key Ids:3b4fe6acc0b21f32,

The solution is as follows,

sudo apt-key adv--recv-keys--keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32

Additional, if has the following question, is because joins the natty-backports source, deletes can

w:failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/main/source/Sources 404 Not Found [IP: 91.189.91.13 80],
w:failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/restricted/source/Sources 404 Not Found [ IP:91.189.91.13 80],
w:failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/universe/source/Sources 404 Not Found [IP : 91.189.91.13 80],
w:failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/multiverse/source/Sources 404 Not Found [ IP:91.189.91.13 80],

Run the following command:

sudo sed-i '/natty\-backports/d '/etc/apt/sources.list{,.d/*}

The current commonly used
==========
* Update the database cache in this computer:
sudo apt-get update

* Find packages that contain some keywords:
sudo Apt-cache Search < You are looking for name>

* Install the specified software:
sudo apt-get Install < packages you want to install >

* Download package source code (if any):
Apt-get Source < The source code package name you want to download >


Detailed information

=========


Apt-get:

Installing and uninstalling------
* Update the database cache in this computer:
sudo apt-get update
It is best to keep the data on your own machine consistent with the information above on the server (/etc/apt/sources.list listed), and run this command to ensure success before installing the software.

* Install the SOFTWARE:
#apt-get Install PackageName
This will install the latest packages you need in Sources.lists, and automatically install the dependent packages if you have other dependencies. PackageName can be multiple packages.
Some useful options:
-h this help text.
-D Download only-do not install or unpack archives
-F attempt to continue if the integrity check fails
-S no-act. Perform ordering simulation
-Y assume Yes to all queries and does not prompt
-U show a list of upgraded packages as

* Uninstall software (with install):
#apt-get Install packagename-
Add a '-' (I have not experimented with) after the package that needs to be unloaded, and of course I can apt-get install P1 p2-So many commands are merged, loading P1 unloading p2.

* Uninstall Software 2:
#apt-get Remove PackageName
This will uninstall the appropriate software, but also unload the dependencies, and there is no way to specify not to unload dependencies. However, the software's configuration files will remain in the system.

* Complete uninstall software includes removal configuration:
#apt-get--purge Remove PackageName
The configuration file will also be deleted.

* Install software 2 (with remove):
#apt-get Remove packagename+
This is similar to the use of install to uninstall software, add a + after the package name to indicate installation.

* Repair or Install only the latest version:
#apt-get--reinstall Install PackageName
Here, if your package is compromised, or you want to install an up-to-date software, run this.

Upgrade package------
* Upgrade Package 1:
#apt-get-u Upgrade
Here, plus the-u option lists the software that will be upgraded, and you may be prompted that some software will not be upgraded because it may break dependencies, and a better approach is to use Apt-get Dist-upgrade
You can update by CD or add source address, if you want to upgrade from CD, run Apt-cdrom to add the software from CD to/etc/apt/sources source, then run Apt-get Dist-upgrade to upgrade, However, because Apt-get always uses the latest version, if the CD is not the latest version, then the CD will not be used.

* Upgrade Package 2:
#apt-get-u Dist-upgrade
This installation of software in front of Apt-get-u upgrade will also be installed, but the individual still can not install, for example: Upgrade will lead to the need to uninstall some of the packages, uninstall these packages will cause additional software can not be used, so do not upgrade.

* Upgrade Package 3:
#apt-get-u Install PackageName
Assuming that the PackageName cannot be upgraded before the upgrade, the command will be upgraded PackageName if you need to uninstall the memory module and uninstall these modules to cause some software can not use, then simply uninstall the software, and then upgrade, This command will cause the PackageName to eventually escalate.

Clean up the useless package files------
When installing packages with Apt-get, APT will recover the corresponding packages from the/etc/apt/sources.list, store them in a local document library (/var/cache/apt/archives/) before starting the installation, Over time, this will continue to consume hard disk space.

* Clean up all cached files:
#apt-get Clean
This clears the files that are not locked in the/var/cache/apt/archives/and/var/cache/apt/archives/partial/. Of course, when you install the software again, the software is restored to the local document library.

* Just clean up the old cached files:
#apt-get AutoClean
This will clean up the files in the old versions of/var/cache/apt/archives/and/var/cache/apt/archives/partial/. The old version refers to the updated version of the software, and then download should download the latest instead of this old version of the. According to Apt-show-versions-p, you can tell which ones are old.

* Install the specified version of the package:
# Apt-get Install Package=version

Find Information--------

* Look for a package that contains packagename strings:
#apt-cache Search PackageName
This will output the package containing the PackageName string.

* Display the package details:
# Apt-cache Show Stella
This contains a lot of information about the package, for example, if you have installed the package, the information will be displayed.

* Show general information about the package:
Apt-cache showpkg PackageName
This will show the approximate information.

* View the information that packages can be upgraded:
$ apt-show-versions-u
This apt-show-versions tool needs to be installed.

* View current specific software version:
Apt-show-versions-p PackageName

* Check PackageName-dependent packages:
#apt-cache depends PackageName

Work related--------

* Install the library (package) needed to compile the source code:
# Apt-get BUILD-DEP PackageName
The source code package is a ' build-depends ' field that indicates the software that needs to be installed to compile this package from source. The above commands can download these packages, where ' PackageName ' is the package name.


* See what other libraries (packages) are needed to compile a package:
#apt-cache Show PackageName
If you just want to check what other packages are needed to compile a package, you can take advantage of the above command, where ' PackageName ' is the package name.


* Download the source code of package PackageName:
$ apt-get Source PackageName
This will download a file in the current directory: *.orig.tar.gz,*.dsc,*.diff.gz. If the package is Debian, then the last file is not, and the first file name does not include the "orig" string.
The. dsc file is Dpkg-source used to extract the source code package to the directory packagename-version. Each downloaded source package contains a debian/directory containing files for creating a. deb package.


* Compile the source code package automatically when downloading:
$ apt-get-b Source PackageName
Probably compiled into a. Deb package, I haven't tried.

* Create a Deb package based on the downloaded source code:
$ dpkg-buildpackage-rfakeroot-uc-b
If you decide not to create a Deb package while downloading, you can create it later by running the command in a directory created after the downloaded package.

* Install packages directly using Package Manager:
# dpkg-i File.deb
You need to use the Package Manager directly to run this command to install the package.

-------Dpkg Lookup

* Known package contains a file to locate the package according to the file:
# dpkg-s Stdio.h
After the input, the output is as follows:
Libc6-dev:/usr/include/stdio.h
Libc6-dev:/usr/include/bits/stdio.h
Perl:/usr/lib/perl/5.6.0/core/nostdio.h
This is useful when you know some of the files in the package, depending on the file lookup package.

* Find packages installed on your machine:
Dpkg-l

* Automatic installation of missing software:
# auto-apt Run command
Here, command is the order you want to run. For example, Auto-apt run./configure. When the software is missing, it will ask you to install it to facilitate compilation. It will continue to run after installation. Auto-apt needs to keep an up-to-date database and update it with this command: AUTO-APT update, Auto-apt updatedb and Auto-apt update-local.

--------Apt-get Lookup

* Use Apt-file to find the appropriate package based on the filename:
$ apt-file Search filename
If you only know the program name filename, then you can run the command, which works like Dpkg-s, by looking up the name of the package based on the files that might be contained in a package. In addition, it also displays the software package that contains the file that is not installed. When you compile, you are prompted for missing header files, which makes it easy to determine which packages you need to install (of course, it's easier to use AUDO-APT).

* List the files contained in a package:
$APT-file List PackageName
Here, Apt-file is based on a database to read the information, so need to keep the database is up-to-date.

* Update the Apt-file database:
# apt-file Update
By default, the Apt-file database is the same as the auto-apt.

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.