From c14a99086a0f01e87970758848d4826afb9f997c Mon Sep 17 00:00:00 2001 From: Luc Date: Mon, 8 Jul 2024 12:56:43 +0200 Subject: [PATCH] Updated some naming schemes in alpine server and desktop sections. --- .../config-files.md | 0 .../{initsystems.md => init-system.md} | 0 .../post-install/{zram.md => swap.md} | 0 .../post-install/{nix.md => user-packages.md} | 0 .../post-install/users.md | 18 ++++++++++-- .../installation/installation.md | 8 +++--- .../installation/provisioning.md | 12 ++++---- mkdocs.yml | 28 +++++++------------ 8 files changed, 35 insertions(+), 31 deletions(-) rename docs/alpine-desktop-setup/{post-install => graphical-session}/config-files.md (100%) rename docs/alpine-desktop-setup/post-install/{initsystems.md => init-system.md} (100%) rename docs/alpine-desktop-setup/post-install/{zram.md => swap.md} (100%) rename docs/alpine-desktop-setup/post-install/{nix.md => user-packages.md} (100%) diff --git a/docs/alpine-desktop-setup/post-install/config-files.md b/docs/alpine-desktop-setup/graphical-session/config-files.md similarity index 100% rename from docs/alpine-desktop-setup/post-install/config-files.md rename to docs/alpine-desktop-setup/graphical-session/config-files.md diff --git a/docs/alpine-desktop-setup/post-install/initsystems.md b/docs/alpine-desktop-setup/post-install/init-system.md similarity index 100% rename from docs/alpine-desktop-setup/post-install/initsystems.md rename to docs/alpine-desktop-setup/post-install/init-system.md diff --git a/docs/alpine-desktop-setup/post-install/zram.md b/docs/alpine-desktop-setup/post-install/swap.md similarity index 100% rename from docs/alpine-desktop-setup/post-install/zram.md rename to docs/alpine-desktop-setup/post-install/swap.md diff --git a/docs/alpine-desktop-setup/post-install/nix.md b/docs/alpine-desktop-setup/post-install/user-packages.md similarity index 100% rename from docs/alpine-desktop-setup/post-install/nix.md rename to docs/alpine-desktop-setup/post-install/user-packages.md diff --git a/docs/alpine-desktop-setup/post-install/users.md b/docs/alpine-desktop-setup/post-install/users.md index 0893ba4..be08b38 100644 --- a/docs/alpine-desktop-setup/post-install/users.md +++ b/docs/alpine-desktop-setup/post-install/users.md @@ -2,6 +2,8 @@ It might be nice to add a user to your system. + + ## Doas Before creating the user install `doas` for when root is requiered: @@ -24,16 +26,18 @@ And create a `_power` group for user's to be able to poweroff the system without # addgroup -S _power ``` + + ## Adding a user -Adding a user in alpine can be done using the `setup-user` script. Here we can specify the name, fullname, groups and more: +Adding a user in alpine can be done using the `setup-user` script. Here we can specify the name, fullname with `-f`, groups and more: ``` -# setup-user -g wheel,nix,_power -f "" +# setup-user -g wheel,_power -f "" # passwd ``` -> It's also recommended to have an "admin" account which is the only one in the wheel group. +> It is also recommended to have an "admin" account which is the only one in the wheel group. And you may have to change the shell of the user in `/etc/passwd` from `/sbin/nologin` to a shell from `/etc/shells`. Alpine Linux comes with `/bin/ash` by default: @@ -55,12 +59,16 @@ And editing `/etc/passwd` to change the login shell from `/bin/ash` to `/sbin/no root:x:0:0:root:/root:/sbin/nologin ``` + + ### Encrypting the home directory (Not yet working, DO NOT FOLLOW) If you are running a system with multiple users or if you want an extra layer of protection then it's possible to encrypt every user's home directory. > Do note that a second layer of encryption can lead to lower disk performance so in the case where this is important it might be preferred not to encrypt. + + #### Setting up fscrypt First install the `fscrypt` and `e2fsprogs-extra` packages: @@ -85,6 +93,8 @@ auth optional pam_fscrypt.so session optional pam_fscrypt.so ``` + + #### Encrypting a user's home Encrypt the directory with: @@ -101,6 +111,8 @@ Then reboot and login with the user to check if it worked. It should also have g $ fscrypt status /home/ ``` + + ## TLDR If you have already set up a system with a user but want to add another do this: diff --git a/docs/alpine-server-setup/installation/installation.md b/docs/alpine-server-setup/installation/installation.md index 5d07b1c..937b377 100644 --- a/docs/alpine-server-setup/installation/installation.md +++ b/docs/alpine-server-setup/installation/installation.md @@ -1,6 +1,6 @@ # Installation -To install the Alpine Linux distribution on the system, the main partition and the efi partition have to be mounted to the main system. +To install the Alpine Linux distribution on the system, the root subvolume and the efi partition have to be mounted to the main system. ``` # mount -o subvol=@root /dev/mapper/luks /mnt -t btrfs @@ -14,7 +14,7 @@ Then set up the base system using `setup disk`: # setup-disk -m sys /mnt ``` -This will also add grub as bootloader which will be replaced but for now it will reside on the boot partition. +This will also add grub as bootloader which will be replaced but for now it will reside on the efi partition. To make it possible to chroot into the system, mount the other directories: @@ -60,7 +60,7 @@ tmpfs /tmp tmpfs rw,size=4G,nr_inodes=5k,n proc /proc proc nosuid,nodev,noexec,hidepid=2 0 0 ``` -Here `` has to be replaced with the uuid of the main volume: +Here `` has to be replaced with the uuid of the root volume: ``` # blkid /dev/mapper/luks >> /etc/fstab @@ -105,7 +105,7 @@ output_dir="/efi/EFI/Linux" output_name="alpine-linux-{flavor}.efi" ``` -Here `` and `` have to be replaced with the uuid of the main partition and volume respectively. +Here `` and `` have to be replaced with the uuid of the root partition and volume respectively. ``` # blkid /dev/2 >> /etc/kernel-hooks.d/secureboot.conf diff --git a/docs/alpine-server-setup/installation/provisioning.md b/docs/alpine-server-setup/installation/provisioning.md index a96f6d5..d121712 100644 --- a/docs/alpine-server-setup/installation/provisioning.md +++ b/docs/alpine-server-setup/installation/provisioning.md @@ -28,7 +28,7 @@ Then to create the filesystem on the efi partition. # mkfs.fat -F 32 -n efi /dev/1 ``` -The main partition of the system is going to be encrypted using `cryptsetup`. First generate a key that will be used to encrypt the device and save it temporarily to the file `/tmp/crypt-key.txt` with: +The root partition of the system is going to be encrypted using `cryptsetup`. First generate a key that will be used to encrypt the device and save it temporarily to the file `/tmp/crypt-key.txt` with: ``` # cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1 > /tmp/crypt-key.txt && cat /tmp/crypt-key.txt @@ -44,21 +44,21 @@ Then format the partition using `cryptsetup`: # cryptsetup open --type luks /dev/2 luks ``` -Now to create a btrfs filesystem on the main partition use: +This creates a formatted partition on `\dev\mapper\luks` which is denoted as the root volume. A btrfs filesystem will be created on the root volume by: ``` -# mkfs.btrfs -L main -n 32k /dev/mapper/luks +# mkfs.btrfs -L alpinelinux -n 32k /dev/mapper/luks ``` with `-n` the `nodesize`, larger nodesize gives better packing and less fragmentation at the cost of more expensive memory operations while updating metadata blocks. The default is 16k. -The main partition needs to be mounted. +To access the root volume it needs to be mounted. ``` # mount /dev/mapper/luks /mnt -t btrfs ``` -To create the necessary subvolumes in the main volume: +Then to create the necessary subvolumes on the root volume, we use: ``` for i in root home var nix; do @@ -66,7 +66,7 @@ for i in root home var nix; do > done ``` -Unmount the main partition. +Now unmount the root volume and provisioning is finished. ``` # umount -lf /mnt diff --git a/mkdocs.yml b/mkdocs.yml index 440beb5..d142750 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -48,17 +48,17 @@ nav: - 'Installation': alpine-desktop-setup/installation.md - 'Post installation': - 'Network': alpine-desktop-setup/post-install/network.md - - 'Security': alpine-desktop-setup/post-install/security.md - 'Repositories': alpine-desktop-setup/post-install/repositories.md - - 'Users': alpine-desktop-setup/post-install/users.md - - 'Config files': alpine-desktop-setup/post-install/config-files.md - - 'Nix': alpine-desktop-setup/post-install/nix.md - - 'Zram': alpine-desktop-setup/post-install/zram.md - - 'Initsystems': alpine-desktop-setup/post-install/initsystems.md + - 'Security': alpine-desktop-setup/post-install/security.md + - 'Init system': alpine-desktop-setup/post-install/initsystems.md - 'Firmware and drivers': alpine-desktop-setup/post-install/drivers.md - - 'Secureboot and automatic decryption': alpine-desktop-setup/post-install/automatic-decryption.md + - 'Swap': alpine-desktop-setup/post-install/swap.md + - 'Automatic decryption': alpine-desktop-setup/post-install/automatic-decryption.md - 'Power management': alpine-desktop-setup/post-install/power-management.md + - 'Users': alpine-desktop-setup/post-install/users.md + - 'User packages': alpine-desktop-setup/post-install/user-packages.md - 'Graphical session': + - 'Config files': alpine-desktop-setup/graphical-session/config-files.md - 'Session manager': alpine-desktop-setup/graphical-session/session-manager.md - 'Login manager': alpine-desktop-setup/graphical-session/login-manager.md - 'Window manager': alpine-desktop-setup/graphical-session/window-manager.md @@ -73,17 +73,9 @@ nav: - 'Provisioning': alpine-server-setup/installation/provisioning.md - 'Installation': alpine-server-setup/installation/installation.md - 'Post installation': - - 'Config files': alpine-server-setup/post-installation/config-files.md - - 'Users': alpine-server-setup/post-installation/users.md - - 'Repositories': alpine-server-setup/post-installation/repositories.md - - 'Network' : alpine-server-setup/post-installation/network.md - - 'Docker': - - 'Docker setup': alpine-server-setup/docker/setup.md - - 'Databases': alpine-server-setup/docker/databases.md - - 'Vaultwarden': alpine-server-setup/docker/vaultwarden.md - - 'Gitea': alpine-server-setup/docker/gitea.md - - 'Matrix': alpine-server-setup/docker/matrix.md - - 'Homeassistant': alpine-server-setup/docker/homeassistant.md + - 'Repositories': alpine-desktop-setup/post-install/repositories.md + - 'Security': alpine-desktop-setup/post-install/security.md + - 'Users': alpine-desktop-setup/post-install/users.md - 'Void-desktop setup': - void-desktop-setup/index.md