This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| linux:repomirror [2023/02/12 18:16] – created olaf | linux:repomirror [2023/03/04 09:21] (current) – Corrected link olaf | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Mirror a repository ===== | ||
| + | |||
| + | When running a Debian system (Debian, Ubuntu, Cumulus, ...) without internet connection, it cannot receive upgrades with '' | ||
| + | But with any Debian based system that is online, it is possible to download the required packages and dependencies (!). | ||
| + | With only a very few systems at the same patchlevel, it might be quicker to just download the required packages as in [[linux: | ||
| + | But, when the systems are at different patch levels or to ensure a system can be recovered from an image after a disaster it might be valuable to have a full repository of the used distribution. | ||
| + | |||
| + | ==== Install the required software to mirror a repository ==== | ||
| + | |||
| + | <code bash> | ||
| + | apt install apt-mirror -y | ||
| + | </ | ||
| + | |||
| + | This contains everything needed to replicate a repository | ||
| + | I am using the fictitious distribution FreeDebian - replce it with the actually required distro. | ||
| + | It created / | ||
| + | We need only a few active lines, but I left some commented defaults, just for information what it sets. | ||
| + | <code list> | ||
| + | ############# | ||
| + | # | ||
| + | set base_path | ||
| + | # | ||
| + | # set mirror_path | ||
| + | # set skel_path | ||
| + | # set var_path | ||
| + | # set cleanscript $var_path/ | ||
| + | # set defaultarch | ||
| + | # set postmirror_script $var_path/ | ||
| + | # set run_postmirror 0 | ||
| + | set nthreads | ||
| + | set _tilde 0 | ||
| + | # | ||
| + | ############# | ||
| + | |||
| + | # if only one architecture (i386, amd64, ...) is required, add it at the end of the leading deb. The example shows that for 64-bit x86 architecture | ||
| + | # for multiples (but not all available) issue a line for each | ||
| + | # for all available architectures, | ||
| + | |||
| + | # Source repositories | ||
| + | deb-amd64 [signed-by=/ | ||
| + | deb-src-amd64 [signed-by=/ | ||
| + | |||
| + | clean http:// | ||
| + | </ | ||
| + | |||
| + | ==== Create the directory for the repositories ==== | ||
| + | <code bash> | ||
| + | mkdir / | ||
| + | </ | ||
| + | Start the replication with <code bash> | ||
| + | |||
| + | When the replication is finished, the whole directory should be packed and moved to the offline system for publication. | ||
| + | <code bash> | ||
| + | tar -czPf freedebian.tar.gz / | ||
| + | |||
| + | |||
| + | |||
| + | ==== Create a repository server on the offline network ==== | ||
| + | |||
| + | On the target network with a fresh Debian installation run '' | ||
| + | That will install apache2 with a standard, non-ssl web site active, with the files at ''/ | ||
| + | |||
| + | Unpack the archive created online:< | ||
| + | tar -xvzPf freedebian.tgz | ||
| + | </ | ||
| + | |||
| + | link the repository to the web site:< | ||
| + | ln -s / | ||
| + | </ | ||
| + | |||
| + | ==== Modify sources.list and install updates ==== | ||
| + | On the clients that should use the repository modify ''/ | ||
| + | < | ||
| + | deb [arch=amd64] http:// | ||
| + | deb-src [arch=amd64] http:// | ||
| + | </ | ||
| + | |||
| + | Update apt and upgrade the client device: | ||
| + | |||
| + | <code bash>apt update && apt dist-upgrade </ | ||
| + | |||
| + | Done. | ||
| + | |||
| + | |||