Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 61 additions & 29 deletions Servers/Alpine.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,49 @@
<https://wiki.alpinelinux.org/wiki/Raspberry_Pi#Persistent_storage>
<https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi>

Alpine is meant to run from RAM when running on a Raspberry Pi (meaning that you have to run `lbu commit -d` each time you make a change to the system, otherwise said changes are lost after rebooting).
I personally want a regular/sys install on my Raspberry Pi, which can be done somewhat manually as described in this procedure.
I run Alpine on my Raspberry Pi servers.

Alpine is meant to run from RAM when running on a Raspberry Pi (meaning that you have to run `lbu commit -d` each time you make a change to the system for said change to be persistent).
I personally prefer running a regular / sys install on my Raspberry Pi, which can be done somewhat manually as described in this procedure.

## Prepare the SD card

Create the following partition on the SD Card via `fdisk`:

- Boot --> /dev/mmcblk0p1, 550M, type c (FAT32 LBA)
- Root --> /dev/mmcblk0p2, 11G, type 83 (linux)
- Swap --> /dev/mmcblk0p3, 4G, type 82 (swap)
- Boot --> /dev/mmcblk0p1, 1G, type c (FAT32 LBA)
- Root --> /dev/mmcblk0p2, 30G, type 83 (linux)
- Data --> /dev/mmcblk0p3, all free space remaining, type 83 (linux) # If needed

(Swap is done as a swapfile later)

Create the filesystems:

```bash
mkfs.vfat /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p2
mkswap /dev/mmcblk0p3
sudo mkfs.vfat /dev/mmcblk0p1
sudo mkfs.ext4 /dev/mmcblk0p2
sudo mkfs.ext4 /dev/mmcblk0p3
```

Download the RPI aarch64 image at <https://alpinelinux.org/downloads/> and extract it into the boot partition:

```bash
mount /dev/mmcblk0p1 /mnt
mv alpine-rpi-3.20.0-aarch64.tar.gz /mnt
sudo mount /dev/mmcblk0p1 /mnt
sudo mv ~/Downloads/alpine-rpi-3.23.4-aarch64.tar.gz /mnt
cd /mnt
tar -xzvf alpine-rpi-3.20.0-aarch64.tar.gz
rm alpine-rpi-3.20.0-aarch64.tar.gz
sudo tar -xzvf alpine-rpi-3.23.4-aarch64.tar.gz
sudo rm alpine-rpi-3.23.4-aarch64.tar.gz
```

Un-mount the boot partition, insert the SD card into the Raspberry Pi and start it:
Umount the boot partition, insert the SD card into the Raspberry Pi and start it:

```bash
cd
umount /mnt
sudo umount /mnt
```

## Configure Alpine

Once booted on Alpine live environment, use the `setup-alpine` script to configure your system and commit changes once done:
Once booted in the Alpine live environment, use the `setup-alpine` script to configure your system and commit changes once done:

```bash
setup-alpine
Expand All @@ -60,41 +64,69 @@ export FORCE_BOOTFS=1
setup-disk -o /media/mmcblk0p1/MYHOSTNAME.apkovl.tar.gz /stage
```

Add the boot and swap partitions to the fstab:
Add the boot partition to the fstab:

```bash
apk add vim
blkid # To note /dev/mmcblk0p1 UUID
vim /stage/etc/fstab
```

> [...]
> /dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0
> /dev/mmcblk0p3 none swap defaults 0 0
> UUID=XXXX-XXXX /boot defaults 0 0

**Also delete the `cdrom` related line from the fstab** (as well as the `usbdisk` one if you do not intend to use usb drives on your Raspberry Pi).

Add the data partition to the fstab (if needed):

```bash
mkdir /stage/data
blkid # To note /dev/mmcblk0p3 UUID
vim /stage/etc/fstab
```

> [...]
> UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /data rw,relatime 0 1

Create swapfile and add it to the fstab:

```bash
fallocate -l 4G /stage/swapfile
chmod 600 /stage/swapfile
mkswap /stage/swapfile
swapon /stage/swapfile
vim /stage/etc/fstab
```

> [...]
> /swapfile none swap defaults 0 0

Add the root partition to the boot parameter:

```bash
mount -o remount,rw /media/mmcblk0p1
sed -i '$ s/$/ root=\/dev\/mmcblk0p2/' /media/mmcblk0p1/cmdline.txt
vim /media/mmcblk0p1/cmdline.txt
```

Update boot partition:
> [...] root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rw # Append at the end of the existing line, UUID is the one of the root partition

## Reboot and post-install configuration step

The disk installation / configuration is now over.
You can umount the "stage" directory and `reboot` into the installed system:

```bash
rm -f /media/mmcblk0p1/boot/*
cd /stage
rm boot/boot
mv boot/* /media/mmcblk0p1/boot/
rm -Rf boot
mkdir media/mmcblk0p1
ln -s media/mmcblk0p1/boot boot # You can safely ignore errors here
umount -l /stage
reboot
```

The initial configuration is over! You can now `reboot`, activate swap at boot and proceed with the [post-installation](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Alpine-Linux_Server_Template.md):
Once the system is booted, activate swap at boot and remove the (now useless) `/media/mmcblk0p1/apks` reference in `/etc/apk/repositories` file to avoid related warning when using `apk`:

```bash
reboot
rc-update add swap boot
vi /etc/apk/repositories
```

> /media/mmcblk0p1/apks # Delete this line

You can now proceed with the [post-installation](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Alpine-Linux_Server_Template.md):
4 changes: 2 additions & 2 deletions Servers/Arch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<https://archlinux.org>

I am now running a lightweight Arch Linux installation on my physical servers.
My services are now either running in *rootless / unprivileged* Podman containers or *rootless / unprivileged* LXC containers on said Arch Linux installation.
I am running a lightweight Arch Linux installation on my physical servers.
My services are running in rootless / unprivileged Podman or LXC containers (depending on the case) on said Arch Linux installation via a dedicated (and unprivileged as well) user.

The Arch Linux installation itself is pretty much the same as my [Arch Linux VM Template installation](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Arch-Linux_Server_Template.md).
10 changes: 4 additions & 6 deletions VMs/Alpine-Linux_Server_Template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It aims to be turned as a Template.

I basically follow the classic installation steps via `setup-alpine` with the following exceptions:

- I do not create a regular user for my personal use during the install. Indeed, this will be handled by an ansible playbook. I do create an "ansible" user for that purpose afterward instead (see [Create and configure the ansible user](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Alpine-Linux_Server_Template.md#create-and-configure-the-ansible-user)).
- I do not create a regular user during the install. Indeed creation / management, is handled post-install by an ansible playbook. I do create an "ansible" user for that purpose afterward instead (see [Create and configure the ansible user](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Alpine-Linux_Server_Template.md#create-and-configure-the-ansible-user)).

### Switch to https repositories

Expand All @@ -17,8 +17,8 @@ sed -i "s/http/https/g" /etc/apk/repositories

### Optional - Switch to the edge branch and enable testing repo

I personally depends on a few packages that are still currently in the testing repositories.
As such, I currently switch to the edge branch of the repositories (which basically turns Alpine into a rolling release) and I activate the testing repositories.
I personally need a few packages that were only available in the testing repository (not the case anymore).
If needed, here's how to switch to the edge branch of the repositories (which basically turns Alpine into a rolling release) and enable the testing repository.

```bash
vi /etc/apk/repositories
Expand Down Expand Up @@ -138,7 +138,7 @@ aa-status # Check the list of profile and their status
### Install useful packages

```bash
apk add vim vimdiff man-db sudo bash bash-completion openssh openssh-server-pam socat bind-tools wget traceroute rsync diffutils plocate htop curl logrotate fail2ban fstrim chrony firewalld shadow py3-passlib fastfetch acl
apk add vim vimdiff man-db sudo bash bash-completion openssh openssh-server-pam socat bind-tools wget traceroute rsync diffutils plocate htop curl logrotate fail2ban fstrim firewalld shadow py3-passlib fastfetch acl
```

### Configure various things
Expand Down Expand Up @@ -175,8 +175,6 @@ visudo
```bash
rc-update add sshd
rc-service sshd start
rc-update add chronyd
rc-service chronyd start
rc-update add firewalld
rc-service firewalld start
```
Expand Down
2 changes: 1 addition & 1 deletion VMs/Arch-Linux_Server_Template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ I basically follow my [Arch-Linux base installation guide](https://github.com/An
- I use the `linux-lts` kernel (instead of the `linux` one).
- I use `systemd-networkd` rather than `network-manager` (see [Setup Networking](#setup-networking)).
- I use a different list of "useful packages to install", more suited for servers (see [Install useful packages](#install-useful-packages)).
- I do not create a regular user for my personal use during the install. Indeed, this will be handled by an ansible playbook. I do create an "ansible" user for that purpose afterward instead (see [Create and configure the ansible user](#create-and-configure-the-ansible-user)).
- I do not create a regular user during the install. Indeed creation / management, is handled post-install by an ansible playbook. I do create an "ansible" user for that purpose afterward instead (see [Create and configure the ansible user](#create-and-configure-the-ansible-user)).

**Remember to set a password for the root account during the installation process, otherwise you won't be able to log in to the server after reboot!**

Expand Down
2 changes: 1 addition & 1 deletion VMs/Debian_Server_Template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It aims to be turned as a template.
I basically follow the classic installation steps from the installer with the following exceptions:

- I don't check anything during the **Software selection** step so I get a minimal installation. I install useful packages after the installation instead (see [Install useful packages](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Debian_Server_Template.md#install-useful-packages))
- I don't create any user for me during the installation process. Indeed, this will be handled by an ansible playbook. I do create an "ansible" user for that purpose afterward instead. However, as Debian doesn't allow to perform an installation without creating a regular user, I create a temporary user (temp:temp) that I delete afterward (see [Create and configure the ansible user](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Debian_Server_Template.md#create-and-configure-the-ansible-user)).
- I do not create a regular user during the install. Indeed creation / management, is handled post-install by an ansible playbook. I do create an "ansible" user for that purpose afterward instead. However, as Debian doesn't allow to perform an installation without creating a regular user, I create a temporary user (temp:temp) that I delete afterward (see [Create and configure the ansible user](https://github.com/Antiz96/Linux-Server/blob/main/VMs/Debian_Server_Template.md#create-and-configure-the-ansible-user)).

**Remember to set a password for the root account during the installation process, otherwise you won't be able to log in to the server after reboot!**

Expand Down
2 changes: 1 addition & 1 deletion VMs/RHEL_Server_Template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It aims to be turned as a template.
I basically follow the classic installation steps from the installer with the following exceptions:

- I don't check anything during the **Software selection** step so I get a minimal installation. I install useful packages after the installation instead (see [Install useful packages](https://github.com/Antiz96/Linux-Server/blob/main/VMs/RHEL_Server_Template.md#install-useful-packages))
- I don't create any user during the installation process. Indeed, this will be handled by an ansible playbook. I do create an "ansible" user for that purpose afterward instead (see [Create and configure the ansible user](https://github.com/Antiz96/Linux-Server/blob/main/VMs/RHEL_Server_Template.md#create-and-configure-the-ansible-user)).
- I do not create a regular user during the install. Indeed creation / management, is handled post-install by an ansible playbook. I do create an "ansible" user for that purpose afterward instead (see [Create and configure the ansible user](https://github.com/Antiz96/Linux-Server/blob/main/VMs/RHEL_Server_Template.md#create-and-configure-the-ansible-user)).

**Remember to set a password for the root account during the installation process, otherwise you won't be able to log in to the server after reboot!**

Expand Down