Arch/Artix Linux Base Installation
The following post goes over performing an unencrypted base installation of Arch/Artix Linux (on bare-metal/virtual machine).
Last updated on 29 July, 2022 at 15:20 hrs.
Prepare Installation Media
- Download the (base) ISO image and create a bootable flash drive
- Figure out the disk’s name on your system; be careful to get this
correct otherwise you can very easily destroy your current system
- on Linux, use
lsblk
to figure out which disk to use - on MacOS, use
diskutil list
to figure out which disk to use - make sure you use the disk name, not a partition; partitions usually
end with a number or with
p1
(or similar).
- on Linux, use
- Using
dd
(if on MacOS, do this - others don’t seem to work):dd if=[path_to_iso] of=[disk] -bs=4M status=progress
- if on MacOS, the
status=progress
argument is not supported - you’ll have to useCtrl+t
to send a signal todd
to display its progress - also on MacOS, use
bs=4m
instead
- if on MacOS, the
- Using
cat
:cat [path_to_iso] > [disk]
- Using
cp
:cp [path_to_iso] [disk]
- Figure out the disk’s name on your system; be careful to get this
correct otherwise you can very easily destroy your current system
Setup Internet Connection
- If possible, use an Ethernet connection - almost always works out of the box
- For Wi-Fi in the live environment
Artix
sudo rfkill unblock wifi
connmanctl enable wifi
connmanctl agent on
connmanctl scan wifi
connmanctl services
connmanctl connect [service]
then enter password
Note: Sometimes, this only works after doing it in the interactive mode of
connmanctl
.Arch
nmtui
and setup
Partition Disk
- Figure out if you are on a UEFI system (if on UEFI, the directory
/sys/firmware/efi
should exist) - Run
lsblk
and find which disk to partition - Run
cfdisk /dev/[disk]
and partition the disk- BOOT partition (make it 1G); also set the bootable flag on it
- ROOT partition (make it more than 100G - this is where software packages will be installed to so make an informed decision based on the packages you expect to install on the system, as well as the amount of storage available)
- SWAP partition (at least as large as the RAM installed)
- Swap space is used by the OS in a few conditions; if memory pressure on RAM is very high, the OS may “swap” pages from RAM to disk (specifically to the SWAP partition).
- Another (arguably important) use for SWAP is to enable hibernation. When the system is called to hibernate, the OS copies all of the contents of RAM into SWAP (which is why SWAP should be at least the size of installed RAM) and shuts down the machine. On startup, the RAM is restored from SWAP and the system can resume.
- HOME partition (rest of the space)
- This is so that if you want to reinstall Linux, all of your files in the home directory can be preserved
- Even if you don’t plan to reinstall Linux, it may be wise to have such a partition - some problems may be simple to fix with a reinstall…
- Format the partitions
- If running UEFI, format boot partition as FAT-32
(
mkfs.fat -F 32 [part]
), otherwise just format all partitions as EXT4 (mkfs.ext4 [part]
) - If you created a SWAP partition, format it using
mkswap [part]
command. - You can also use the above
mkfs
/mkswap
commands with the-L [label]
argument which will set the partition labels (label
should typically beBOOT
,ROOT
,HOME
,SWAP
)
- If running UEFI, format boot partition as FAT-32
(
- Mount the partitions
- ROOT partition on
/mnt
, BOOT partition on/mnt/boot
, HOME partition on/mnt/home
mount [root_part] /mnt
mkdir /mnt/{boot,home}
mount [boot_part] /mnt/boot
mount [home_part] /mnt/home
- If you created a SWAP partition, run the
swapon [part]
command which will indicate to the OS that the partition can be used for paging/swaping (it’s opposite command isswapoff
).
- ROOT partition on
Install the System
- Artix (using
runit
as the init system)basestrap /mnt base base-devel runit elogind-runit linux linux-firmware vim
fstabgen -U /mnt >> /mnt/etc/fstab
- Arch
pacstrap /mnt base base-devel runit elogind-runit linux linux-firmware vim
genfstab -U /mnt >> /mnt/etc/fstab
Important: make sure that there are no duplicate
entries in the /mnt/etc/fstab
(file-system table) file (the
fstab
file specifies how the partitions should be
mounted)
chroot
Into the
System & Set Up
Artix
artix-chroot /mnt
Arch
arch-chroot /mnt
You’ll probably be in
sh
, runbash
if you want to use that insteadRe-arrange the
pacman
mirrors so that the ones closest to you are at the top (file/etc/pacman.d/mirrorlist
); you may get better download speeds(Artix) you may want to add the arch-linux mirrors to pacman so that you can get the software which artix’s mirrors don’t have yet;
Run
pacman -S artix-archlinux-support
and add theextra
,community
andmultilib
mirrors in the/etc/pacman.conf
file AFTER the artix mirrors[extra] Include = /etc/pacman.d/mirrorlist-arch [community] Include = /etc/pacman.d/mirrorlist-arch [multilib] Include = /etc/pacman.d/mirrorlist-arch
Run
pacman-key --populate
after this
Set timezone
ln -sf /usr/share/zoneinfo/[region]/[city] /etc/localtime
Update hardware clock
hwclock --systohc
Select the locales that you want (
vim /etc/locale.gen
and uncomment the ones you want; probably wanten_US.UTF-8
anden_US.ISO-8859-1
)locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
Install a network manager
pacman -S networkmanager networkmanager-runit
Run the network manager on boot (generally for a service
X
, this would be done using the commandln -s /etc/runit/sv/[X] /run/runit/service
, but therun/runit
directory is not mounted in this environment so runln -s /etc/runit/sv/NetworkManager /etc/runit/runsvdir/current
instead)Give your computer a name
echo [comp_name] > /etc/hostname
Some sensible defaults in the
/etc/hosts
file:127.0.0.1 localhost ::1 localhost 127.0.1.1 [comp_name].localdomain [comp_name]
Install bootloader
pacman -S grub
(also installos-prober
if dual booting, andefibootmgr
if on EFI system)Install
grub
on the disk- If using a UEFI system, run
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
- Else run
grub-install --recheck /dev/sda
- If using a UEFI system, run
grub-mkconfig -o /boot/grub/grub.cfg
Set root password with
passwd
Run
exit
to exit thechroot
environment,unmount -R /mnt
to recursively unmount all of the drive and finally reboot (remove the installation media so you don’t boot into it again)
Configure User
useradd -mG wheel [user]
- this creates the useruser
, creates their home directory and adds them to thewheel
group (to be used insudo
setup)- Set user’s password
passwd [user]
sudo
setup- Go to the
/etc/sudoers
file and uncomment the line which reads%wheel ALL =(ALL) ALL
to allow the members of thewheel
group to runroot
commands, as long as they know the password - If you want
wheel
users to also be able to execute commands likeshutdown
orpacman
, you can add the following line%wheel ALL =(ALL) NOPASSWD: [commands]
wherecommands
is a comma separated command list (use the absolute path to commands) - Also add the line
Defaults !tty_tickets
to prevent reentering the password when you spawn a new terminal
- Go to the
Next Steps…
The system, though bare-bores, is functional; after users log in,
they have a TTY. The next step is setting up a graphical environment,
which can be done in one of two ways: (1) is to install a desktop
environment (DE), which provides, out-of-the-box, a graphical
environment as well as a suite of (possibly custom) applications to
manage the system. The second way (2) is to install a display server
(e.g. xorg-server
), then a window manager
(e.g. dwm
), followed by every application/tool that the
user will require. While the latter is more involved, it provides much
more control over the system; it is what will be covered next.