Petites améliorations syntaxiques
parent
5cb075b60a
commit
558548b862
1 changed files with 10 additions and 10 deletions
|
@ -20,8 +20,8 @@ Avertissements liminaires :
|
|||
## Configuration de l'hôte
|
||||
|
||||
Installation du paquet `lxc` et activation (optionnelle) des quotas sur la partition Btrfs :
|
||||
```
|
||||
# en root
|
||||
```sh
|
||||
# en root (sudo -i)
|
||||
apt install lxc
|
||||
btrfs quota enable /home
|
||||
```
|
||||
|
@ -89,7 +89,7 @@ iface br0 inet6 static
|
|||
```
|
||||
|
||||
Enfin, on prépare la configuration de l'utilisateur
|
||||
```
|
||||
```sh
|
||||
# en utilisateur lambda
|
||||
mkdir /home/ltorvalds/lxc
|
||||
mkdir -p /home/ltorvalds/.config/lxc
|
||||
|
@ -98,7 +98,7 @@ echo "lxc.lxcpath = /home/ltorvalds/lxc" >> /home/ltorvalds/.config/lxc/lxc.conf
|
|||
|
||||
Note: par défaut, la charge (loadavg) dans un conteneur est celle de l'hôte. Il est possible de containeriser cette valeur
|
||||
mais cela semble consommer des ressources (CPU + locking) :
|
||||
```
|
||||
```ini
|
||||
# /etc/systemd/system/lxcfs.service.d/override.conf
|
||||
[Service]
|
||||
ExecStart=/usr/bin/lxcfs /var/lib/lxcfs --enable-loadavg
|
||||
|
@ -107,7 +107,7 @@ ExecStart=/usr/bin/lxcfs /var/lib/lxcfs --enable-loadavg
|
|||
## Création du template
|
||||
|
||||
On commence par créer un répertoire de cache dans le même volume Btrfs, puis on lance la commande de création :
|
||||
```
|
||||
```sh
|
||||
# en root (sudo -i)
|
||||
|
||||
cd /home/ltorvalds/lxc
|
||||
|
@ -116,7 +116,7 @@ LXC_CACHE_PATH=/home/ltorvalds/lxc/cache MIRROR=http://apt-proxy.example.net:314
|
|||
```
|
||||
|
||||
On complète notre magnifique template ainsi :
|
||||
```
|
||||
```sh
|
||||
# en root (sudo -i)
|
||||
|
||||
# nettoyage
|
||||
|
@ -138,7 +138,7 @@ find debian-12-bookworm-systemd-lxccreate/rootfs -print0 | while IFS= read -r -d
|
|||
### Adaptation de la configuration
|
||||
|
||||
On remplace la config par :
|
||||
```
|
||||
```ini
|
||||
# For additional config options, please look at lxc.container.conf(5)
|
||||
# Distribution configuration
|
||||
#lxc.include = /usr/share/lxc/config/debian.common.conf
|
||||
|
@ -204,7 +204,7 @@ lxc.cgroup2.memory.max = 2G
|
|||
### Adaptation à l'intérieur du conteneur
|
||||
|
||||
On lance le conteneur et on s'y projette :
|
||||
```
|
||||
```sh
|
||||
lxc-unpriv-start -n debian-bullseye-lxccreate
|
||||
lxc-unpriv-attach -n debian-bullseye-lxccreate
|
||||
|
||||
|
@ -265,7 +265,7 @@ sed -i 's/^#SystemMaxUse=.*/SystemMaxUse=100M/' /etc/systemd/journald.conf
|
|||
### Reconfiguration automatique
|
||||
|
||||
|
||||
```
|
||||
```sh
|
||||
cat <<EOF >/etc/systemd/system/reset-ssh-server-keys.service
|
||||
[Unit]
|
||||
Description=Regenerate OpenSSH server keys
|
||||
|
@ -291,7 +291,7 @@ systemctl enable reset-ssh-server-keys
|
|||
|
||||
## Utilisation courante
|
||||
On peut ensuite profiter du template en tant qu'utilisateur simple via :
|
||||
```
|
||||
```sh
|
||||
lxc-copy -n debian-12-bookworm-systemd-lxccreate -N project1234-dev
|
||||
# The MAC address will be changed by LXC but remember to affect a new IP
|
||||
# and possibly new subuid (but that topic will be for another day).
|
||||
|
|
Loading…
Add table
Reference in a new issue