How I installed Arch Linux on my laptop

I will now explain how I installed Arch Linux on my laptop.

You can follow along if you like. Just beware that this will erase all the data on your computer’s hard drive. Only do this if you’re absolutely sure you want to do this, so back up your important data onto another machine. Definitely don’t erase the data on a machine that isn’t yours!

1. Create the USB installer

First, I downloaded the official Arch Linux ISO from their website. I decided on the 64-bit version.

On my Windows 8 tablet, I used a program called Rufus. It allowed me to burn the ISO to a USB stick.

If you want to try this, you’ll need a USB stick with enough memory to hold the OS at least. You can buy an 8GB USB stick, which is more than enough space, at a very cheap price nowadays.

And if you’re on a Mac, you won’t be able to use Rufus, but you can use UNetbootin, which is highly rated.

Then once inside Rufus, I chose the USB stick from the list of drives. I chose the ISO image from my downloads folder, and selected Start to begin the burning process.

Warning: If you do this, it will delete everything on the USB stick.

When the process finished, I had a bootable USB stick.

2. Boot from the USB stick

I rebooted the laptop, plugged in the USB stick, and entered the BIOS. I changed the boot priority so that the USB drive controller is at the top. Then I exited the BIOS and the computer rebooted.

I was greeted by the GRUB boot loader, which took me to the Arch Linux terminal. It’s a weird, limbo-like place where you’re using the USB stick as the OS and the main filesystem. Many people actually plug the USB stick into their computer to have a portable operating system.

3. Check the network

Plugging in an Ethernet cable to my router allowed me to have internet access. I checked that the internet was up, with the code

ping google.com

This resulted in successful pings that returned a response.

The internet was a-OK!

The Ethernet is the simplest and most secure way to connect to your internet source provider. Most old laptops have an Ethernet port. I chose not to configure Wi-Fi until I had installed the Gnome desktop environment because it would be easier.

4. Partition the hard drive

At that time, I still had Windows Vista installed on the laptop’s main hard drive. To install Linux, I had to format the hard drive.

But first, I needed to set up the partition table. This, among other things, tells the boot loader which part of the hard drive is bootable.

To view the partition table, type

fdisk -l

I wanted two partitions on the main hard drive:

/dev/sda1 , the primary bootable with 457GB of space

, the primary bootable with 457GB of space /dev/sda2 , the primary swap space with 8GB, or double the RAM

Allocating double the RAM to swap space is a good idea for older machines with less RAM. Linux will put unused memory into the swap space to free up RAM for more immediate tasks.

I typed this into the terminal to action the partition:

cfdisk

This program provides a user interface for creating and managing partitions.

It should look something like this:

I highlighted the existing partitions and selected DELETE . Then I selected NEW and entered 457G as the space, marking it as primary.

Next, I selected BOOTABLE on that partition.

Then I selected the FREE SPACE in the line below, clicked NEW again, and created the swap partition with 8G of space. This was double the laptop’s RAM, marking it as primary. Linux should automatically recognize this as swap space.

I then selected WRITE and typed yes to confirm. This installed the new partitions.

Warning: Beware if you do this yourself. This might erase data and will definitely mess up your existing installation. So only follow this if you’re committed to trying out Arch Linux.

To verify the partitions, type

fdisk -l

5. Format the partitions

I created the primary partitions, but they weren’t formatted yet. I used this command to format the main partition as EXT4:

mkfs.ext4 /dev/sda1

Then to format and activate the swap partition:

mkswap /dev/sda2

swapon /dev/sda2

The hard drive has been completely formatted, and the swap partition activated.

6. Installing the base Arch Linux system

To install the Arch Linux base system, I mounted the laptop’s new primary /dev/sda1 partition onto my USB’s filesystem.

Remember that the USB is acting as “the computer” in this situation. Unix system have one tree for the filesystem. It doesn’t matter if it’s running off a USB stick or an RPi or a powerful server, all Unix systems are like this.

Mounting a drive into the filesystem is sort of like docking a filesystem onto the main one. We’re temporarily “plugging” the hard drive’s primary partition’s filesystem into the USB’s filesystem.

mount /dev/sda1 /mnt

pacstrap /mnt base base-devel

This didn’t take too long, but I did have time to make myself a cup of tea and check my emails on my tablet.

When it was done I patted myself on the back, and ran the next command to create the fstab. This is a file which contains information about the system’s partitions.

genfstab /mnt >> /mnt/etc/fstab

The file can be read to verify:

cat /mnt/etc/fstab

7. Configure Arch Linux

I needed to log into the new Arch Linux install to configure a few things. I needed to set the root password and time zone, and create my user account.

arch-chroot /mnt /bin/bash

Then I edited the locale file:

vi /etc/locale.gen

I found my locale en_GB.UTF-8 and uncommented it. Then I pressed ESCAPE and typed :x to write and exit the file.

To activate the locale, I entered:

locale-gen

Next, I created another locale file:

vi /etc/locale.conf

I added the following line and saved the file as above.

LANG=en_GB.UTF-8

Then I set the correct time zone.

In the UK we have a variable time zone. In the summer we use British Summer Time (BST), which is one hour ahead of UTC. The rest of the time we’re on Greenwich Mean Time (GMT), which is the same as UTC. It will probably be simpler for you if you’re elsewhere in the world.

To find the right time zone, I entered:

ls /usr/share/zoneinfo/

I saw GB and knew that was the right one. The system will automatically adjust to BST/GMT when necessary. So to set this as the system’s time zone, I entered:

ln -s /usr/share/zoneinfo/GB /etc/localtime

8. Configure passwords and user account

The system logged me in as root. To enter the root password for later logins, I typed:

passwd

It then prompted me to type my password and to confirm it.

Then it prompted me to create my user account:

useradd jon

mkdir /home/jon

chown -R jon:jon /home/jon

Then I typed:

passwd jon

I typed my password for my account as I did with root.

My account was created, but I couldn’t do very much. I had no permissions. I had to create the “sudo” group and add my user to it.

groupadd sudo

usermod -aG sudo jon

To ensure the sudo-ers group had the right permissions:

vi /etc/sudoers

Then I uncommented this line and saved the file:

# %sudo ALL=(ALL) ALL

Now I was able to use the sudo (pronouned “soo-doo,” short for “super user do”) command as my user, so I could install new packages and access restricted parts of the filesystem.

9. Configure the network

Now I needed to set the laptop’s hostname in two files: /etc/hostname and /etc/hosts . So I ran the next command and typed laptop:

vi /etc/hostname

Then I entered the host’s file:

vi /etc/hosts

At the bottom I typed the following line:

127.0.0.1 laptop

This told my system to route all requests for the hostname laptop to itself.

The network still didn’t work as planned, so I needed to activate it. I did this by typing:

systemctl enable dhcpcd

10. Install GRUB bootloader onto the hard drive

We’re almost done! Now I needed to install GRUB loader onto the new Arch Linux system, so that it could boot from the hard drive.

To do that, I ran these commands:

pacman -S grub os-prober

grub-install /dev/sda

grub-mkconfig -o /boot/grub/grub.cfg

If the first pacman command doesn’t work, try this command to synchronize the system’s core database:

pacman -Ssy

I then exited from the hard drive’s system and back into the USB:

exit

And then I unmounted the hard drive’s filesystem from the USB:

umount /mnt

And that’s it!

The hard drive had a fresh Arch Linux install ready to use. So I rebooted the laptop and unplugged the USB stick.

This then booted successfully into the terminal, but this time it was on the hard drive’s new Arch system, not on the USB stick.

11. Install the Gnome desktop environment

We have the new operating system, but it was still 100% terminal. I want a desktop environment to interact with my laptop, so I can browse web pages, read documents, and use modern apps.

There are many desktop environments for Linux. I chose Gnome because I like it, but if I wanted to, Linux allows the installation of more than one desktop environment.

Luckily, it only takes one command to install the Gnome desktop ennvironment:

pacman -S gnome

It prompted me a few times to check which versions of extra packages I want. I just clicked ENTER to select the defaults.

So the Gnome desktop environment is installed, but the system doesn’t know to load it at the boot. So I typed this to ensure it did:

systemctl enable gdm.service

This sets up the symlink, and we’re ready to reboot the laptop into Gnome!

reboot

Then when the laptop booted, it loaded Gnome, and I was able to log in with my new user account.

Great success!

The system was now ready for me to use. It was far from complete though, because I wanted to install some of my favourite programs:

Fish shell, it makes the terminal much faster and easier to use

htop, for system activity monitoring

Git, for installing packages via the AUR and for work

Google Chrome, it’s my favourite browser

Spotify, so I can listen to my favourite tunes!

PhpStorm, so I can work

DataGrip, so I can access my databases

With Linux, and especially Arch, we can’t just download an installer or a .dmg file like we can on Windows or macOS. We need to use both of Arch’s installer programs to install them. So let’s learn how to do that!

How to install programs on Arch Linux using pacman and the AUR

Installing programs on Arch Linux might seem tricky at first. It was tricky for me the first time too, even though I had experience with Ubuntu Linux.

Arch uses pacman, short for package manager, and the Arch User Repository (AUR) to install programs.

Installing packages via pacman is super easy. To install the fish shell, htop, and Git, I just used:

sudo pacman -S fish htop git

Installing via the AUR is trickier, especially if you’re newer to Unix-like systems.

We’ll install the Google Chrome browser and Spotify to show you how to do this.

First, make sure that build essentials are installed:

sudo pacman -S file base-devel abs

Go into your user’s downloads folder:

cd ~/Downloads

Go here and copy the Git Clone URL.

Then run the following command:

git clone [the Git Clone URL]

Then enter cd into the google-chrome directory that it just created, and run the following command:

makepkg -Acs

This may take a while, depending on your system.

Time for another cup of tea!

Once that’s done, install the package. The makepkg command should create a file with the file type pkg.tar.xz . Install this package by using the -U option with pacman.

sudo pacman -U x.pkg.tar.xz

Replace x.pkg.tar.xz with the name of the actual file. It will be a long, scary filename. Just copy and paste it into the command above.

That’s it!

Now in Gnome, if you hit the super key (Windows key on a Windows machine), type Chrome and the Chrome app icon should appear on the screen. Super easy!

We can use the same commands for every other AUR package we want to install. We can certainly do the same for Spotify by using the URL here.

Remember, these are the steps to install programs from the AUR:

Find the package’s Git clone URL here.

git clone [the URL]

cd [package name]

makepkg -Acs

sudo pacman -U x.pkg.tar.xz

Yaourt

An easier way to install AUR packages is using Yaourt. It allows you to automatically install from the AUR with one line, much like pacman.

Open up /etc/pacman.conf and add the following lines of code to the bottom:



SigLevel = Never

Server = [archlinuxfr]SigLevel = NeverServer = http://repo.archlinux.fr/$arch

Then, in the terminal run this:

sudo pacman -Sy yaourt

Now you can install any package using Yaourt. The usage is similar to pacman:

yaourt <operation> [options] [packages]

yaourt <search pattern|package file> yaourt -Syu # Updates the Arch system

yaourt -S <package> # Install a package

yaourt -U <package> # Upgrade a package

yaourt -R <package> # Remove a package

yaourt -P <directory> # Install from a PKGBUILD in the directory

yaourt --stats # Show stats on all your packages

I hope I have shown that it’s easier than it looks to use the AUR. It’s super easy to install with pacman too.

I thought it was important to share Arch’s core skills, because with Arch, very few programs are pre-installed. So you’ll need to use these core skills a lot if you want to install the programs you need.

That is what I like about Arch Linux. You can create the computer you want, instead of just being given a bloated system that has more than you could possibly want or use.

That is also why Arch Linux is perfect for older laptops and PCs. It is so lightweight that it runs below 5% CPU with multiple programs on at the same time. Here’s a screenshot of my laptop’s desktop with htop:

Yes, I love 90s music. Sue me! It was one of the best decades for music!

I chose the Gnome desktop environment as well, which many experienced readers will notice is quite heavy as far as desktop environments go.

That’s true. I took a gamble by using it over a lighter DE like XFCE4.

But I’m used to the Ubuntu Unity desktop environment, which is similar to Gnome. I like that it is so user-friendly. It does come with a lot of packages that XFCE leaves out.

And as you can see from the screenshot above, it didn’t take a toll on my 2009 laptop.

I’d call this project a success.