Arch btw

Or as some call it: installing Arch the real way

Inspired by https://retuow.github.io/

This guide shows you how I install Arch on my machines. My average Arch Linux computers all run EFI, are x86_64 and have SSDs.

I expect that you already flashed a USB drive and booted from it. Now you should find yourself in a creepy shell. We’ll work around that, please bear with me.

Setting your keyboard

Since I’m German I also have a German keyboard. To set the proper keyboard layout use something like

loadkeys de-latin1-nodeadkeys

Getting internet

If you’re connected through LAN everything is already set up. Use iwctl if you want to connect via WiFi for some reason. It’s usually just executing the utility and then entering (assuming your WiFi device is wlan0 and your SSID koyu.wifi)

device list
station wlan0 scan
station wlan0 get-networks
station wlan0 connect koyu.wifi

You can then ping koyu.space to see if you can connect to the internet. That should usually work fine. If not check your network configuration. If you don’t have WiFi or LAN use your smartphone as a LAN adapter through USB tethering. You might have to install additional firmware to make your WiFi card work if you plan to use your PC without your smartphone.

Formatting your disk

To format your disk first we have to find out which one to format. Run lsblk to get all your disks and partitions. In my case the disk is /dev/sda. If you happen to have an NVME drive or more than one drive in your system choose the correct one.

Once we determined the correct disk to format we will dd random junk onto it so we can actually partition it. Assuming it’s /dev/sda we can do it like this

dd if=/dev/urandom of=/dev/sda bs=4M count=1
sync

Now run cfdisk /dev/sda to create a new partition table and partitions. Since we’re on EFI make sure you use a GPT partition layout. A partition is basically a virtual sub-disk of your disk.

Then set it up like this

PartitionSizeType
/dev/sda1500MBEFI (can be found at the very top)
/dev/sda2Rest of the diskLinux (default, leave as is)

After that format the partitions

mkfs.vfat /dev/sda1
mkfs.ext4 /dev/sda2

If it complains about something always press y to confirm.

Then mount the partitions

mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

Installing Arch Linux

Now we’re coming to the fun part: installing Arch. We use pacstrap for that.

pacstrap /mnt base base-devel sudo nano git wget curl bash-completion linux linux-firmware

This installs a base system with sudo, development utilities (needed to compile from the AUR), bash completion and the linux kernel and its firmware.

Let it download and install all the packages and then write the partition configuration to the disk using

genfstab -p /mnt > /mnt/etc/fstab

Technically this is a finished Arch installation. But we’re still missing a few things.

Post-install configuration

First chroot into the Arch system

arch-chroot /mnt

Then install a “bootloader”. Well, technically this isn’t a bootloader since we’re booting the kernel using our EFI firmware. This is called EFISTUB.

pacman -Sy efibootmgr
efibootmgr -c -d /dev/sda -p 1 -l \vmlinuz-linux -L "Arch Linux" -u "initrd=initramfs-linux.img root=/dev/sda2"

Of course replace the partitions in that command with the ones you created.

Now we have to change the password of our root user using passwd. Just execute it, you’re already root on your system. It is also perfectly normal for the password prompt not to print out asterisks. The root user is basically the super admin. It has all the privileges on your system.

If you want to give your system a name enter

echo yourhostname > /etc/hostname

While we’re at it we can change our sudo configuration so your normal user can do administrative tasks without having to ask root for it all the time. Run nano /etc/sudoers to edit that configuration file. Ignore the warning at the bottom and press Ctrl-W to search for the word “wheel” (without quotes). Now comment out the line that says something about the wheel group. Save it with Ctrl-X, confirm with y and press enter. This will be important once we create our first user.

Now you’re back in the shell and configured everything about administration. Let’s configure pacman using nano /etc/pacman.conf. I usually comment out Color which makes pacman more colourful and the multilib repository so I can install things like Steam or Wine which use 32-bit libraries. If you commented out multilib make sure to refresh pacman using pacman -Sy.

Once that’s done we’re configuring localization. For German localization I use these commands. If you’re American you don’t have to configure anything except timezones and NTP. Don’t type out the commands with a hashtag, these are just comments.

# Configure NTP and timezone
pacman -S ntp
systemctl enable ntpd
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# Configure locales
echo de_DE.UTF-8 > /etc/locale.gen
echo LANG=de_DE.UTF-8 > /etc/locale.conf
locale-gen
# Configure TTY keyboard layout
echo KEYMAP=de-latin1-nodeadkeys > /etc/vconsole.conf

Now let’s create our first user. In this case I use the username koyu. You can choose your own of course.

useradd koyu
passwd koyu
usermod -aG wheel koyu
mkdir /home/koyu
chown -R koyu:koyu /home/koyu

After this we can install and enable NetworkManager which is responsible for internet access after the installation.

pacman -S networkmanager
systemctl enable NetworkManager
systemctl disable NetworkManager-wait-online.service

We disable the last service to cut boot times. That service usually waits for your system to come online, but sometimes your PC boots up faster than your router can give you an IP address. This is usually fine for server environments, but not for daily usage. More about that here.

Now we want to install an AUR manager. This allows you to install third-party packages found on the AUR. I prefer yay so let’s install it. Please note that you have to switch to your user, not koyu.

su - koyu
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -sifc

Now it should prompt you for a password, install dependencies, build yay and install it.

Once that’s done you can exit out of that using Ctrl-D and out of the chroot as well with Ctrl-D. Type in reboot and press enter or press Ctrl-Alt-Del to reboot. Your system will reboot and you should eject your USB drive

Installing a desktop

Now your system should boot into a login prompt. If that’s successful you can install a desktop. Check out the Arch Wiki on how to install them. You will also need a display manager to go along with it and reconnect to WiFi using sudo nmtui. If you have a Nvidia card make sure you install the nvidia package, otherwise you will be unable to utilize your entire graphics card. Here are guides on how to install the most popular desktop environments:

They all differ in functionality, ease of use and performance. I prefer XFCE, but it can be cumbersome to set up. For newbies I can recommend Cinnamon since it’s very fleshed out. Just make sure you installed a display manager like LightDM or GDM.

More information

For more information check out the Arch Wiki and the General Recommendations to make the most of your system. Especially the Arch Wiki is a great resource to understand your system, properly use and maintain it.

Leave a Reply

Your email address will not be published. Required fields are marked *