I installed wkhtmltopdf
, by sudo apt-get install wkhtmltopdf
. Its version is 0.9.9.
http://wkhtmltopdf.org/downloads.html says its latest stable version is 0.12.2.1. So I download its deb for Ubuntu 14.04.
I want to use apt
to install the downloaded deb for reasons stated in https://unix.stackexchange.com/a/159114/674 and related replies, so I move it to /var/cache/apt/archives
, but still how can I install it using apt
?
$ mv /tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb /var/cache/apt/archives
$ sudo apt-get install wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
E: Couldn't find any package by regex 'wkhtmltox-0.12.2.1_linux-trusty-amd64.deb'
$ sudo apt-get install wkhtmltox
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package wkhtmltox
$ sudo apt-get install wkhtmltopdf
still installs the older version. Thanks.
Best Answer
Quick Summary
To install a manually downloaded .deb package and also automatically download and install the packages it depends on from your configured repositories:
sudo apt-get -f install
after installing your .deb withdpkg -i
.gdebi
to install a .deb package and automatically resolve its dependencies (apt-get
will not do this, butgdebi
and its graphical frontends will).See below for details.
Why
apt-get
Won't Do Thisapt-get
checks your configured software sources (repositories) and automatically downloads and installs packages. Except in the case where a configured repository is inaccessible, this does not enable anapt-get install
command to succeed that would not otherwise succeed. If the package isn't in one of your repositories,apt-get
will not know to install it even if the .deb file happens to be in/var/cache/apt/archives
.Thus:
If you have a package already downloaded, and it is the same package
apt-get
would automatically download and install, then you can put it/var/cache/apt/archives
andapt-get
will not have to download it.If you have a package already downloaded which is not the same package
apt-get
would automatically choose, but which is nonetheless available in a configured repository, then you can put it in/var/cache/apt/archives
and forceapt-get
to attempt to install it instead of the package it prefers. For example:Neither of those situations applies to your case. The specific package version is not provided by any of the configured repositories, because it is instead an alpha testing version from the upstream project's download page. Because you have no repository that provides that version of that package, you cannot install your manually downloaded .deb file with
apt-get
.Way 1: Install with
dpkg
and Resolve Dependencies withapt-get
Fortunately, it doesn't look like you need to install this package with
apt-get
. It appears your actual goal isdpkg
can do, butapt-get
cannot), and alsodpkg
cannot do, butapt-get
can).You can do this in two separate steps:
Install the package with
dpkg
.That created missing dependencies.
apt-get
can fix missing dependencies automatically.That should also automatically finish configuring the original package. (So you will not likely need to run
sudo dpkg --configure -a
yourself.)Way 2: Use
gdebi
to Both Install and Resolve DependenciesWhile
apt-get
won't attempt to automatically install an arbitrary .deb file and its dependencies, there is a tool made for this purpose: gdebi . Fromman gdebi
:To use gdebi in a terminal, run
gdebi package.deb
as root, e.g.:gdebi also has graphical frontends. You'll probably want to use
gdebi-gtk
, the GTK+ frontend:But if you're running Kubuntu (or otherwise using KDE) you might prefer
gdebi-kde
, the KDE frontend (provided by the gdebi-kde package):The graphical frontends may also be called without arguments (e.g.,
gksudo gdebi-gtk
), in which case you may click File > Open to browse for and select the .deb file from within the GUI.