User Tools

Site Tools


lxd:install

Install a LXD server

Gentoo

touch /etc{/subuid,/subgid}
usermod --add-subuids 1000000-1065535 root
usermod --add-subgids 1000000-1065535 root
/etc/init.d/lxd start
rc-update add lxd default
myth /etc/init.d # lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: lxdbr0
Would you like LXD to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]: 10.1.0.247
Port to bind LXD to [default=8443]:
Trust password for new clients:
Again:
Invalid input, try again.

Trust password for new clients:
Again:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:

Installation using snapd

Centos7

First we install snap :

yum install yum-plugin-copr epel-release
yum copr enable ngompa/snapcore-el7
yum install snapd
systemctl enable --now snapd.socket

Then we need to activate kernel features necessary for lxc by adding the following to /etc/default/grub in GRUB_CMDLINE_LINUX :

user_namespace.enable=1 namespace.unpriv_enable=1 user.max_user_namespaces=3883

Then we rebuild grub.conf, set a required sysctl and reboot :

grub2-mkconfig >/boot/grub2/grub.cfg
echo "user.max_user_namespaces=3883" > /etc/sysctl.d/99-userns.conf
reboot

After rebooting we can install and test lxd :

snap install lxd
lxd init  # don't create network or storage here
lxc network create lxdbr0 ipv4.address=172.16.3.1/24 ipv6.address=none ipv4.nat=false ipv4.dhcp=false ipv4.firewall=false ipv6.dhcp=false ipv6.firewall=false
lxc network attach-profile lxdbr0 default
lxc storage create local dir
lxc profile device add default root disk path=/ pool=local
lxc launch images:alpine/3.8 test

Ubuntu

Snapd is installed and enabled by default, as are the kernel features required to run lxc, so we just run :

snap install lxd
lxd init  # don't create network or storage here
lxc network create lxdbr0 ipv4.address=172.16.3.1/24 ipv6.address=none ipv4.nat=false
lxc network attach-profile lxdbr0 default
lxc storage create local dir
lxc profile device add default root disk path=/ pool=local
lxc launch images:alpine/3.8 test
lxd/install.txt · Last modified: 2018/10/04 15:37 by adyxax