Installing and Making Arch linux Usable Part 1

Recently I installed Arch Linux, a simple lightweight Linux distrobution. Here's a guide on how I installed it.

Note: If you have never installed Linux before, this guide (nor this OS) is for you. If you are looking for something that "Just works", I would recommend finding a guide to install something like Pop_OS! or Ubuntu.

According to the Arch linux website, Arch is a simple and lightweight OS. I like it for it's flexibility, where I can customize anything on it. A lot of people like it for how it goes by the KISS standard (Keep It Simple, Stupid.)

However, Arch linux is known to be one of the hardest linux distributions to install (Using Arch linux has somewhat became a badge in the linux community) because it starts with only a bootable of a command line. You have to do the rest.

Flashing it

The first thing to do is flashing Arch on a USB. I use etcher or UNetBootIN.

To download Arch (you can use bittorrent or http mirrors) , you will have to verify it. After downloading it, run this command

(Of Course italics is where you put the filename.)

gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig

If it says OK, you can use that iso. Load it up into etcher or UNetBootIN.

Installing it

Reboot your computer. Now when it restarts, open up your BIOS boot menu (to get to mine, I have to press the ThinkVantage button then F12.)

It may take a little while for the OS to load, but when it does, it will look like this:

the grub on first boot

Press enter. Yet again, you will have to wait a little while for arch to open up. When it's done you will see this prompt:


root@archiso/#

Now we can start.

Note: this guide will be for legacy boot (BIOS) machines. Note: You will need Ethernet to do this.

type this command:

ping www.google.com

If it brings any data packs back, you have working internet. If you do not, Plug in a Ethernet cord and reboot.

Next you need the system clock to be set. Run this commands:

timedatectl set-ntp true

Partitioning the disk

Note: This guide isn't about how to dual boot. If you want to dual-boot, find another guide for this part.

Run the lsblk command:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0         0      111.8G  0 disk 
├─sda1   8:1          0     91G       0 part    /
└─sda2   8:2         0     20.8G  0 part     [SWAP]

Here is what lsblk shows on my machine. We are looking for the partition that says disk (mine is sda.)

Next you want to run cfdisk

cfdisk

cfdisk is a TUI (textual user interface) that does what fdisk does. I highly recommend cfdisk because it is a lot less confusing then fdisk.

It may or may not ask you to select a label type. Since we are doing this on a BIOS system, select dos.

You will then be greeted by this screen:

Someone's cfdisk.

If it doesn't say free space, delete all the partitions that have sda in the name.

Next you will want to click New. It will ask you want the size to be. leave a little room for swap later, but don't worry about it yet.

It will ask you in it's your primary or extended partition. Click primary.

Now you should see sda1 at the top of your cfdisk. You will want to make it bootable by toggling the boot button.

Now we will move on to making the swap partition.

What is a swap partition?

When your RAM (random access memory) runs out of space, all the overflowing RAM will be put into the swap partition. The swap partition is like overflow parking for RAM.

If you have a lot of RAM, you don't need much swap. 4gb will do.

While you are in cfdisk, Using the >>free space that is left, make a new partition.

This one will be an extended partition. Don't toggle the boot.

Now you can write the changes to the disk and exit.

Formatting the partitions

Next you will have to format your partitions.

Write this command to format /dev/sda1:

# mkfs.ext4 /dev/sda1

That command will format your /dev/sda1 partition with the ext4 file system.

To format swap, type this:

# mkswap /dev/sda2
# swapon /dev/sda2

Mounting the filesystem

Mount the filesystem:

# mount /dev/sda1 /mnt

Now the partitions are mounted and you can theoretically go into it. We will do that in later steps, thought.

The actual install

Now you will have to go and change what mirrors you want to use.

Using Vim or nano (depending on which text editor you are more comfortable with,) edit /etc/pacman.d/mirrorlist.

It will have a bunch of mirrors that you can rearrange to your hearts content

The mirrors higher in the list are prioritized. That means when you are looking for a package, It will look for it in the highest to lowest. You should probably put the ones in your country first, since the speed will be a bit better.

Since I live in Canada, I put all the Canadian mirrors first in the file then all the American ones.

Ones you are done, you can save & exit then type this:

# pacstrap /mnt base linux linux-firmware

This will actually install the linux kernel onto your drive. It may take a little while.

Fine tuning

Type this command:

# genfstab -U /mnt >> /mnt/etc/fstab

That will generate your fstab file, which pretty much just makes sure you don't mess up your filesystem too much.

Type this command:

# arch-chroot /mnt

Huzzah! You are now in the arch install. All you have to do now is configure it and install a boot loader.

Type this in to set the time zone:

ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

Replace the Region and the City with your own and press enter.

If you don't know your Region/City, I made this pastebin with all the regions then the cities.

Run this command:

# hwclock --systohc

This will generate your clock

Next you will have to set your locale.

Uncomment your locale (probably en_US.UTF-8,) in /etc/locale.gen. You will notice you no longer have a text editor on your computer. Install one by running pacman -S nano.

Then run this;

# locale-gen

That will generate most of the locale for you.

Add LANG=en_US.UTF-8 to /etc/locale.conf(new file.)

Next we will make a password for root.

passwd

Network configuration

Think Long and hard about what you want your hostname to be. Type it up into /etc/hostname.

Next you will want to type this into /etc/hosts:

127.0.0.1	localhost
::1		localhost
127.0.1.1	myhostname.localdomain	myhostname

Replace myhostname with your hostname and save+quit.

Next you will install Iwd, a network manager for the CLI.

enable it via systemd:

# systemctl enable iwd.service

Here's the ArchWiki page about how to use Iwd.

Installing GRUB

Now we are almost done! The only thing we need is a boot loader. Now, since we are doing this on a Legacy Boot system, we will use good ol' GRUB.

Type these commands:

# pacman -S grub
# grub-install /dev/sda
# grub-mkconfig /boot/grub/grub.cfg

That will install Grub onto your machine.

Users and groups

It is very unsafe to always use root, so we will make a new account.

useradd -m connor

Obviously you will replace connor with your name. Make sure you have the -m flag, as that will make your ~ filesystem.

Type this command:

# passwd connor

Next add the account to some groups.

usermod -aG wheel,audio,video,optical,storage connor

Now, I'm sure that if you are installing arch, you have used sudo before. Its not installed on a base Arch installation.

type this command:

# pacman -S sudo vi

Now you have sudo, but the account still can't use it. That's because the account isn't in a group with sudo.

We will edit the sudoers file and add the wheel group.

To edit the file type this:

# visudo

For those who don't know how to use vim, You sure are missing out. This is what you will have to do.

type /#%wheel (enter)

Now your cursor is on the hash, press x.

Then :wq to exit.

Rebooting

I think that's it! you can press the power button on your computer and stay tuned for my next blog post.

Questions? grammatical errors? please DM me on mastodon.