Tutorial: Set up a kmpkg binary cache using filesystem directories
You are not limited to the default binary cache location as your only local binary cache, it is possible to configure multiple filesystem locations as binary caches. You can even set up specific caches with different permissions, such as read-only, write-only, or read and write permissions.
All binary caches are configured through the KMPKG_BINARY_SOURCES environment variable. The value
of KMPKG_BINARY_SOURCES follows a specific configuration
syntax.
In this tutorial you'll learn how to:
Prerequisites
- A terminal
- kmpkg
1 - Create a binary cache directory
When using the files backend, you can use filesystem
directories to store your binary packages, including network locations.
In this tutorial, you'll create two binary cache locations, one with read-write access and a second one with only read access.
Create the two binary cache locations (substitute with any locations of your choosing):
- cmd
- bash
mkdir D:\kmpkg\binary-cache
mkdir \\remote\shared\kmpkg\binary-cache
mkdir /home/kmpkg/binary-cache
mkdir /mnt/remote/shared/kmpkg/binary-cache
2 - Configure KMPKG_BINARY_SOURCES
Next set the value of KMPKG_BINARY_SOURCES as follows:
- powershell
- cmd
- cmd-powershell
- bash
$env:KMPKG_BINARY_SOURCES="clear;files,\\remote\shared\kmpkg\binary-cache,read;files,D:\kmpkg\binary-cache,readwrite"
set "KMPKG_BINARY_SOURCES=clear;files,\\remote\shared\kmpkg\binary-cache,read;files,D:\kmpkg\binary-cache,readwrite"
This KMPKG_BINARY_SOURCES configuration adds the following source strings:
clear, disables any previously configured binary cache, in this case, it disables the default binary cache.files,\\remote\shared\kmpkg\binary-cache,read, sets a binary cache using the filesystem backend,files, located in\\remote\shared\kmpkg\binary-cache, and gives it read-only permissions (readis the default permission).files,D:\kmpkg\binary-cache,readwrite, sets a second filesystem binary cache, located inD:\kmpkg\binary-cache, and gives it read-write permissions (readwrite).
export KMPKG_BINARY_SOURCES="clear;files,/mnt/remote/shared/kmpkg/binary-cache,read;files,/home/kmpkg/binary-cache,readwrite"
This KMPKG_BINARY_SOURCES configuration adds the following source strings:
clear, disables any previously configured binary cache, in this case, it disables the default binary cache.files,/mnt/remote/shared/kmpkg/binary-cache,read, sets a binary cache using the filesystem backend,files, located in/mnt/remote/shared/kmpkg/binary-cache, and gives it read-only permissions (readis the default permission).files,/home/kmpkg/binary-cache,readwrite, sets a second filesystem binary cache, located in/home/kmpkg/binary-cache, and gives it read-write permissions (readwrite).
Next steps
Here are other tasks to try next: