apt is the tool for downloading packages. So if you don’t have internet access apt won’t be very useful.
The command to install packages on debian is dpkg. So if you download a Debian package (usually named *.deb) you can install it with dpkg -i $pkg as long as you have the dependencies installed. Of course you can also install the dependencies this way, so just make sure that you bring the package and all packages that it depends on to the target machine.
Yes, you need to download all transitive dependencies.
But this isn’t dependency hell, it is just tedious. Dependency Hell is when your dependency tree requires two (or more) version of a single package so that not all of the dependencies can be satisfied.
On a computer that is online, you can say apt install --download-only foo to download (and not actually install) the .deb files for foo and its dependencies to the directory /var/cache/apt/archives/. You can then copy them from the online computer to the offline computer, and install them with dpkg -i *deb (assuming the debs are in your current working directory). Note however that apt on the online computer will only download dependencies which aren’t already installed. To force re-downloading of a specific package which is already installed, you can say apt install --reinstall--download-only foo.
Instead of downloading with apt install --download-only you could also find the download paths for individual .deb packages using https://packages.debian.org/foo and then download them using a browser.
You could also copy the contents of /var/lib/apt/lists/ (after running apt update) and the contents of /var/cache/apt/archives/ both to the corresponding locations on the offline computer and, if your sources.list files have the same entries, then you can offline install the things you’ve put in the cache folder using apt instead of dpkg.
Or, if you have lots of disk space, you can create an offline mirror of all (or some) of debian and point your sources.list file at a local file:/// source and then you can use apt like normal but completely offline.
I used to do this many years back with a USB stick before I had Internet access at home. I think it was only the sources.list file that I needed to copy around along with a config file and the actual .deb files. It was possible to use apt-get on the offline machine instead of dpkg which worked better.
apt
is the tool for downloading packages. So if you don’t have internet accessapt
won’t be very useful.The command to install packages on debian is
dpkg
. So if you download a Debian package (usually named*.deb
) you can install it withdpkg -i $pkg
as long as you have the dependencies installed. Of course you can also install the dependencies this way, so just make sure that you bring the package and all packages that it depends on to the target machine.and all the packages those secondary packages require, back in the old days we called it Dependency Hell
Yes, you need to download all transitive dependencies.
But this isn’t dependency hell, it is just tedious. Dependency Hell is when your dependency tree requires two (or more) version of a single package so that not all of the dependencies can be satisfied.
Isn’t apt install ***.deb an alias for dpkg -i ? (Not on my computer so cannot check)
I don’t remember that working but I haven’t used Debian in years so it could be.
Thanks. How do I download a package with apt? So that I can get it to the other computer?
On a computer that is online, you can say
apt install --download-only foo
to download (and not actually install) the .deb files forfoo
and its dependencies to the directory/var/cache/apt/archives/
. You can then copy them from the online computer to the offline computer, and install them withdpkg -i *deb
(assuming the debs are in your current working directory). Note however thatapt
on the online computer will only download dependencies which aren’t already installed. To force re-downloading of a specific package which is already installed, you can sayapt install --reinstall --download-only foo
.Instead of downloading with
apt install --download-only
you could also find the download paths for individual .deb packages using https://packages.debian.org/foo and then download them using a browser.You could also copy the contents of
/var/lib/apt/lists/
(after runningapt update
) and the contents of/var/cache/apt/archives/
both to the corresponding locations on the offline computer and, if yoursources.list
files have the same entries, then you can offline install the things you’ve put in the cache folder usingapt
instead ofdpkg
.Or, if you have lots of disk space, you can create an offline mirror of all (or some) of debian and point your
sources.list
file at a localfile:///
source and then you can useapt
like normal but completely offline.I used to do this many years back with a USB stick before I had Internet access at home. I think it was only the sources.list file that I needed to copy around along with a config file and the actual .deb files. It was possible to use apt-get on the offline machine instead of dpkg which worked better.
you can find ubuntu packages at https://launchpad.net/ for download