best business builder

Arch Linux UEFI with Grub – Installation Guide

For those of you who are looking to install Arch Linux on your machines, this guide is for you! I have gone through the process and taken notes along away. I’m hoping this guide will help you as much as it will help me with future installs.

Let’s get started!

Pre-Requisites:

You’ll want to create bootable media for your Arch Linux ISO. I recommend the software Rufus: https://rufus.akeo.ie/

After you’ve built your media, boot your computer and launch your bootable media.

There are two things you’ll want to do before starting the installation.

  1. Verify you have a working internet connection on the machine
  2. Find out your HDD scheme

To test if you have internet, ping google.com and make sure you get successful replies.

ping google.com

Then you’ll want verify your hard drive scheme using the fdisk command. Most machines will use /dev/sda as the primary disk naming scheme.

fdisk -l

Great, now the pre-reqs are all out of the way. We can jump into install.

Create partitions using fdisk:

  • There are 3 partitions we will create: /boot, /root, and /home

Create an EFI partition by typing the command:

fdisk /dev/sda (or whatever your disk naming scheme is from earlier)

These are the options for creating the /boot partition:
	g
		This creates a new GPT partition
	n
		For new partition
	1
		For first partition
	enter
		Press enter for First Sector
	+300M
		300MB partition size
	t
		Change partition type
	1
		Select partition
	1
		Partition type is option 1. This converts the partition into an 'EFI System'
	w
		Writes data to disk

You’re done. Let’s move onto creating the /root partition:

fdisk /dev/sda (or whatever your disk naming scheme is from earlier)

These are the options for creating the /root partition:
	n
		For new partition
	2
		For second partition
	enter
		Press enter for Second Sector
	+30GB
		30GB partition size
	w
		Writes data to disk

You’re done. Let’s move onto creating the /home partition:

fdisk /dev/sda (or whatever your disk naming scheme is from earlier)

These are the options for creating the /home partition:
        n
		For new
	3
		For thrid partition
	enter
		Press enter for Third Sector
	enter
		To use all remaning space
	w
		Writes data to disk

The next step in the installation process is to format the partitions we just created.

Formatting the partitions:

Type these three commands:

# This will format and prepare /boot for sda1
mkfs.fat -F32 /dev/sda1

# This will format and prepare /root for sda2
mkfs.ext4 /dev/sda2

# This will format and prepare /home for sda3
mkfs.ext4 /dev/sda3

Now lets mount these three partitions:

# Mount sda2 to /mnt
mount /dev/sda2 /mnt

# Make a new directory in /mnt called home
mkdir /mnt/home

# Mount sda3 to the directory you just created call home: /mnt/home
mount /dev/sda3 /mnt/home

Now we are read for the base image install of Arch Linux

Installing base image for Arch and configuring the boot partition:

Install the base image to /mnt

pacstrap -i /mnt base

This next step is important!!

/mnt needs to be mounted during boot. To do that run the following command:

# Tell Arch which partition to mount during boot
genfstab -U -p /mnt >> /mnt/etc/fstab

At this point Arch Linux is officially installed. But don’t stop here, there is more to configure.

After the install!

Log into the Arch Linux installation by typing:

arch-chroot /mnt

Let’s update the user root password:

passwd

Install basic programs:

pacman -S grub efibootmgr dosfstools os-prober mtools linux-headers linux-lts linux-lts-headers

Setup the TimeZone, Date, and Hostname:

Let’s do the TimeZone first with these commands:

# Note: Change America/Chicago to wherever you are from
# You can navigate to /usr/share/zoneinfo for all the options
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime

hwclock --systohc

Second let’s update the Date:

# You'll need some Vi text editor knowledge to navigate the file, edit the file, and save/exit the file.
# Use this link for reference: https://www.lagmonster.org/docs/vi.html 

vi /etc/locale.gen

# Find your locale in the list and uncomment your locale

Example would be changing:
#en_US_.UTF-8 UTF-8
to:
en_US_.UTF-8 UTF-8

# Then Save and Exit

After completing the above type:

locale-gen

Last we will change the Hostname:

# Change "archinstall" to whatever you would like your computer's name to be
echo 'archinstall' >> /etc/hostname

Now that the TimeZone and Date are setup we can finish up this install with EFI Grub install:

Create a directory for the EFI partition:

# make new directory called EFI in /boot
mkdir /boot/EFI

# Mount /boot/EFI to sda1
mount /dev/sda1 /boot/EFI

Install grub + efi boot loader with these three commands:

grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck

cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

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

Building a swapfile:

Now a SwapFile needs created:

# Choose the size of your swapfile
# Here I chose 2GB
fallocate -l 2G /swapfile

# Set the permissions on the swapfile
chmod 600 /swapfile

# make the directory swapfile a ...swapfile
mkswap /swapfile

# Edit /etc/fstab with the swapfile configuration
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab

# Verify /etc/fstab has been updated appropriately
cat /etc/fstab

# You should see:
	/
	/home
	/swapfile none swap sw 0 0

Wrap this up already!

That’s it! Now just exit chroot, unmount your drives, and reboot!!

# Type exit to exit chroot 
exit

# Unmount your drives
umount -a

# Reboot the machine
reboot

Final Thoughts:

The first time I ran through all these steps it took several hours researching what each step actually means and why it’s important. With that said, if you have a good internet connection, running through this guides commands should take 15 to 20 minutes from start to finish to get to the log in prompt after the install.


Got a project that needs expert IT support?

From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.

Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!

CONTACT US NOW
best vpn deal