Network Shared Pacman Cache

From ArchWiki
Revision as of 17:13, 25 March 2007 by Bjørn (talk | contribs) (Placing categories at the bottom to prevent extra whitespace at the top)
Jump to: navigation, search

In order to share packages between multiple computers you can simply share /var/cache/pacman/ using any network-based mount protocol; for example samba or nfs. Alternatively; you could use sshfs which is probably a bit slower, but has the advantage of being more secure. This guide shows you how to use shfs or sshfs to share a package cache plus the related library-directories between multiple computers on the same local network.

Using shared package cache

First, install any network filesystem - sshfs, shfs, ftpfs, smbfs, nfs etc.

pacman -S sshfs

Then mount /var/cache/pacman/pkg from your server to /var/cache/pacman/pkg on every client machine.

mount sshfs#root@alpha:/var/cache/pacman/pkg/ /var/cache/pacman/pkg

That's all! Now you have shared package cache. If you want also to have shared package database you will need to mount /var/lib/pacman/{current,extra,testing,community,unstable} in the same way.

Warning: do not mount /var/lib/pacman/local!

You may modify your /etc/fstab like this:

sshfs#root@alpha:/var/cache/pacman/pkg/ /var/cache/pacman/pkg fuse rw,reconnect 0 0
sshfs#root@alpha:/var/lib/pacman/testing/ /var/lib/pacman/testing fuse rw,reconnect 0 0
sshfs#root@alpha:/var/lib/pacman/current/ /var/lib/pacman/current fuse rw,reconnect 0 0
sshfs#root@alpha:/var/lib/pacman/extra/ /var/lib/pacman/extra fuse rw,reconnect 0 0
sshfs#root@alpha:/var/lib/pacman/community/ /var/lib/pacman/community fuse rw,reconnect 0 0

or this:

root@alpha:/var/cache/pacman/pkg/ /var/cache/pacman/pkg shfs rw,preserve,persistent 0 0
root@alpha:/var/lib/pacman/testing/ /var/lib/pacman/testing shfs rw,preserve,persistent 0 0
root@alpha:/var/lib/pacman/current/ /var/lib/pacman/current shfs rw,preserve,persistent 0 0
root@alpha:/var/lib/pacman/extra/ /var/lib/pacman/extra shfs rw,preserve,persistent 0 0
root@alpha:/var/lib/pacman/community/ /var/lib/pacman/community shfs rw,preserve,persistent 0 0

Note: using shared database can be slow, depending on network filesystem type and LAN load.

Tip: if you want to use sshfs or shfs you should consider reading Using SSH Keys.

sshfs vs. shfs

  • sshfs is FUSE filesystem, shfs is kernel module
  • there were some problems with shfs, I didn't test it recently so please report here your results