Todo

  • /etc/motd

1. Choices

1.1. have up-to-date mirrors available

Todo

sync mirrors

Todo

check mirrors

1.2. critical base packages

locales

to get localization binaries for system messages

apt-utils

otherwise packages configuration gets delayed

dialog

to have user interaction possible with APT

1.3. decide the desired type of system

  • will the system run * 64 bits? * 32 bits? * both?

  • will the system be run by * a physical machine? * a virtual machine? * a container? * a container inside a virtual machine?

  • will the system be stored * read-write, as a file system on a dedicated partition? * read-only, as a single file loaded in RAM at boot time?

2. Install required tools

debootstrap

generate a minimal base file system

squashfs-tools

archive or unarchive a file system image

apt install debootstrap squashfs-tools

3. Create a base file hierarchy

3.1. prepare the system's directory

  • become root

  • make a directory and step into it

su
mkdir -p "path"
cd "path"

3.2. generate the minimal base

debootstrap \
--arch="amd64" \
--include="locales,apt-utils,dialog" \
--variant="minbase" \
"stretch" \
. \
"miroir"

4. Configure preinstalled packages

4.1. define default keyboard layouts

  • /etc/default/keyboard

XKBMODEL="pc105"
XKBLAYOUT="fr,fr"
XKBVARIANT="oss,bepo"
XKBOPTIONS=""
BACKSPACE="guess"

4.2. define default locales to generate

  • etc/default/locale

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
  • etc/locale.gen

en_US.UTF-8 UTF-8
fr_FR.UTF-8 UTF-8

4.3. [configure command shell](../bash/index.md)

4.4. [configure package manager](../apt/index.md)

4.5. redefine hostname

echo "hostname" > "etc/hostname"

4.6. provide known file systems

  • etc/fstab

Volume temporaire en RAM

tmpfs /tmp tmpfs auto,mode=1777 0 0

5. Install additional packages

5.1. switch into context

mount --bind /proc proc
mount --bind /sys sys
chroot .

Todo

/dev

5.2. generate locales

locale-gen

5.3. define root password

passwd

5.4. user, guest, sudo

apt-get install sudo

useradd -s /bin/bash user
mkdir /home/user
chown user: /home/user
adduser user sudo

useradd -s /bin/bash guest
chown guest: /home/guest

5.5. authentications: passwords, SSH keys

Todo

files

5.6. upgrade system

  • dans tous les cas :

apt-get update
apt-get upgrade
  • si besoin, car des paquets rétroportés modifient la distribution :

apt-get dist-upgrade

5.7. apply system type elements

linux-image-amd64

s’il ne s’agit pas d’un conteneur

live-boot

si à destination de boot live

systemd-sysv

sans quoi le système ne démarrera pas complètement

apt-get install -t stretch-backports "linux-image-amd64"
apt-get install "live-boot"

5.8. initialization settings

apt-get install -t stretch-backports "systemd-sysv"
  • etc/sysctl.conf

Espace mémoire maximum allouable (à augmenter si hébergement de conteneurs) Pourcentage de RAM disponible avant utilisation de la partition d’échange

vm.max_map_count=1048576
vm.swappiness=0

5.9. keeping things light

apt-get install --no-install-recommends …

5.10. install useful packages

apt-get install \
bash-completion \
lxc \
less nano vim \
pciutils usbutils \
python3 \
squashfs-tools \
apt-get install -t "stretch-backports" \
debootstrap \

5.11. install other packages

[Choix de paquets commentés](packages.md)

apt-get install "package1" …
apt-get install -t stretch-backports "package1"

5.12. properly switch back from context

  • vider le cache d’APT

apt-get clean
  • s’extraire de l’environnement

exit
  • démonter les liens au système hôte

umount sys
umount proc

5.13. clean up commands history

  • root/.bash_history

6. Configure installed packages

Todo

files

7. Archive prepared file system

mksquashfs . "../name.squashfs" -comp "xz"