Using dpkg to install upgrade and dist-upgrade packages

71,996

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.

Share:
71,996

Related videos on Youtube

R4mzy
Author by

R4mzy

Updated on September 18, 2022

Comments

  • R4mzy
    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 and apt-get dist-upgrade, then went about installing the downloaded packages using dpkg -i. So the process looked like so:

    1. Get URIs
    2. wget the packages to a folder (upgrade packages to /upgrade and dist-upgrade packages to /dist-upgrade)
    3. run dpkg -i /upgrade/*.deb and then dpkg -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 and apt-get dist-upgrade normally? Or is there something that the normal apt-get commands do that wouldn't get done with this way?

  • R4mzy
    R4mzy over 10 years
    Thanks, that works great. Though I'm still curious about what exactly apt does differently to dpkg in this case, given I originally used apt to get the URIs of all the packages, including their dependencies? When it comes to the actual act of installation it looks like apt is pretty much just using dpkg to perform the unpacking and installation of the packages, the only difference being that apt checks for dependencies beforehand (but that's already covered because I used apt to download the packages, including dependencies, in the first place). Unless I'm missing something?
  • R4mzy
    R4mzy over 10 years
    Also, 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 then apt 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, does apt give preference to the latest online version or will it give preference to a local, newer-but-not-latest version?
  • sayantankhan
    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
    sayantankhan over 7 years
    @Todd I haven't done it myself, but here is a way someone overrode the apt package priority.