Drafts for future posts
This commit is contained in:
parent
d6ee42274f
commit
40665d78d1
3 changed files with 219 additions and 2 deletions
|
@ -1,8 +1,8 @@
|
|||
title: Self hosting my home (part 1)
|
||||
---
|
||||
_template: blog/post.html
|
||||
_template: blog-post.html
|
||||
---
|
||||
pub_date: 2020-12-09
|
||||
pub_date: 2021-12-31
|
||||
---
|
||||
body:
|
||||
|
155
content/blog/01-archlinux-install-from-zero-to-hero/contents.lr
Normal file
155
content/blog/01-archlinux-install-from-zero-to-hero/contents.lr
Normal file
|
@ -0,0 +1,155 @@
|
|||
title: Arch Linux on my Dell XPS
|
||||
---
|
||||
pub_date: 2021-12-31
|
||||
---
|
||||
body:
|
||||
|
||||
## Create install media
|
||||
## Install
|
||||
- Follow the wiki
|
||||
|
||||
``` sh
|
||||
# Connect to the internet, the moment we do relector will update the mirrorlist
|
||||
iwctl station wlan0 connect <bssid>
|
||||
|
||||
# Set up date and time
|
||||
timedatectl set-ntp true
|
||||
timedatectl set-timezone Europe/Madrid
|
||||
|
||||
# Prepare the disk, the setup I used:
|
||||
# Disk #0: 512MB, Boot partition, UEFI type
|
||||
# Disk #1: 16384MB, SWAP, swap type
|
||||
# Disk #2: Rest of the disk, btrfs type
|
||||
# fdisk ...
|
||||
|
||||
# Prepare the filesystems and the luks encryption
|
||||
mkfs.vfat -F32 /dev/nmve0n1p0
|
||||
mkswap /dev/nmve0n1p1
|
||||
cryptsetup luksFormat /dev/nvme0n1p2 # Password here
|
||||
cryptsetup open /dev/nvme0n1p2 luks
|
||||
mkfs.btrfs -L btrfs /dev/mapper/luks
|
||||
|
||||
# Prepare the btrfs partition
|
||||
mkdir /mnt/luks
|
||||
mount -t btrfs /dev/mapper/luks /mnt/luks
|
||||
btrfs subvolume create root
|
||||
btrfs subvolume create home
|
||||
btrfs subvolume create snapshots
|
||||
|
||||
# Mount everything under /mnt
|
||||
mkdir /mnt/{home,boot}
|
||||
mount -o subvol=root,compress=lzo /dev/mapper/luks /mnt
|
||||
mount -o subvol=home,compress=lzo /dev/mapper/luks /mnt/home
|
||||
mount /dev/nvme0n1p0 /mnt/boot
|
||||
|
||||
# Run pacstrap with several base packages:
|
||||
pacstrap /mnt \
|
||||
base \
|
||||
linux-lts linux-firmware \
|
||||
intel-ucode \
|
||||
terminus-font \ # Fonts in vconsole
|
||||
man-db man-pages \ # Man pages
|
||||
iwd sudo vim # Utilities
|
||||
|
||||
# Generate the /etc/fstab file
|
||||
genfstab -L /mnt >> /mnt/etc/fstab
|
||||
|
||||
# Check everything is correct, use noatime and discard flags to
|
||||
# make flash drive last longer
|
||||
vim /mnt/etc/fstab
|
||||
|
||||
# Enter into the system
|
||||
arch-chroot /mnt
|
||||
|
||||
# Setup timedate
|
||||
timedatectl set-timezone Europe/Madrid
|
||||
|
||||
# Sync the RTC from the system time (useful if dual booting)
|
||||
hwclock --systohc
|
||||
|
||||
# Set the en_US.UTF-8 locale (uncomment)
|
||||
vim /etc/locale.gen
|
||||
locale-gen
|
||||
|
||||
# Setup default locale
|
||||
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
|
||||
|
||||
# Setup keymap and font
|
||||
echo 'KEYMAP=us\nFONT=ter-232n' > /etc/vconsole.conf
|
||||
|
||||
# Setup the computer hostname
|
||||
echo 'deru' > /etc/hostname
|
||||
|
||||
# Setup the hosts file
|
||||
echo '127.0.0.1 localhost\n::1 localhost\n127.0.1.1 deru.localdomain deru' > /etc/hosts
|
||||
|
||||
# Set root password
|
||||
passwd
|
||||
|
||||
# Setup init hooks to use systemd
|
||||
vim /etc/mkinitcpio.conf
|
||||
# Remove udev and add systemd, sd-vconsole and sd-encrypt
|
||||
|
||||
# Regenerate initrd
|
||||
mkinitcpio -p linux-lts
|
||||
|
||||
# Setup systemd-boot
|
||||
bootctl --path=/boot install
|
||||
|
||||
# Create the bootloader entry for Arch
|
||||
LUKS_UUID=$(cryptsetup luksUUID /dev/nvme0n1p2)
|
||||
cat >/etc/loader/entries/arch.conf <<EOL
|
||||
title Arch Linux (LTS)
|
||||
linux /vmlinuz-linux-lts
|
||||
initrd /intel-ucode.img
|
||||
initrd /initramfs-linux-lts.img
|
||||
options rw luks.uuid=${LUKS_UUID} luks.name=${LUKS_UUID}=luks root=/dev/mapper/luks rootflags=subvol=root
|
||||
EOL
|
||||
|
||||
# Setup bootloader
|
||||
echo 'default arch.conf' > /boot/loader/loader.conf
|
||||
|
||||
# System ready!
|
||||
exit
|
||||
reboot
|
||||
|
||||
# Login as root
|
||||
|
||||
# Setup IWD to use it's own DHCP
|
||||
cat >/etc/iwd/main.con <<EOL
|
||||
[General]
|
||||
EnableNetworkConfiguration=true
|
||||
|
||||
[Network]
|
||||
NameResolvingService=systemd
|
||||
EOL
|
||||
|
||||
# Setup your wireless network
|
||||
iwctl station wlan0 connect <BSSID>
|
||||
echo 'AutoConnect=true' >> /var/lib/iwd/<BSSID>.pks
|
||||
|
||||
# Start and enable iwd and systemd-resolved services
|
||||
systemctl enable --now iwd
|
||||
systemctl enable --now systemd-resolved
|
||||
|
||||
# Setup hibernate
|
||||
# Get the swap disk UUID (double check this is the correct disk)
|
||||
sudo blkid | grep swap | sed -rn 's/^.*UUID=\"([a-z0-9\-]+)\".*$/\1/p'
|
||||
|
||||
# Add the resume boot parameter
|
||||
vim /boot/loader/entries/arch.conf
|
||||
# Under options:
|
||||
# resume=UUID=<uuid>
|
||||
# Systemd should check automatically for the swap partition on GPT tables [1]
|
||||
|
||||
# Setup suspend-then-hibernate
|
||||
vim /etc/systemd/login.conf
|
||||
# Find HandleLidSwitch and set `suspend-then-hibernate`.
|
||||
vim /etc/systemd/sleep.conf
|
||||
# Find HibernateDelaySec and set to 5min
|
||||
# All these will be into effect in next boot
|
||||
```
|
||||
|
||||
- [ ] IDLE toggle
|
||||
- [ ] Docked toggle
|
||||
- [ ] VConsole auto lock
|
|
@ -0,0 +1,62 @@
|
|||
title: Running Alpine Linux from USB on the Raspberry Pi 3
|
||||
---
|
||||
pub_date: 2021-12-31
|
||||
---
|
||||
body:
|
||||
|
||||
``` sh
|
||||
# Tested on Raspberry Pi 3
|
||||
# Create a Raspberry pi OS SD card
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
sudo rpi-update
|
||||
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
|
||||
reboot
|
||||
|
||||
# At this point the boot flag is enabled
|
||||
# Prepare the USB
|
||||
|
||||
# Install Alpine to USB Drive
|
||||
# Format USB
|
||||
# Create two partitions:
|
||||
# - boot fat16
|
||||
# - root ext4
|
||||
tar xzvf ~/Downloads/alpine-rpi-3.12.1-armhf.tar.gz
|
||||
|
||||
# boot/usercfg.txt:
|
||||
enable_uart=1 # Not sure I need this
|
||||
gpu_mem=32 # The minimal memory for the bootloader
|
||||
|
||||
setup-alpine
|
||||
apk update
|
||||
apk add cfdisk e2fsprogs
|
||||
mkfs.ext4 /dev/sda2
|
||||
|
||||
# Setup proper TZ
|
||||
apk add tzdata
|
||||
cp /usr/share/zoneinfo/Europe/Madrid /etc/localtime
|
||||
echo "Europe/Madrid" > /etc/timezone
|
||||
apk del tzdata
|
||||
|
||||
mount /dev/sda2 /mnt
|
||||
setup-disk -m sys /mnt
|
||||
mount -o remount,rw /media/sda1
|
||||
|
||||
rm -f /media/sda1/boot/*
|
||||
cd /mnt
|
||||
rm boot/boot # Remove symlink
|
||||
|
||||
mv boot/* /media/sda1/boot/
|
||||
rm -rf boot
|
||||
mkdir media/sda1
|
||||
|
||||
ln -s media/sda1/boot boot
|
||||
|
||||
# /mnt/etc/fstab
|
||||
# Remove cdrom
|
||||
# Add:
|
||||
/dev/sda1 /media/sda1 vfat default 0 0
|
||||
|
||||
# Edit boot cmdline to boot from the ext partition
|
||||
# /mnt
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue