The document was written to build Incus v0.3.0. You may need a different how-to if you want to build higher versions of Incus.
- Incus v0.3.0 (via release tarball)
- AlpineLinux 3.18 x86_64
This how-to document will help you to build Incus for AlpineLinux. Original reference is here: https://linuxcontainers.org/incus/docs/main/installing/#from-source-build-a-release
alpine-sdk
includes common dependencies for building programs such as git
.
You may remove unused dependencies or install required dependencies manually.
I haven't checked what's required explicitly.
apk add alpine-sdk xz acl-dev autoconf automake eudev-dev gettext-dev go intltool libcap-dev libtool libuv-dev linux-headers lz4-dev tcl-dev sqlite-dev lxc-dev
Incus replaced some Canonical tools with community fork.
For example, cowsql
is a community fork of dqlite
.
Storage driver dependencies
apk add lvm2 thin-provisioning-tools
# activate dm-mod module
modprobe dm-mod
echo dm-mod >> /etc/modules-load.d/dm.conf
wget https://github.com/lxc/incus/releases/download/v0.3.0/incus-0.3.tar.xz
xz -d incus-0.3.tar.xz
tar xf incus-0.3.tar
Build dependencies
make deps
You'll see some environment variable definitions after make deps
completes.
Paste export
commands into your console.
After building dependencies, you may encounter some issues depending on your system setup. You can run following commands to solve issues:
# cc1: error: /usr/local/include: No such file or directory [-Werror=missing-include-dirs]
mkdir -p /usr/local/include
# gettext.cgo2.c:(.text+0x2b9): undefined reference to `libintl_gettext'
# - module path: https://pkgs.alpinelinux.org/contents?file=libintl*&path=&name=gettext-dev&branch=edge
# - related issue: https://github.com/gosexy/gettext/issues/1
export CGO_LDFLAGS="$CGO_LDFLAGS -L/usr/lib -lintl"
export CGO_CPPFLAGS="-I/usr/include"
Build Incus
Now you can build Incus.
make
You'll also need following dependencies for incusd
to run correctly:
apk add rsync squashfs-tools iptables acl attr ca-certificates cgmanager dbus dnsmasq iproute2 netcat-openbsd shadow-uidmap tar
I copied some commands to keep v0.3.0
installation docs here.
If you're installing higher versions of Incus, please check the original documentation.
Setup environment variables
You can put following lines to console, or add them in /etc/profile.d/99incus.sh
for global environment setup.
export PATH="${PATH}:$(go env GOPATH)/bin"
export LD_LIBRARY_PATH="$(go env GOPATH)/deps/cowsql/.libs/:$(go env GOPATH)/deps/raft/.libs/:${LD_LIBRARY_PATH}"
Setup unprivileged containers
echo "root:1000000:1000000000" | sudo tee -a /etc/subuid /etc/subgid