Using dpkg to install upgrade and dist-upgrade packages
Instead of using dpkg
, which is a low level package manager, you'd be better off using apt
. To install the .deb files using apt
, copy them to the apt cache
sudo cp *.deb /var/cache/apt/archives/
and then just do the regular upgrade:
apt-get upgrade
The apt
command will use the files in its cache rather than downloading it off the net, so that pretty much serves your purpose.
Related videos on Youtube
R4mzy
Updated on September 18, 2022Comments
-
R4mzy over 1 year
So I'm playing around with offline package installation on 12.04 Server, having downloaded packages by retrieving and wgetting their URIs using the instructions here: http://www.webupd8.org/2009/11/get-list-of-packages-and-dependencies.html
I did this with
apt-get upgrade
andapt-get dist-upgrade
, then went about installing the downloaded packages usingdpkg -i
. So the process looked like so:- Get URIs
-
wget
the packages to a folder (upgrade
packages to /upgrade anddist-upgrade
packages to /dist-upgrade) - run
dpkg -i /upgrade/*.deb
and thendpkg -i /dist-upgrade/*.deb
My question is: would this method of manually installing the updated packages correctly get everything updated, giving the same result as if I'd just run
apt-get upgrade
andapt-get dist-upgrade
normally? Or is there something that the normalapt-get
commands do that wouldn't get done with this way? -
R4mzy over 10 yearsThanks, that works great. Though I'm still curious about what exactly
apt
does differently todpkg
in this case, given I originally usedapt
to get the URIs of all the packages, including their dependencies? When it comes to the actual act of installation it looks likeapt
is pretty much just usingdpkg
to perform the unpacking and installation of the packages, the only difference being thatapt
checks for dependencies beforehand (but that's already covered because I usedapt
to download the packages, including dependencies, in the first place). Unless I'm missing something? -
R4mzy over 10 yearsAlso, part of the reason I ask is that I'm concerned about what
apt's
behaviour might be if, say, the downloaded packages were copied onto a system that had Internet access and thenapt
sees that some or all of the downloaded packages are not the latest (but newer than what's currently installed) and then it rather tries to get the updated versions of those particular packages (I want it to install only the specific packages/versions that I've downloaded). Basically, doesapt
give preference to the latest online version or will it give preference to a local, newer-but-not-latest version? -
sayantankhan over 10 years@R4mzy You've got a valid point there.
apt
will try to get the latest package from the internet, even if there are older packages available locally. You might need to change/etc/apt/sources.list
t make sure it installs the local packages. -
sayantankhan over 7 years@Todd I haven't done it myself, but here is a way someone overrode the apt package priority.