Private
Public Access
11
1

Update Installing Packages without Internet Access

2024-10-31 06:27:25 +01:00
parent c78b33d942
commit 8e4d6901aa

@@ -1,43 +1,43 @@
---
title: 'Installing Packages without Internet Access '
---
Sometimes you need to install an extra package (or a hundred). If the machine is has access to the internet, then a simple `sudo apt-get install <package_name>` is all that is needed. However, it is not so simple when the machine doesn't have internet access. Here is a method for transferring the required package files with a USB drive.
get initial package list:
get initial package list: \
`$apt-get --print-uris --yes install <my_package_names> | grep ^\' | cut -d\' -f2 >downloads.list`
Note that it will not append, so do it all in one go.
Take downloads.list to an internet-accessible computer and run:
```$curl --remote-name-all $(cat downloads.list)```
Take downloads.list to an internet-accessible computer and run: \
`$curl --remote-name-all $(cat downloads.list)`
This will fill the current directory with downloaded .deb files.
Beware that when a file is not found, it will silently download an "error 404" html page into the *.deb file. You can recognise them by being smaller than 280 bytes. Try downloading them from a different repository.
Move the *.deb to the target PC and copy to:
Move the *.deb to the target PC and copy to: \
`/var/cache/apt/archives/`
Run on target:
Run on target: \
`$sudo apt-get --no-download --fix-missing install <my_package_names>`
if there are still missing dependencies, then make a list and run them through the above steps to download the extra packages. Continue recursively until it decides to actually do the install.
If there are errors, some packages might get stuck with complaints about missing dependencies.
Run this to fix what is fixable and to see a list of remaining problems:
Run this to fix what is fixable and to see a list of remaining problems: \
`$sudo apt-get --no-download --fix-missing --fix-broken install`
Run this to make a list of further packages to download:
Run this to make a list of further packages to download: \
`$apt-get --print-uris --yes --fix-missing --fix-broken install | grep ^\' | cut -d\' -f2 >downloads.list`
Problems packages are listed together with the missing deps. Run the following command to try to fix the issue by force-installing the set all at once:
Problems packages are listed together with the missing deps. Run the following command to try to fix the issue by force-installing the set all at once: \
`$sudo dpkg -i <package_name> <dep1> <dep2> <dep3>`
If the above command produces further errors (e.g. a dep having further deps), then just add the further sub-deps to the same command (note that order is not important):
If the above command produces further errors (e.g. a dep having further deps), then just add the further sub-deps to the same command (note that order is not important): \
`$sudo dpkg -i <package_name> <dep1> <dep1-1> <dep1-2> <dep2> <dep3> <dep3-1>`
If you can't find the exact .deb file that was asked for, then you can substitute another .deb file for the same package, version and architecture.
e.g. python3-numpy_1.24.2-1_amd64.deb > python3-numpy_1.24.2-1+deb12u1_amd64.deb
e.g. `python3-numpy_1.24.2-1_amd64.deb` => `python3-numpy_1.24.2-1+deb12u1_amd64.deb`
Here, the addition of +deb12u1 is indicating that the package is for Debian Linux version 12, update 1.