help/rtfd/public/debian/system/system.rst

413 lines
7 KiB
ReStructuredText
Raw Normal View History

2018-01-14 21:08:01 +01:00
.. todo::
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
* /etc/motd
2018-01-14 20:58:14 +01:00
2018-01-14 21:08:01 +01:00
Choices
=======
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
have up-to-date mirrors available
---------------------------------
2018-01-14 20:58:14 +01:00
2019-12-16 00:08:26 +01:00
.. todo:: sync mirrors
.. todo:: check mirrors
2018-01-14 20:58:14 +01:00
2019-08-03 15:48:05 +02:00
critical base packages
----------------------
2018-01-14 20:58:14 +01:00
2019-08-03 15:48:05 +02:00
+-----------+--------------------------------------------------+
| locales | to get localization binaries for system messages |
+-----------+--------------------------------------------------+
| apt-utils | otherwise packages configuration gets delayed |
+-----------+--------------------------------------------------+
| dialog | to have user interaction possible with APT |
+-----------+--------------------------------------------------+
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
decide the desired type of system
---------------------------------
2018-01-14 20:58:14 +01:00
2021-12-04 18:57:21 +01:00
* will the system run
2022-12-30 10:38:12 +01:00
2021-12-04 18:57:21 +01:00
* 64 bits?
* 32 bits?
* both?
2022-12-30 10:38:12 +01:00
2021-12-04 18:57:21 +01:00
* will the system be run by
2022-12-30 10:38:12 +01:00
2021-12-04 18:57:21 +01:00
* a physical machine?
* a virtual machine?
* a container?
* a container inside a virtual machine?
2022-12-30 10:38:12 +01:00
2021-12-04 18:57:21 +01:00
* will the system be stored
2022-12-30 10:38:12 +01:00
2021-12-04 18:57:21 +01:00
* read-write, as a file system on a dedicated partition?
* read-only, as a single file loaded in RAM at boot time?
2018-01-14 20:58:14 +01:00
2018-01-14 21:08:01 +01:00
Install required tools
======================
2018-01-14 20:58:14 +01:00
2019-08-03 16:05:49 +02:00
============== ========================================
debootstrap generate a minimal base file system
squashfs-tools archive or unarchive a file system image
============== ========================================
2018-01-14 20:58:14 +01:00
2019-08-03 16:05:49 +02:00
.. code:: shell
2018-05-10 12:54:35 +02:00
2019-08-03 16:05:49 +02:00
apt install debootstrap squashfs-tools
2018-01-14 20:58:14 +01:00
2018-01-14 21:08:01 +01:00
Create a base file hierarchy
============================
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
prepare the system's directory
------------------------------
2018-01-14 20:58:14 +01:00
2019-12-15 11:52:11 +01:00
* become root
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
su
2021-12-05 11:10:33 +01:00
* make root directory
2018-05-10 12:54:35 +02:00
.. code:: shell
2021-12-04 18:57:21 +01:00
mkdir '/squashfs-root'
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
generate the minimal base
-------------------------
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
debootstrap \
2021-12-04 18:57:21 +01:00
--arch 'amd64' \
--variant 'minbase' \
--include 'locales,apt-utils,dialog' \
'bullseye' \
'/squashfs-root' \
'https://deb.debian.org/debian'
2018-01-14 20:58:14 +01:00
2018-01-14 21:08:01 +01:00
Configure preinstalled packages
===============================
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
apt
---
configuration
^^^^^^^^^^^^^
* /etc/apt/apt.conf
2022-12-30 01:27:08 +01:00
::
2021-12-05 11:10:33 +01:00
Acquire::AllowInsecureRepositories False;
Acquire::AllowWeakRepositories False;
Acquire::AllowDowngradeToInsecureRepositories False;
Acquire::Check-Valid-Until False;
APT::Install-Recommends False;
APT::Install-Suggests False;
APT::Get::Show-Versions True;
Dir::Etc::SourceParts "";
Dpkg::Progress True;
preferences
^^^^^^^^^^^
* /etc/apt/preferences
.. todo:: preferences
sources
^^^^^^^
* /etc/apt/sources.list
::
deb [arch=amd64] https://deb.debian.org/debian bullseye main contrib non-free
deb [arch=amd64] https://deb.debian.org/debian bullseye-backports main contrib non-free
deb [arch=amd64] https://deb.debian.org/debian bullseye-updates main contrib non-free
deb [arch=amd64] https://deb.debian.org/debian-security bullseye-security main contrib non-free
2021-12-04 19:45:38 +01:00
locales
-------
2021-12-04 18:57:21 +01:00
define default locale
2021-12-04 19:45:38 +01:00
^^^^^^^^^^^^^^^^^^^^^
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
* /etc/default/locale
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
::
2022-12-30 01:27:08 +01:00
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"
2021-12-04 18:57:21 +01:00
define locales to generate
2021-12-04 19:45:38 +01:00
^^^^^^^^^^^^^^^^^^^^^^^^^^
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
* /etc/locale.gen
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
::
en_US.UTF-8 UTF-8
fr_FR.UTF-8 UTF-8
2018-01-14 20:58:14 +01:00
2021-12-04 18:57:21 +01:00
generate locales
2021-12-04 19:45:38 +01:00
^^^^^^^^^^^^^^^^
2021-12-04 18:57:21 +01:00
.. code:: shell
locale-gen
2018-01-14 23:08:42 +01:00
[configure command shell](../bash/index.md)
-------------------------------------------
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
redefine hostname
-----------------
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
* /etc/hostname
::
2018-05-10 12:54:35 +02:00
2021-12-05 11:10:33 +01:00
hostname
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
provide known file systems
--------------------------
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
* /etc/fstab
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
RAM volume for temporary files
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
::
tmpfs /tmp tmpfs auto,mode=1777 0 0
2018-01-14 20:58:14 +01:00
2018-01-14 21:08:01 +01:00
Install additional packages
===========================
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
switch into context
-------------------
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
2021-12-04 18:57:21 +01:00
for f in 'dev' 'dev/pts' 'proc' 'sys' ; do
mount --bind "/${f}" "/squashfs-root/${f}"
done
chroot '/squashfs-root'
2018-05-10 12:54:35 +02:00
2022-12-30 10:38:12 +01:00
define default console setup
----------------------------
* /usr/share/consolefonts
* /etc/default/console-setup
::
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
2022-12-30 10:44:34 +01:00
CODESET="Uni3"
FONTFACE="Terminus"
FONTSIZE="16x32"
2022-12-30 10:38:12 +01:00
VIDEOMODE=
2022-12-30 01:47:18 +01:00
define default keyboard layout(s)
---------------------------------
2021-12-04 19:45:38 +01:00
* /etc/default/keyboard
::
2022-12-30 01:27:08 +01:00
XKBMODEL="pc105"
XKBLAYOUT="fr"
XKBVARIANT="oss"
XKBOPTIONS=""
BACKSPACE="guess"
::
XKBMODEL="pc105"
XKBLAYOUT="fr,fr"
XKBVARIANT="oss,bepo"
XKBOPTIONS="terminate:ctrl_alt_bksp"
BACKSPACE="guess"
2021-12-04 19:45:38 +01:00
2018-01-14 23:08:42 +01:00
user, guest, sudo
-----------------
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
apt-get install sudo
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
useradd -s /bin/bash user
mkdir /home/user
chown user: /home/user
adduser user sudo
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
useradd -s /bin/bash guest
chown guest: /home/guest
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
authentications: passwords, SSH keys
------------------------------------
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. todo:: files
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
upgrade system
--------------
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
* in any case :
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
apt-get update
apt-get upgrade
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
* if needed by backported packages :
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
apt-get dist-upgrade
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
apply system type elements
--------------------------
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
================= ==================================================
2021-12-05 11:10:33 +01:00
systemd-sysv sans quoi le système ne démarrera pas complètement
2018-05-10 12:54:35 +02:00
linux-image-amd64 s’il ne s’agit pas d’un conteneur
live-boot si à destination de boot live
================= ==================================================
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
2021-12-05 11:10:33 +01:00
apt-get install --target-release 'bullseye-backports' 'linux-image-amd64'
.. code:: shell
2021-12-04 18:57:21 +01:00
apt-get install 'live-boot'
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
----
initialization settings
-----------------------
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
2021-12-05 11:10:33 +01:00
apt-get install --target-release 'bullseye-backports' 'systemd-sysv'
2018-01-14 20:58:14 +01:00
2021-12-05 11:10:33 +01:00
* /etc/sysctl.conf
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: ini
2022-12-30 10:38:12 +01:00
# maximum mappable memory space for linux containers
2018-05-10 12:54:35 +02:00
vm.max_map_count=1048576
2022-12-30 10:38:12 +01:00
# percentage of RAM remaining before swap usage
2018-05-10 12:54:35 +02:00
vm.swappiness=0
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
install useful packages
-----------------------
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
apt-get install \
bash-completion \
lxc \
less nano vim \
pciutils usbutils \
python3 \
2021-12-04 18:57:21 +01:00
squashfs-tools
2018-05-10 12:54:35 +02:00
.. code:: shell
2021-12-04 18:57:21 +01:00
apt-get install \
--target-release 'bullseye-backports' \
debootstrap
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
install other packages
----------------------
2018-01-14 20:58:14 +01:00
[Choix de paquets commentés](packages.md)
2018-05-10 12:54:35 +02:00
.. code:: shell
apt-get install "package1" …
apt-get install -t stretch-backports "package1" …
2018-01-14 20:58:14 +01:00
2022-12-30 01:47:18 +01:00
setup troubleshooting if needed
-------------------------------
define root password
^^^^^^^^^^^^^^^^^^^^
.. code:: shell
passwd
2022-12-30 10:38:12 +01:00
setup console
^^^^^^^^^^^^^
2022-12-30 01:47:18 +01:00
.. code:: shell
2022-12-30 10:38:12 +01:00
apt-get install console-setup
2022-12-30 01:47:18 +01:00
2018-01-14 23:08:42 +01:00
properly switch back from context
---------------------------------
2018-01-14 20:58:14 +01:00
2021-12-04 18:57:21 +01:00
* empty APT's cache
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
apt-get clean
2018-01-14 20:58:14 +01:00
2021-12-04 18:57:21 +01:00
* exit the environment
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
exit
2018-01-14 20:58:14 +01:00
2021-12-04 18:57:21 +01:00
* untie links to host system
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. code:: shell
2021-12-04 18:57:21 +01:00
for f in 'sys' 'proc' 'dev/pts' 'dev' ; do
umount --lazy "/squashfs-root/${f}"
done
2018-01-14 20:58:14 +01:00
2018-01-14 23:08:42 +01:00
clean up commands history
-------------------------
2018-01-14 20:58:14 +01:00
* root/.bash_history
2018-01-14 21:08:01 +01:00
Configure installed packages
============================
2018-01-14 20:58:14 +01:00
2018-05-10 12:54:35 +02:00
.. todo:: files
2018-01-14 20:58:14 +01:00
2018-01-14 21:08:01 +01:00
Archive prepared file system
============================
.. code:: shell
2021-12-04 18:57:21 +01:00
mksquashfs \
'/squashfs-root' \
'filesystem.squashfs' \
2021-12-04 18:58:47 +01:00
-noappend \
2021-12-04 18:57:21 +01:00
-b '1m' \
-comp 'zstd' \
-Xcompression-level 22