# Building a Local TinyCore Repository Mirror ## Overview TinyCore Linux is small enough that its package repository can be mirrored locally and carried with the system. This makes it possible to turn a machine into its own package repository host. Instead of repeatedly downloading packages from the Internet, a complete repository tree can be stored locally and used as a private package archive. The result is particularly useful for: * old hardware * offline installations * unstable or unavailable Internet access * repeated TinyCore installations * maintaining a specific historical TinyCore release * building a portable recovery environment * preserving an archived package ecosystem The method below was tested with **TinyCore Linux 11.1 x86**. The complete repository for that release was approximately **7 GB**. Newer TinyCore releases may be considerably larger. A repository for a later release such as TinyCore 17 can require substantially more storage. --- # What the Script Actually Does The script performs a simple repository-mirroring operation: ```text TinyCore repository HTTP curl package URL list wget local repository ``` It does not install packages. It does not modify the package manager. It does not create a new package format. It simply downloads the repository contents so that they can later be used as a local package source. --- # 1. Start in the Repository Workspace First move into the directory where the local repository project will live: ```bash cd ~/Downloads/TinyCorePlus11.1_repo ``` The directory can be located anywhere with sufficient free space. For a complete repository mirror, **storage capacity is the first thing to check**. For example: ```bash df -h . ``` Do this before starting a large mirror operation. A repository is not a few megabytes of packages. A complete historical tree can occupy several gigabytes, and newer releases may require considerably more. --- # 2. Define the Source and Destination The source repository is specified by: ```bash BASE_URL="http://www.tinycorelinux.net/11.x/x86/tcz/" ``` The local destination is: ```bash OUTDIR="tinycore-11.1-tcz" ``` Create the destination directory: ```bash mkdir -p "$OUTDIR" ``` These two variables are the most important part of the operation. They define: ```text BASE_URL = where the packages come from OUTDIR = where the local mirror is stored ``` Do not confuse the two. Before running a full mirror, always verify that `BASE_URL` corresponds to the **exact TinyCore release and architecture** you intend to preserve. For example: ```text 11.x / x86 ``` is not interchangeable with: ```text 11.x / x86_64 ``` or: ```text 17.x / x86 ``` A repository mirror is useful only when it matches the environment that will consume it. --- # 3. Build the Package URL List The next command retrieves the repository index: ```bash curl -fsSL "$BASE_URL" ``` The output is passed through: ```bash grep -Eo '[^"[:space:]]+\.(tcz|tcz\.dep|tcz\.info|tcz\.md5\.txt)' ``` This extracts the package-related files. The list is then normalized: ```bash sort -u ``` and converted into complete URLs with: ```bash awk -vB="$BASE_URL" '{ if ($0 ~ /^http/) print $0; else print B $0 }' ``` Finally, the resulting URL list is saved as: ```text /tmp/tc11_urls.txt ``` The complete command is: ```bash curl -fsSL "$BASE_URL" \ | grep -Eo '[^"[:space:]]+\.(tcz|tcz\.dep|tcz\.info|tcz\.md5\.txt)' \ | sort -u \ | awk -vB="$BASE_URL" '{ if ($0 ~ /^http/) print $0; else print B $0 }' \ > /tmp/tc11_urls.txt ``` This creates a plain text manifest. It is worth keeping this file. It tells you exactly what the downloader was instructed to retrieve. --- # 4. Download the Repository The actual download is performed by: ```bash wget -c -nv -i /tmp/tc11_urls.txt -P "$OUTDIR" ``` The important options are: ```text -c continue interrupted downloads -nv reduced output -i read URLs from a file -P place downloaded files in the destination directory ``` The `-c` option is particularly useful for large repositories. If the connection fails halfway through the operation, the download can be resumed rather than starting from zero. This matters when mirroring several gigabytes over an unreliable connection. --- # 5. Verify the Result After the download completes: ```bash du -sh "$OUTDIR" ``` shows the amount of storage consumed. The number of URLs collected can be checked with: ```bash wc -l /tmp/tc11_urls.txt ``` These two commands provide a quick sanity check: ```text repository size + number of files requested ``` For a historical repository, it is useful to record these values in the accompanying notes. --- # Source and Destination Must Be Obvious The most important operational rule is: > **Know exactly where you are pulling from and exactly where you are putting > the mirror.** Before starting a large download, check: ```bash pwd df -h . ``` Then inspect the variables: ```bash echo "$BASE_URL" echo "$OUTDIR" ``` A repository mirror can consume several gigabytes without producing much visual feedback. Running the command from the wrong directory can therefore become an expensive little archaeological expedition. A dedicated directory is strongly recommended: ```text TinyCorePlus11.1_repo/ tinycore-11.1-tcz/ ``` --- # The End Result After completion, the machine contains its own copy of the repository: ```text TinyCorePlus11.1_repo/ tinycore-11.1-tcz/ *.tcz *.tcz.dep *.tcz.info *.tcz.md5.txt ``` The repository is now independent of the original download session. The files can be backed up, moved to another machine, placed on external storage, or exposed over a local network. --- # Why Build a Local Mirror? The real advantage appears later. Once a complete repository is available locally, the package manager does not necessarily need Internet access for every package installation. The local repository becomes a private package source. Conceptually: ```text Internet TinyCore repo one-time mirror Local repository several GB TinyCore TinyCore TinyCore #1 #2 #3 ``` The machine that performed the mirror effectively becomes the owner of a **local historical package archive**. --- # Local Repository vs. Package Cache A package cache contains packages that happened to be downloaded. A repository mirror is different. It attempts to preserve the repository itself: ```text packages + metadata + dependency information + descriptions + checksums ``` This distinction matters when reconstructing an old system. A cache answers: > "Which packages did I download?" A repository mirror aims to answer: > "What packages were available for this release?" The second is much more useful for system preservation. --- # Offline and Restricted-Network Use A local repository is particularly useful when working with old hardware that cannot reliably access modern Internet services. For example: ```text Old x86 machine obsolete network hardware limited TLS support unreliable Internet access ``` can still obtain packages from: ```text Local repository LAN / USB / local storage ``` This separates two problems: ```text getting the repository ``` from: ```text using the repository ``` The first requires network access once. The second can then be performed locally. --- # Repository as an Archive There is also a preservation aspect. A specific TinyCore release is a historical software environment. Once its repository is mirrored, the package ecosystem can be preserved alongside: ```text TinyCore ISO + kernel + initrd + repository + configuration ``` This is considerably more useful than keeping only the installation image. An ISO tells you what the system booted with. A repository mirror preserves much of what the system could subsequently install. --- # Storage Requirements For the tested TinyCore 11.1 x86 repository: ```text approximately 7 GB ``` was required for the complete archive produced by this approach. Do not treat this number as a universal constant. Repository size changes with: * TinyCore release * architecture * package count * repository contents * metadata * compression changes * additional package collections Newer releases can be substantially larger. For example, a repository corresponding to TinyCore 17 may require considerably more storage than the 11.1 archive. Always check available space before starting: ```bash df -h ``` and preferably keep a comfortable amount of free space beyond the expected repository size. --- # A Small Unix Workstation Can Become a Repository Server Once the mirror exists, the machine does not have to keep it hidden. The repository directory can itself be served over a local network. For example: ```bash cd ~/Downloads/TinyCorePlus11.1_repo python3 -m http.server 8000 ``` This turns the repository directory into a temporary local HTTP archive. Other machines on the LAN can then access it. This creates a useful chain: ```text Internet Mirror host local repository HTTP server TinyCore machine old x86 hardware other local systems ``` The mirror therefore becomes a small piece of local infrastructure rather than merely a directory full of downloaded files. --- # Practical Workflow For historical TinyCore work, a sensible workflow is: ```text 1. Obtain the correct TinyCore ISO 2. Identify the exact release and architecture 3. Locate the matching repository 4. Check available storage 5. Define BASE_URL 6. Define OUTDIR 7. Generate the URL manifest 8. Review the manifest 9. Download the repository 10. Verify its size and file count 11. Preserve the mirror 12. Configure the package manager to use it when required ``` The key is **version discipline**. Do not mix repositories from different TinyCore generations unless you have a specific reason to do so. A historical system is easiest to reproduce when its software sources are preserved as a matching set. --- # Script ```bash # 1) Work inside the repository directory cd ~/Downloads/TinyCorePlus11.1_repo # 2) Define the source repository and local destination BASE_URL="http://www.tinycorelinux.net/11.x/x86/tcz/" OUTDIR="tinycore-11.1-tcz" mkdir -p "$OUTDIR" # 3) Generate the package URL list curl -fsSL "$BASE_URL" \ | grep -Eo '[^"[:space:]]+\.(tcz|tcz\.dep|tcz\.info|tcz\.md5\.txt)' \ | sort -u \ | awk -vB="$BASE_URL" '{ if ($0 ~ /^http/) print $0; else print B $0 }' \ > /tmp/tc11_urls.txt # 4) Download the repository wget -c -nv -i /tmp/tc11_urls.txt -P "$OUTDIR" # 5) Check the result du -sh "$OUTDIR" wc -l /tmp/tc11_urls.txt ``` The script itself is intentionally simple. The important part is not the complexity of the downloader. The important part is that the **source repository is known, the destination is explicit, the download can resume, and the resulting archive can be reused independently of the original Internet connection.** --- ## Result After the operation, the original TinyCore repository has effectively been converted into a local software archive: ```text TinyCore 11.1 repository local disk archive package metadata files and indexes local package source ``` The machine now has its own repository. That means the next TinyCore installation does not have to begin its package life by asking the Internet for everything. It can ask **your local archive** instead. For old hardware and historical distributions, that small difference can turn a fragile Internet-dependent installation into a reproducible local Unix environment.