How to create a local Arch Linux repository

An arch package database is a tar file, optionally compressed. To create a local database file enter:

repo-add <database name>.db.tar.gz

You can download those tar files without installing or uncompressing them by entering the command:

sudo pacman -Syw --cachedir path/to/database/directory <packages>
  • -S Synchronize packages
  • -y Download fresh package databases
  • -w Download packages only
  • --cachedir Alternate package cache location

To add all downloaded packages to the database enter:

repo-add <database name>.db.tar.gz ./*.tar.zst
repo-add <database name>.db.tar.gz ./*.tar.gz

Official Sources: