How to install Arch Linux via the command line installation process. I will use UEFI, btrfs, zram, and install a popular Wayland compositor (niri).
NOTE: This video was re-uploaded in order to correct a major mistake (by omission) made in the first version of this video. I did not run the command to create the 'fstab' file. Oops!
Your support is very much appreciated. Thanks, guys!
AI Generated·May contain errors
Arch Linux is one of the most popular Linux distributions out there. It's also one of
the quickest and easiest to install. Today, I'm going to run through a traditional Arch Linux
installation using the command line install process. I'm going to install Arch Linux. I'm
going to install the base packages, the Linux kernel. I'm going to install the Neri window
manager, which is a Wayland compositor, so it's going to pull in Wayland for the display server.
We're going to partition the drive. I'm going to use ButterFS as our file system,
and I'm going to use ZRAM for a swap. I'm going to show you how to do all of that,
and this installation process is going to take 15 minutes or less, so go ahead and set a timer.
The first thing you need to do is you need to go get the ISO for Arch Linux. Go to archlinux.org
and click on the download page here, and then on the download page, there's a couple of different
methods to go and get the ISO. You can get it through a torrent, or you can just do a direct
download from several mirrors here. I've already downloaded the ISO, so I'm going to go ahead and
install Arch Linux. I'm going to run through an installation inside a virtual machine,
but the installation process is very similar whether it's a physical machine or a virtual
machine, so I'm going to open vert manager. That's what I use for my virtual machines,
and I'm going to go ahead and create a virtual machine. Let's browse my local downloads directory
for the Arch Linux ISO. There it is, and it has detected that that ISO is in fact Arch Linux. I'm
I'll give it two cores of my 24 core CPU, and then 20 gigs of disk space is fine, and I will name this
archlinux-install, and then I'm going to click finish here, and away we go. Let's go ahead and
make this full screen, and now we come to the command prompt. Now because I'm doing this on
camera, and I know you guys are going to have a problem reading the text, I'm going to go ahead
and change the font size here in the tty. So I'm going to run the command set font space,
and then this particular font tr-v32b makes us a much bigger font now. First thing you need to do
is ensure your system clock is accurate by syncing it with network time servers, and you use this
command here time-datectl set-ntp to true. Next we need to partition our drive, and I'm going to use
this particular program here. I'm going to go ahead and use a cfdisk. Cfdisk is capable of
doing both GPT and DOS partition tables, so UEFI and legacy BIOS. We're going to do UEFI today
because I think that's what almost everybody is on these days. So we need to choose a GPT label,
and then free space. Now the first thing we need to do is we need to create a EFI system partition,
and it needs to be about 512 megabytes. So I'm going to click on new partition. It needs to be
512M for 512 megabytes. Hit enter, and the partition type by default, it defaults to Linux
file system. We need to change that, so I'm going to move over to type, and I'm going to move up in
the menu to EFI system, and now we've got that, and then arrow down the free space that's available.
I'm going to make a new partition. I'm going to give the partition all of the available space
that's remaining, and then the type Linux file system is correct. So let's go ahead,
and I'm going to move over to write. Let me actually move my head out of the way. We need
to write, and it's going to ask you to confirm it by typing the full word yes, and then after that,
you hit quit, and you're back at the command line. Next, we need to make the file systems.
So the EFI partition needs to be a FAT32 file system, so let's MKFS for make file system dot
FAT, and then dash capital F32 for FAT32 slash dev slash, in this case, I know it's going to be
VDA1 in my virtual machine for the partition. Now, for you, you may need to figure out what
the partition is. You could do a LSBOK and find out what the partitions, but this virtual machine
always creates them as VDA1, VDA2. So for me, MKFS dot FAT dash capital F32, and then slash
dev slash VDA1, and that creates the FAT32 EFI partition, and then I'm going to up arrow,
and I'm going to run this command, make file system dot BTRFS, so we're going to make a
butter FS partition. We're going to give it this flag, dash L. We're going to give it a label,
arch root, and then the device is slash dev slash VDA2. In this case, it's the second partition,
and that made our butter FS partition, but since we chose butter FS, butter FS, you typically want
to set up with sub volumes. You want to be able to create snapshots at some point, so let's go
ahead and take care of all of that. So I'm going to mount my butter FS partition, which in my case
is slash dev slash VDA2, and I'm going to mount it to slash MNT, and then next I'm going to do
this command here, butter FS space sub volume, create, and then slash MNT slash, and then the
at symbol. Next I'm going to hit the up arrow key here, and rerun this command, except this time
I'm going to create slash MNT at home, and then I'm going to up arrow, and this time create slash
MNT at snapshots, and then one more time up arrow, and this time MNT slash at bar underscore log.
Now we need to go ahead and unmount, so do a umount space, and then slash MNT to unmount,
and then we're going to mount again. We had to unmount to mount again, because now we need to
mount them properly after creating the sub volume, so we're going to mount dash O, and then we're
going to give it a bunch of flags, no at time comma, no spaces between this, compress equals
ZSZSTD, and then comma, and then sub vol equals at, and then a space slash dev slash VDA2 is my
butter FS partition, space slash MNT. That's where we're going to mount it to. Next we want to create
some directories, so I'm going to make gear dash P, so we're going to create these directories,
and all the parent directories if needed, and we need to make slash MNT, so mount slash, and then
we're going to do this inside braces, because this will be a brace expansion. We're going to
create several directories. We're going to create mount slash boot comma slash home comma dot
snapshots comma, and then finally var slash log, and if I did that correctly, let's go ahead and
list slash MNT to see if those directories exist. They do, and now we need to mount all of those
directories we just created, and there were four of them, so I'm going to up arrow a couple of times,
remember this command here where we mounted VDA2 to slash mount. Well now what we need to do is
we're going to rerun a similar command. Let me scroll over, sub volume at needs to be at home,
so this time we're going to do at home, and then slash MNT slash home, and let me hit enter on
that. I'm going to up arrow, and now we need to do the snapshots, so this will be at snapshots,
because that was the mount point we created, and then the mount point is slash MNT slash dot
snapshots was the directory we created, and then up arrow, and the next sub volume that we need to
take care of here is var underscore log, and then that mount point is at slash MNT slash var slash
log, and then finally let's mount slash dev slash VDA1, which is our EFI partition that needs to be
mounted at our newly created slash mount slash boot. Now we can verify all of this with the
lsblk dash f, and that gives us our file system. Of course I'm zoomed in, so it may be kind of hard
to read. Another command you could do here is butterfs sub volume space list, and then slash
MNT, and there are our sub volumes there. Hey guys, sorry to interrupt the video here, but when I first
uploaded this video, I did make a mistake. I forgot this very important command, so I wanted to edit
this in. So one of the things you need to do while you're mounted, but before you cheroot into the
new installation, is you need to generate your FS tab file, your file system table, and you do that
on Arch Linux using the gen fs tab command, and you run this command here gen fs tab space dash
capital U space slash MNT, because we're mounted at this point, and then the two right pointing
chevrons, your two greater than signs, and that writes over into this file slash MNT slash etc
slash fs tab, and that generates your file system table automatically. That will make sure that the
table includes the sub volume information about our butterfs sub volumes, because if you forget
this command, and the reason I did forget this command, when I reboot later on this video, you
will see that I have an error when I log in as my DT home user, is that he doesn't have a home
directory for some reason, and that didn't make sense, and the reason it didn't make sense is
because my home directory is a butterfs sub volume, and without generating the FS tab, you get an
error, so be sure to run this command again. You need to run this command after you're mounted,
but before you chroot. Now back to your regularly scheduled program, and that really is the most
complicated part is setting up the partitions, and the sub volumes for butterfs. Let's go ahead
and do a quick base install. Now I'm already mounted into vda2 slash MNT, so let's go ahead
and run the basic packstrap command. So what this will do, this will install the base arch system,
so you packstrap slash MNT, and then install certain packages like base, which is the base
packages, linux, which is your kernel, linux-firmware, which is very important. I'm going to install a
couple of other packages I know I'm going to need, so I might as well do them now, sudo and vim,
because I need a proper text editor, and now it's going to install all of the base system, plus sudo
and vim. This will take a couple of minutes, but that installation went very quick. It only took
about a minute to install those packages, and next we need to chroot into our new installation.
So I'm going to run the command arch dash chroot to change the root file system over into slash
MNT. That is where our future arch linux installation is mounted to. First, let's set
the time zone, so we need to run timedatectl and then list dash time zones. Now this gives you a
list of all the available time zones on the system. For me, I know mine is America slash Chicago. I
don't live in Chicago, but Chicago is in the central time zone. I'm in the central time zone,
so if you're unsure about your region slash city, because you need that region slash city, and you
need to get that information, and then you need to run the timedatectl command set dash time zone,
and then region slash city. So for me, America slash Chicago, and if it doesn't give you an error
message, it was set correctly. Next, we need to set the hardware clock, so do hwclock, so hardware
clock dash dash systohc, and then hit enter. That's all you need to do there, and then let's go ahead
and set the locale. So nano is on the system. You can use nano as your editor. For me, I'm going to
use vim because that's why I installed it, and I'm going to use vim slash etsy slash locale dot gen
is the file we need to edit, and I need to search for a specific locale to uncomment. Every line in
this file is commented. I'm going to search for English underscore U.S., so let's go down to that
line, and there it is, and I just need to uncomment that. Then let me write and quit, and now we set
English U.S. to our locale. Of course, that just changes a line in the file. To actually set it, we
One final file I want to edit is the slash etsy slash locale dot conf, which is an empty file,
and I need to do lang, all caps, equals, and then en underscore U.S. dot utf dash eight,
and then write and quit out of that. Next, let's set our host name, so I'm going to vim slash etsy
slash host name. This is the file that contains the host name of the computer. I'm going to call
this computer Arch, so that will be the host name of the computer. Next, I'm going to up arrow, and
let's also edit slash etsy slash host. This file already exists, and it's correct. There's no need
to edit this. In old days, this used to not be a file that contained stuff. You actually had to
write all of this yourself. Now, you don't, so great, nothing to do there. Next, let's set our
passwords. Right now, of course, I'm logged in as the root user. The root user is the only user on
the system, so let's go ahead and set his password. Let's do passwd to set the password.
I'm going to give the root user a strong and complicated password. Hit enter, retype the
password. There we go. Now, let's go ahead and create our normal user. I'm going to do a user
add dash m dt is my normal username, right, so now we need to go ahead and create a password for dt,
so passwd space dt to create dt's password. Confirm, and we set his password. We need to make
sure dt is actually added to some groups on the system, so we're going to do a usermod dash
lowercase a capital g to add him to some groups. We're going to add him to these groups, wheel,
comma, audio, comma, video, comma. It's very important, no spaces here, and then optical,
comma, storage, comma, input, comma, and then finally space dt. dt is the user we're adding
all of this to, and there we go. Now, remember earlier we installed sudo. We need to make sure
that dt has sudo privileges. We added him to the wheel group, so that gives him sudo privileges,
but only if we allow every member of the wheel group to have sudo privileges, and to do that,
we need to run the command visudo to get into the sudoers file, and we need to scroll down
to the line where we find wheel. We could actually just search for wheel. There we go.
This is the line right here, and it says uncomment to allow members of the wheel group to execute any
command, so let's go ahead and uncomment that, and then write and quit. Next, let's go ahead
and install a package called zram-generator because we haven't set up the swap yet. I'm
going to use zram as a swap, so pacman dash capital s zram-generator, and let's go ahead
and install that, and then I need to vim slash etsy slash systemd slash and then zram dash
generator dot comp is the file, and we need to actually write this file ourselves. So, at the
top inside brackets, we need to write zram zero, and then next line we need to do zram dash size
equals, and it's going to equal our ram divided by two, so the zram size is half of our ram size.
Next line is compression dash algorithm, if I type that correctly, equals zstd is the standard
algorithm compression. Next is swap dash priority equals 100, and then finally mount dash point
equals slash dev slash zram zero, and then write and quit out of that. Now, later we will need to
actually enable zram through systemctl through systemd, but we can't do that right now inside
this rooted environment, but we'll do that at the end. Next up, let's go ahead and install grub
because we need a boot loader, so let's pacman dash capital s grub, and because we're doing efi,
let's also install efibootmgr, efibootmanager. Let's install those two packages. We need to
make here, so we need to make another directory, dash p, and this needs to be at slash boot slash
efi. That's our efi partition there, and then finally mount slash dev slash vda1 is our efi
partition. We need to mount that to slash boot slash efi, and then this command here, the grub
install command to install grub, space dash dash target equals x86 underscore 64 dash efi space
dash dash efi dash directory equals slash boot slash efi, and then space dash dash boot loader
dash id equals grub all caps. Very lengthy command, but it's important we get this right,
and no error reported, and then finally we need to run the grub dash make config command, so grub
mkconfig dash o, and that needs to be at boot slash grub slash grub dot cfg. Now let's actually
install some packages and like graphical packages and stuff. First, for networking, I know I want
network manager, so I'm going to pacman dash capital s network manager. It just makes getting
internet and wi-fi and everything set up so much easier. I'm going to install sddm, which is going
to be our login manager. Let's just install those two packages for now, and now that we've done that,
I don't think we can enable them in this cherooted environment, but let's see network manager with a
capital n and a capital m, and yeah it can't create that because systemd is not running,
so we've got to do this outside of the cherooted environment. I'll remember to enable that here in
a minute. We also need to make sure that we enable zram in a minute as well, so we've got a lot of
systemd services to enable here in a minute, but let's continue with pacman dash capital s. Let's
install everything we need, so I'm going to go ahead and install base devel because I know I'm
going to need that. I'm going to need git as well. Base devel and git are needed if you ever plan on
installing anything from the aur because it has to be able to build packages, and base devel
contains a lot of the make tools. Git of course is how it downloads things, so we need those two
packages. Let's go ahead and install the aur helper. Let me go ahead and su over into the dt user
because you can't install aur packages as root. You have to be a normal user, so I'm going to switch
over to my dt user, and I need to switch over to his home directory, so I need to just hit the cd
command, and if I do print working directory, I am in slash home slash dt. Let's go ahead and run a
git clone https colon slash slash aur dot arch linux dot org slash yay dot get. Let's install
the yay aur helper, so that just cloned the yay directory, so let's cd into yay, and then let's
run the command make pkg make package dash si, and this makes the yay binary package. It installs it
for us as well. We need to give it sudo privileges at the end to install the package, and yay finished
installing, and then finally what I need to do is now I need to do a sudo pacman dash double s
because I have to use sudo now that I'm the dt user, and I'm going to install this list of packages.
I'm going to install alacrity for the terminal, then my window manager will be niri, pcmanfm for
a file manager, and then various other utilities quickshell, swaybg for setting wallpaper, swayidle
to put my screens to sleep, swaylock for lock screen, some font families as well as some desktop
portals. I'm going to use the gnome desktop portal and the weyland wl roots portal as well. Let's go
ahead and run that, give my sudo password, and away we go, and then I need to install some aur
packages that are very important to me. Brave is my browser, dms is the dank material shell for niri,
which I love, and then the microsoft fonts, and then waypaper for being able to set wallpaper in
a weyland compositor. So I'm going to run all of that, and all of that installed correctly. Finally
we need to exit out of the chroot, so let's hit exit. I might need to exit a couple of times
because I was logged in as dt, so my exit exited back out to the root user, and then one more exit
gets us back to root at archiso. Now I am still mounted. If I do an lsb, okay you can see I'm
still mounted. Let's do a umount to unmount, dash l for a lazy unmount, and now we're unmounted. What
I want to do is I want to go ahead and reboot the machine, and when it reboots, let's just make sure
grub is working, and if everything is working, then finally the last thing I need to do is enable
those systemd services. So we get a prompt, let me log in as my dt user. I get an error that his home
directory doesn't exist. I need to do something about that. Let me change the tty font to something
different here, so you guys can see the command. I need to make dt's user, so I need to go ahead
and sudo make-gear slash home slash dt, and now we've made his home user, so I won't get that
error message anymore, and then finally let's go ahead and enable those systemd services. So sudo
systemctl, we need to go ahead and start slash dev slash zram zero. That's our zram swap, and then
going to up arrow, sudo systemctl. Let's go ahead and enable dash dash now network manager, and again
capital n capital m, and then finally let's go ahead systemctl enable sddm for our login manager,
and now let's reboot and see if it boots us directly into sddm. Then we get our login manager,
so let's see if we can log into niri, and we get a black screen. I'm assuming that's going to be a
virtual machine graphics driver problem, but let's go ahead and solve the virtual machine problem,
because some of you guys are probably going to install this in vert manager. So let me force
off the machine here. Let's go into the settings. I know what the problem is, so let's go into the
settings. We need to make sure our device driver is vertio. It needs 3d acceleration, so let's turn
that on. Also go to display spice and make sure that listen type is none, and let's turn on the
open gl. Let's hit apply. Let's go ahead and restart the machine. Make it full screen, and now let's go
ahead and log into niri, and there we go. Niri, it's not set up. It's not configured in any way.
There's no way you would be able to just immediately use niri and do anything. You've
got a terminal and some other basic stuff. I installed the brave browser, but you'd have to
do a lot of configuration from this point, but this was just the basic command line arch linux
installation. From there, you go ahead and tweak things. You configure it to your liking, but this
arch linux installation, this command line manual way of installing arch linux, it's not nearly as
hard as people make it out to be, and I have no idea if this installation process came out to 15
minutes. I talk a little bit. I ramble on, but this was pretty quick, right? This is not something
that's going to take even if you take your time reading the arch linux wiki. This definitely
should not take more than about half an hour for most people. Now, before I go, I need to thank a
few special people. I need to thank the producers of this episode, Matt, Steve, George, Darloff, Lee,
Mark, Methos, Erjan, Peacearch, Medora, Roland, Wargen2, and Ubuntu, and Willie. These guys,
they're my highest tiered patrons over on Patreon. Without these guys, this quick little episode
about installing arch linux, the arch way would not have been possible. The show is also brought
to you by each and every one of these fine ladies and gentlemen, all these names you're seeing on
the screen. These are all my supporters over on Patreon because I don't have any corporate
sponsors. I'm sponsored by you guys, the community. If you like my work and want to see more videos
about Linux and free and open source software, subscribe to DistroTube over on Patreon. Peace,
guys.