This APT has Super Cow Powers.
We all familiar with this description, but the apt command is too complicated to fully understand.
The following tips are what I learned so far that may become helpful once you get hit with the same request as I did.
Get missing GPG key from PPA source
You could get the missing APT key bygpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys SOMEKEY
orapt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys AKEYXXX
If you knew extract where the key is located, commandapt-key adv --fetch-keys http://url.to/the.key
is also viable.
Install from other releases.
This is the simplest one, just use -t
option with the release name, like thisapt-get install glibc -t jessie
Note: you must have a repo that supports this release. The official Debian stock repo doesn't.
Install with other architectures (Multiarch).
Sometimes, some software needs both i386/i686 and amd64 arch libraries to install or operate.
First, run dpkg --add-architecture i386
to add i386 architecture to the system, then run apt-get update
to refresh your repo cache with i386 info. (your repo should have i386 software, most of them do)
Finally, install software with :i386
suffix, likeapt-get install libssl-dev:i386
To remove the arch, run dpkg --remove-architecture i386
PS: you can also add armhf or as many arches as you want as long as your repos support it.
Reinstall software
This is a common requirement that some program may corrupt for some reason and you have to reinstall it.
Why not remove it and install it again? Well, if you are going to remove a software, in most cases, it can be fine, but if it is a lib that depended by a lot of softwares, you don't want to remove and reinstall all the softwares, do you?apt-get --reinstall install xxx
is all that you need.
PS: during the reinstallation, no upgrade or downgrade is possible.
Install software with specific version
apt-get install software=version
is what you need.
List all available versions for a software
This a feature related to the previous question. Here we need to use the madison
command for apt-cache:apt-cache madison software
will list all possible versions and release branches for your software.
or use aptitude to list versions by aptitude versions software-name
(a lot less accurate in name match)
or use apt-show-versions -a software
(needs to be installed, also possible to check for update for a package by apt-show-versions -u software
)
apt-cache policy software
can give you more details about all versions of the package, but it will only display information for packages that exactly match the given name.
https://blog.csdn.net/qq_41746437/article/details/79340306
-- more to come.
0 comment