123jk's Archlinux guide
BTW
So I've used this little thing called Archlinux for 3 years now, and it has been my main OS for almost 2 years. I've seen around a lot of
What is?
Arch isn't much different to any other linux distros on the surface.
Firstly, the packages on arch are much newer than the others (not as new as getting straight from source). That means newer features come faster on it than somethings like Ubuntu, but some bugs might appear bit more frequently.
Secondly, instead of releasing big updates within set times (point release), as soon as a new version to a program is available, it will be in the repo pretty fast(rolling release).
Finally, when installed using the official guide, it won't come with anything other than the essentials. You have to piece together everything all by yourself. From something small like your text editor, a web browser, to bigger and more important things like a graphical interface or a bootloader, the choice is yours. And you have to get really used to reading the wiki/app documents to work with your apps.
Arch isn't really a distro for someone new to linux, you will have to pour in more effort to get it running compare to somethings like Linux Mint or Fedora.
The installing
This section is heavily based on arch's own install guide plus some of my own experiences and other people's guides.
I'll assume you'll be having a computer with UEFI, all computers from around last 10 years would be that.
1: Pre-Install
a: getting media
Go to archlinux.org, head to the download page found on the top right corner. Scroll down until you see your country and click on one of the link below. Find the file named "archlinux-*.*.*-x86_64.iso" and download it to somewhere.
b: boot into machine
We want to make the iso booted on our machine. The way to do that today is to put it to a USB drive (aka a USB boot disk), so grab one of them, any USB big enough is ok. Make sure that it doesn't have any stuffs on it.
There are a lot of ways to make the USB media. You have rufus if you're doing it on windows. also works for . Ventoy, the one I use, allows you to put in multiple isos in a single usb and boot on all of these, and works
With all that done, plug it into the computer and reboot. We will boot into our install medium. This is done by pressing a key as soon the logo shows up, after which a menu appears, and you navigate to where to change the boot device, then choose your device and boot into that. This key varies between PC motherboard to laptops. Check what that key is and spam that sucker as fast as possible.
After waiting for some times, you should see some text on your screen with
c: getting internet in live media
First things first, we're gonna need to connect to the internet. We're gonna download a lot of things online. If you have ethernet, make sure the cable is plugged in. If you want to use Wi-fi, then follow these steps:
- 1. Check if your wifi card is not blocked with
rfkill. If your cards (usually under "Wireless LAN") - 2. Type
iwctl
Regardless, test your connection with ping(put a ip address or a url after it). If you are you should see it constantly prints out "64 bytes from ... ttl=XX time=XX", exit out of it by holding Ctrl+C.
d: disk partitioning + mounting
Find out what drives you wanna install to by typing fdisk -l. Your disk can be found under their names, and it may contain things like /dev/sda(if you got an SSD), /dev/hdb(spinning disk), or /dev/nvme0n1(nvme drive), be sure to note them somewhere.
Type fdisk *drive*, using the names mentioned above for your hard drive.
Now let's think about how our disk layouts will be. With a UEFI system, you'll need these partitions:
- EFI partition to boot into. 1 Gig for it should work.
- Root partition for your root folder
/
There are other partitions you might want, such as:
- A seperate home partition to seperate
/home(stores user files) from the root partition - A swap partition. Swap act as an extra virtual memory space. Swap can also be on a file or on zram.
Note what partitions you want and how big it should be.
In fdisk, first type g to set up the partition table. To create a new partition, type n, then enter the partition number, starting & ending sector. For most of this you can use the default, and for the ending sector, you can use + followed by the size of the partition (500M, 1G etc). Create as many of them as you need.
To check the list of partitions, type p
To set the type of the partition, type t. Then enter the partition number you want and then enter the type IDs for that.
Double check your table and when ready, type w and write all that to the disk.
With that done, we're going to format the partitions, with each a file system. For the EFI partition, it requires a FAT32 filesystem. To do so type mkfs.vfat -F 32 *efi partition*. For everything else (your root, home partition, etc), you can choose whatever you want. If you want ext4 (traditional file system), type mkfs.ext4 *partition*. If you want btrfs (newer, has subvolume for snapshot support), type mkfs.btrfs * partition*.
The next step is to mount our partition
2: Base System Installation
a: mirroring
We will download a good ammount of things to our system so choosing a closer location (a mirror server) to download will help speed up our downloads.
Using reflector, enter this:
reflector --country *country* --latest *N* --sort rate --save /etc/pacman.d/mirrorlist
Put your country name (I'm in Taiwan so I put it here. You can add multiple countries in this.) after --country and how many servers (I use 10 but 5 would be enough) after --latest.
b: first install of the packages
Do note that none of the apps and configs from the install media will carry to your environment. Also if you didn't get all the apps you want here you can do that later.
To install packages right now, use pacstrap -K /mnt *packages*, put any packages you want after it. base pkg is required, a linux kernel of any kind (linux(regular kernel), linux-LTS(older version with longer support), or linux-zen(modded kernel for better desktop use)) + firmwares (linux-firmware for all kernel) will also be needed, anything else is up for you to decide.
Obviously with only that you can't have a "real" system so here are some appls you might want:
- Microcodes - bug & security fixes for your CPUs.
intel-ucodefor intel based andamd-ucodefor AMD CPUs - Networking - like a network manager (ex:
NetworkManager,dhcpcd(+wpa_supplicant),netctl) - A console text editor - A lot of choices but some popular ones include
nano,vim&emacs - If you want to use the AUR then make sure you get
base-devel, and maybegit - If you want to install application with flatpak then add
flatpakto it
Check your packages and press enter. Go do something else while it's installing. Maybe check on it once in a while, something unexpected might happen.
3: Initial System Config
If anything went right then most of the works here are done. Some other things may be needed for your system to work
fstab generation
In short, a fstab files defines where and how your drive partitions are mounted to, the system can
A fstab can be automatically created with this command: genfstab -U /mnt >> /mnt/etc/fstab. Check the file
Chrooting
The rest of this section we will be going into our recently installed system to make more configs in there. For easy access we chroot into it. Do so with arch-chroot /mnt
Timezones & Locales
To set your timezones enter ln -sf /usr/share/zoneinfo/*Area*/*Location* /etc/localtime. To find your location search in the mentioned folder before: ls /usr/share/zoneinfo. Then run hwclock --systohc.
If setting up locale, edit /etc/locale.gen, uncomment (remove the # at the beginning) your desired locale (ex: en_US.UTF-8 UTF-8, de.DE.UTF-8 UTF-8). Run locale-gen to generate the locales. Then set it by creating /etc/locale.conf(touch /etc/locale.conf) and put in the locale in the file.
Set root password & Create a user
In your current system, you only have a root user to start with. It's a very powerful
Using your root account all the time is pretty dangerous, it's best to create a normal user for daily usage. Type useradd -m -G *group* *name*. If you need elevated privilages for administrations (eg systemctl, install & update with pacman, basically anything that needed sudo), add the user to the wheel group by adding wheel after -G. Remember to set a password for your user: passwd *user*
The bootloader
These appear after the logo when booting up and allow for loading our kernel and starting our OS. As with everything on linux, you have plenty to choose from. See here for a list of them.
We'll be using GRUB in this. Install needed packages with pacman -S grub efibootmgr.
Doing the works Arch
how to install packages
Arch uses pacman as it's package manager (not to be confused with a certain round yellow game character). This will be one of your main ways to get apps. Some operations are:
- To install packages (need root):
pacman -S *pkg* - To remove packages (itself) (root):
pacman -R *pkg* - To remove packages (+ dependency) (root):
pacman -Rs *pkg* - To remove packages (+ dependency & config) (root):
pacman -Rns *pkg* - To update all packages (root):
pacman -Syu - To sync repo (root):
pacman -Sy - To search packages in repo (online search):
pacman -Ss *pkg* - To search packages in local system:
pacman -Q *pkg*
The AUR
A big reason you're using arch. The Arch User Repository contains every "packages" provided by the users of the distro, if you can't find what you need, chances are you can find it in the AUR.
You saw that quotes on the word packages above, that's because the "package" on the AUR is technically NOT a real package. It's more accurately to say that the AUR is a collection of instructions that helps you make the package.
Quick explanation: On AUR, you'll find something called PKGBUILD. This file contains infos on how to build a package, such as: source code, dependencies, build options, & packaging option. The user gets the PKGBUILD, puts it in a seperate folder, use makepkg to build, then install the package it made.
To start, install base-devel. Then get the PKGBUILD for the package you want. A way to do it is to use git and clone the repo. Find the packages on the AUR page, on the package's page click on the link besides "Git Clone URL" to copy it. In terminal, change directory to somewhere and type git clone https://aur.archlinux.org/*pkg*.git. It should create a folder of the package's name with it's PKGBUILD in it. This makes it easy for updating as you can git pull and get new PKGBUILDs that way.
In the directory with your PKGBUILD, first check the content of PKGBUILD for any susicious codes in it. If it's safe, then type makepkg. It's recommended to add -si to it for auto dependency resolving (only with official repo, any AUR dependencies will have to install it manually) and install the packages for you. If you don't add the flags (or only add -s), after it builds, type pacman -U *-*.pkg.tar.zst to install.