Skip to content

Instantly share code, notes, and snippets.

@Trivoz
Created April 5, 2023 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Trivoz/b50ec89f0967c66cb58e765071663ba2 to your computer and use it in GitHub Desktop.
Save Trivoz/b50ec89f0967c66cb58e765071663ba2 to your computer and use it in GitHub Desktop.
Arch Linux Installation for Beginners

Arch Rice

This file is meant to be a guide for me (and anyone else) that can just simply install something that looks decent with minimal effort. A lot of the stuff I see nowdays isn't that well layed out (apart from the actual arch docs) but even then, the documentation couldn't possibly format (into a simple, consise manner) the great amount of errors and edge cases one might encounter when trying to follow a step. Unfortunately this guide doesn't cover that either, as that would take me... years? Dedcades? Probably a really long time.

But nonetheless, this guide is for myself and suits my needs but contributions are welcome.

Installation

This part is 1/2 of the installation when it comes to this sort of setup. This installation component should cover essentially every arch linux installation process (or somethilng like that). Anyways, here it is, (chronologically, of course):

1. Connect to internet.

This part is fairly straight forward and I would highly recommend investing in an ethernet as it means that you don't have to setup internet manually, however if you choose to do so, then iwctl is a fairly straightforward cli that i use on my laptop when I don't have ethernet.

2. Identify Hardware

You don't want to screw this part up. Seriously. If you're not careful you could overwrite your entire system on accident. Becaue of this it's super important that you know exactly what storage device you're installing arch on. If you're super worried about this and want to triple check everything, a pretty straightforward thing I do is this.

Triple Check!

I list all of the storage devices on my system with lsblk. if this is done when you're not installing, you'll see something like this:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1     259:0    0 119.2G  0 disk
├─nvme0n1p1 259:1    0   300M  0 part
└─nvme0n1p2 259:2    0 118.9G  0 part /

So, in this case, you can see that nvme0n1 is a disk because in the TYPE column we can see that it's a disk. The part in the TYPE column just stands for parition. I'll describe what partitions are briefly.

If you're coming from a windows OS, you might be familiar with the %USERPROfILE% or C:\Users\<user> directory. This is known as the user or home partition. It gives the user permission for whatever it needs to do, and tells it to enter a password when it wants to access a partition like C:\ProgramFiles (x86) that it doesn't have access to.

Simply put, a partition is just a section of space that the computer allocates for a very specific purpose. At this phase of the installation, we're interested in creating 3 partitions with 3 purposes.

  • The boot partition. This partition is used whenever the computer needs to, as the name suggests, boot the computer. The computer needs to load all sorts of files so that the computer can work properly, and the boot partition simply is a location in the computer that stores all of those helpful files!
  • root partition Linux users may be familiar with folders like /bin /etc /usr and /var. These are all part of the root partition. The root partition is similar to the boot partition, except it's always there! It's needed constantly and therefore it's pretty delicate. Because of this, the computer assigns special protection to the root partition so that nothing bad can happen.
  • home partition The home partition if you're on windows is similar to your Users<user> location. It's where all of your documents, pictures, downloads and anything else that the user needs to interact with on a common basis are stored. Because of this, the computer isn't as strict. It knows that the user needs to access these things a lot, and so it loosens up a bit and lets the user manage their home partition however they want. THey can create new files, delete files and a lot of other things that's needed in a computer. But you can imagine why that would be harmful to the boot partition or the root partition! To make sure that you're installing only on the storage device you want, we can mount (which is a fancy word for access/view) a storage device. Let's say that I have 2 drives. One windows, and one linux. Both have installations and I don't want to get it wrong. lsblk would display the storage structure of each drive attatched to the system:
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda             8:0    0 931.5G  0 disk 
├─sda1          8:1    0   512M  0 part /boot/efi
├─sda2          8:2    0   732G  0 part /home
└─sda3          8:3    0 199.8G  0 part /
sdb             8:16   0 465.8G  0 disk 
├─sdb1          8:17   0   499M  0 part 
├─sdb2          8:18   0    99M  0 part 
├─sdb3          8:19   0    16M  0 part 
├─sdb4          8:20   0 332.7G  0 part 
├─sdb5          8:21   0  19.5G  0 part 
└─sdb6          8:22   0 112.9G  0 part 

In this example sbd is our windows installation. We can see this because in the SIZE column you can tell the size of your drives and you should know which one is smaller or larger. But say you don't. In this case, we can see that MOUNTPOINT has /boot/efi and /home listed. These is a very linux like file structure because the /boot directory is specific to linux.

But say you really wanted to make sure because you, idk, have secret CIA documents on sdb and really don't want to lose them. Well, what you can do is preview the contents of sdb by mounting it (making it accessible and viewable) to our current installation environment. The folder that is used for mounting things like this is, aptly named: /mnt. So to do this, we can recognize that sdb4 is likely partitioned as a viewable drive that is easy to recognize so we'll load that. Running mount /dev/sdb4 /mnt will then load the sdb4 partition in the /mnt folder. Running ls -R /mnt/sdb4/ | less will recursively list the content of sdb4 and less will allow us to navigate the output as if it were loaded in vi or nano.

From there you should be able to see exactly what you're dealing with and exactly what drive you do and don't want to install on.

Now that that's out of the way, let's dive into the meat of this guide.

Partitioning a Disk

I explained all about partitioning in the previous section so if you've got no idea what I'm talking about, read that. Now, for partioning I'll remind you that, once you've allocated a drive to install (assuming that you've followed previous steps) you can now wipe the drive of any existing partitions that windows (or you) may have created. If it's a fresh drive, it's still best to do this anyway, just in case.

In this case, I'll be using the file structure I provided previously, but I'll put it below just so you don't have to scroll.

NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda             8:0    0 931.5G  0 disk 
├─sda1          8:1    0   512M  0 part /boot/efi
├─sda2          8:2    0   732G  0 part /home
└─sda3          8:3    0 199.8G  0 part /
sdb             8:16   0 465.8G  0 disk 
├─sdb1          8:17   0   499M  0 part 
├─sdb2          8:18   0    99M  0 part 
├─sdb3          8:19   0    16M  0 part 
├─sdb4          8:20   0 332.7G  0 part 
├─sdb5          8:21   0  19.5G  0 part 
└─sdb6          8:22   0 112.9G  0 part 

sda is our linux drive and sdb is our windows drive. We want to re-install linux on our linux (sda) drive.

First, lets completely remove the sda1, sda2 and sda3 partitions on our linux drive. Let's make sure though that we unmount it first for safety.

sudo umount /dev/sda*

Now we can use fdisk to remove the partitions as follows:

sudo fdisk /dev/sda

At this point a GUI should show up with a few info tiles down the bottom for help. I'd advise typing p to print out all partitions to make sure you've selected the right disk.

Then after this, you can type d to delete each partition. After this, to write changes to the disk, you can type w followed by y or yes to confirm.

At this point, you should now see something like this:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   100M  0 part 
├─sda2   8:2    0    16M  0 part 
└─sda3   8:3    0 465.6G  0 part 
sdb      8:16   0 465.8G  0 disk 
├─sdb1   8:17   0   499M  0 part 
├─sdb2   8:18   0    99M  0 part 
├─sdb3   8:19   0    16M  0 part 
├─sdb4   8:20   0 332.7G  0 part 
├─sdb5   8:21   0  19.5G  0 part 
└─sdb6   8:22   0 112.9G  0 part 

You may be panicking thinking that all of your drives are now deleted because they seem identical, however sdb simply isn't loaded; thus permissions don't let you see the contents / state of each drive. Additionally, the NTFS file system complicates things in the way that it's specific to windows and partitioning a device to boot windows can be a whole nother ordeal.

-- note: i am working on this and this guide is not finished. This is just a note to say where i left off --

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment