This is a minimal installation of Arch Linux mounted at BTRFS filesystem and meant without Desktop Environment.
It is ideal for server setup because not much resources used for unecessary service.
pacman -Syy
pacman -S reflector
reflector -c "Indonesia" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist
timedatectl set-ntp true
Since we are installing in Legacy mode, your hard drive should be converted to MBR
:
fdisk /dev/sda
Inside fdisk menu, type o
to convert hard drive into MBR. Then save it by typing w
, and exit by q
Here are some of my Partition using Legacy mode:
Number | Start (sector) | End (sector) | Size | Code | Partition Type | Partition Name |
---|---|---|---|---|---|---|
1 | 2048 | xxxx |
20 GiB | 8300 | Linux filesystem | ROOT |
2 | xxxx |
xxxx |
xx GiB |
8300 | Linux filesystem | HOME |
3 | xxxx |
xxxx |
8 GiB |
8200 | Linux swap | SWAP |
xxxx
- start & end sector depends on your hardisk drive.
xx GiB
- the size of your partition can be adjust according to your hardisk size.
8 GiB
- the SWAP partition size can be adjust according to how big is your RAM capacity. I recommend the size to be similar with your RAM size.
For ROOT partition:
mkfs.btrfs -L ROOT /dev/sda1
For swap partition:
mkswap -L SWAP /dev/sda4
mount /dev/sda1 /mnt
btrfs sub cr /mnt/@
btrfs sub cr /mnt/@home
btrfs sub cr /mnt/@log
btrfs sub cr /mnt/@pkg
btrfs sub cr /mnt/@snapshots
Unmount Top Level ROOT partition:
umount /dev/sda2
Mount ROOT Subvolume @:
mount -o relatime,space_cache=v2,compress=lzo,subvol=@ /dev/sda1 /mnt
Create directory for each partitions and subvolumes:
mkdir -p /mnt/{boot/efi,home,var/log,var/cache/pacman/pkg,btrfs}
Mount ROOT Subvolume @home:
mount -o relatime,space_cache=v2,compress=lzo,subvol=@home /dev/sda2 /mnt/home
Mount ROOT Subvolume @log:
mount -o relatime,space_cache=v2,compress=lzo,subvol=@log /dev/sda1 /mnt/var/log
Mount ROOT Subvolume @pkg:
mount -o relatime,space_cache=v2,compress=lzo,subvol=@pkg /dev/sda1 /mnt/var/cache/pacman/pkg/
Mount ROOT Top Level volume for btrfs (optional):
mount -o relatime,space_cache=v2,compress=lzo,subvolid=5 /dev/sda1 /mnt/btrfs
Mount SWAP partition:
swapon /dev/sda2
Check your mounted partition by typing df -Th
and check if your swap memory is ready by free -h
pacstrap -i /mnt base base-devel linux-lts linux-firmware
generate fstab:
genfstab -U -p /mnt >> /mnt/etc/fstab
Then customize the generated fstab file: vi /mnt/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2 LABEL=ROOT
# this subvolume @ is removed ON PURPOSE
# /dev/sda1 LABEL=EFI
UUID=XXXX-XXXX /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
# UUID=XXXX-XXXX is created automatically DON'T CHANGE anything about it
# UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is created automatically DON'T CHANGE anything about it
# /dev/sda2 LABEL=ROOT
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /var/log btrfs rw,relatime,compress=lzo,space_cache=v2,subvol=@log 0 0
# /dev/sda2 LABEL=ROOT
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /var/cache/pacman/pkg btrfs rw,relatime,compress=lzo,space_cache=v2,subvol=@pkg 0 0
# /dev/sda2 LABEL=ROOT
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /btrfs btrfs rw,relatime,compress=lzo,space_cache=v2,subvolid=5 0 0
# /dev/sda3 LABEL=HOME
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 2
# /dev/sda4 LABEL=SWAP
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx none swap defaults 0 0
Change mode to root:
arch-chroot /mnt /bin/bash
List timezone: ls /usr/share/zoneinfo
to see available timezone in your area
In my case I choose Manila timezone:
ln -sf /usr/share/zoneinfo/Asia/Manila /etc/localtime
hwclock --systohc --utc
nano /etc/locale.gen
Uncomment desired language. Example:
en_US.UTF-8 UTF-8
id_ID.UTF-8 UTF-8
Then save progress.
Open locale.conf file nano /etc/locale.conf
then add the following:
LC_COLLATE=C
LANG=en_US.UTF-8
LC_TIME=en_US.UTF-8
Then type locale-gen
Create your hostname:
echo your_hostname > /etc/hostname
nano /etc/hosts
then add the following
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
127.0.1.1 localhost.localdomain your_hostname
Install dhcpcd service:
pacman -S dhcpcd
Then enable it:
systemctl enable dhcpcd
groupadd sudo
useradd -m -g users -G sudo,wheel,power,storage your-username
nano /etc/sudoers
find and uncomment:
%sudo ALL=(ALL)
Then save progress.
Change the user and root password:
passwd your-username
passwd root
Install grub bootloader:
pacman -S grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
Exit from root
exit
Unmount partitions, recursively.
umount -R /mnt
Press Ctrl+D
then reboot
Remember to unplug USB before booting your new Arch Linux.
After reboot we need to install additional AUR package manager. I prefer yay.
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
This is the whole point of using BTRFS filesystem, where timeshift and snapshots becomes handy in doing backup. It only takes literally seconds to execute backup. To do that we need to install timeshift.
yay -S timeshift
Your Arch Linux installation is finished from here. It can run but without Grapichal User Interface or pure command line.