Offline installation of a package

You cannot point pacman to

pacman -S file:///some/place/name.pkg.tar.zst

But you can point pacman to a specific package already present using

pacman -U /some/folder/with/packages/name-version-pkgrel.pkg.tar.zst

Or if you prefer prefixing with file:// but you still need to specify the exact filename

pacman -U file:///some/folder/with/packages/name-version-pkgrel.pkg.tar.zst

Or you can point pacman to the server url of this specific package

pacman -U http://server.uri/repo/name-version-pkgrel.pkg.tar.zst

If you want to install a complete package list without specifying versions - you need a repo - and this repo can be a location on your computer

file:///some/folder

BUT then you need an entry in your pacman.conf pointing to it and the repo name in pacman.conf AND a database with the same name as the repo containing info of which files and versions are provided by the repo.


I guess this is a continuation on your previous endeavour to create some sort of offline mirror to transport and apply the packages to remote system without internet connection.

You don’t even need the caddy server - but can use the system python to run a http server from the root of the repo copy - although you still need the repo definition in pacman.conf

python -m http.server

Let’s say you have a system which has all the desired packages available in the pacman cache.

Create a temporary working copy somewhere convenient e.g. ~/offline

cp /var/cache/pacman/pkg/* ~/offline

Then navigate to the offline folder

cd ~/offline

And create a database

repo-add ./offline.db.tar.gz *.pkg.tar.zst

Then add a repo to your pacman.conf

[offline]
SigLevel = Optional TrustAll
Server = file:///home/username/offline

Then execute to add the packages contained in the database to the local cache

pacman -Sy

Then install a package from the repo.

This works exacly the same way as an online repo - check the manual for further information

man repo-add
4 Likes