Configure pacman to use /dev/shm
Recently I got a laptop with 16GB of RAM, it is not the first one I got with that amount of RAM. But I thought it would be useful to share one of my favourites configurations for pacman and makepkg: using memory instead of disk.
pacman
Well, if you don’t know pacman is the package manager for Arch Linux.
We configure it editing /etc/pacman.conf, the configuration already has a default value, what I usually do is prefix it with /dev/shm, for pacman we need to change only CacheDir.
CacheDir = /dev/shm/var/cache/pacman/pkg/
makepkg
makepkg is a tool to build the package using a PKGBUILD file and then installing it using pacman.
Those are the variables I change:
#-- Specify a directory for package building.
BUILDDIR=/dev/shm/makepkg/build
#-- Destination: specify a fixed directory where all packages will be placed
PKGDEST=/dev/shm/makepkg/packages
#-- Source cache: specify a fixed directory where source files will be cached
SRCDEST=/dev/shm/makepkg/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
SRCPKGDEST=/dev/shm/makepkg/srcpackages
I kept the comments so you can understand why changing that variable.
There is also some configuration to disable compression but because I don’t install many things using makepkg I did not change that yet.
That is all for those two tools ✌ when you restart your computer /dev/shm will be cleaned and you don’t have to worry about cleaning cache.