====== LXD =====
Installation sur Debian :
simon@deb:~$ sudo apt install snapd
simon@deb:~$ sudo snap install lxd
2019-05-03T20:05:52+02:00 INFO Waiting for restart...
lxd 3.12 from Canonical✓ installed
simon@deb:~$ sudo -s
root@deb:/home/simon# . /etc/profile.d/apps-bin-path.sh
root@deb:/home/simon# lxd --version
3.12
Initialisation :
root@deb:/home/simon# lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: no
Do you want to configure a new storage pool? (yes/no) [default=yes]: yes
Name of the new storage pool [default=default]:
Name of the storage backend to use (btrfs, ceph, dir, lvm) [default=btrfs]: dir
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]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
Would you like LXD to be available over the network? (yes/no) [default=no]:
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]: yes
config: {}
networks:
- config:
ipv4.address: auto
ipv6.address: auto
description: ""
managed: false
name: lxdbr0
type: ""
storage_pools:
- config: {}
description: ""
name: default
driver: dir
profiles:
- config: {}
description: ""
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
name: default
cluster: null
root@deb:/home/simon# lxc launch images:debian/stretch debian-lxd
To start your first container, try: lxc launch ubuntu:18.04
Creating debian-lxd
Starting debian-lxd
root@deb:/home/simon# lxc list
+------------+---------+----------------------+-----------------------------------------------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------------+---------+----------------------+-----------------------------------------------+------------+-----------+
| debian-lxd | RUNNING | 10.97.202.197 (eth0) | fd42:9b16:df01:2c27:216:3eff:fe42:3ddf (eth0) | PERSISTENT | |
+------------+---------+----------------------+-----------------------------------------------+------------+-----------+
root@deb:/home/simon# lxc exec debian-lxd bash
root@debian-lxd:~#
Le conteneur a bien accès au réseau, il a reçu une IP :
root@debian-lxd:~# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
9: eth0@if10: mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:42:3d:df brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.97.202.197/24 brd 10.97.202.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fd42:9b16:df01:2c27:216:3eff:fe42:3ddf/64 scope global mngtmpaddr dynamic
valid_lft 3424sec preferred_lft 3424sec
inet6 fe80::216:3eff:fe42:3ddf/64 scope link
valid_lft forever preferred_lft forever
Machine "host" :
simon@deb:~$ ip a
(...)
8: lxdbr0: mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether fe:3f:51:70:02:df brd ff:ff:ff:ff:ff:ff
inet 10.97.202.1/24 scope global lxdbr0
valid_lft forever preferred_lft forever
inet6 fd42:9b16:df01:2c27::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::3809:35ff:fe34:90eb/64 scope link
valid_lft forever preferred_lft forever
simon@deb:~$ ping 10.97.202.197
PING 10.97.202.197 (10.97.202.197) 56(84) bytes of data.
64 bytes from 10.97.202.197: icmp_seq=1 ttl=64 time=0.077 ms
(...)
On peut installer [[wget]] et télécharger le logo de ce wiki, par exemple :
root@debian-lxd:~# apt install wget
root@debian-lxd:~# wget https://simonlefort.be/wiki/lib/tpl/bootstrap3/images/logo.png
(...)
2019-05-03 18:45:08 (7.22 MB/s) - ‘logo.png’ saved [3820/3820]
root@debian-lxd:~# ls
logo.png
===== Autres articles liés =====
* [[Installation de LXD sur une Odroid-XU3]]
===== Sources =====
* [[https://stgraber.org/2017/01/18/lxd-on-debian/|https://stgraber.org/2017/01/18/lxd-on-debian/]]
* [[https://help.ubuntu.com/lts/serverguide/lxd.html|https://help.ubuntu.com/lts/serverguide/lxd.html]]
*