Skip to content

Instantly share code, notes, and snippets.

@xbns
Last active December 30, 2020 01:13
Show Gist options
  • Save xbns/bcc1bf617fb60f5e2027b81d3922bdba to your computer and use it in GitHub Desktop.
Save xbns/bcc1bf617fb60f5e2027b81d3922bdba to your computer and use it in GitHub Desktop.
Simple way to Install Arch Linux on UEFI system

Step 1 Connect to internet from install disk or usb

Start iwd.service and connect your wifi

# systemctl start iwd.service
# systemctl status iwd.service
# iwctl --passphrase <you_wifi_password> station <name_of_station> connect <wifi_name>
# timeout 2 ping google.com

Verify the host specified by ping is reachable otherwise don't proceed until you fix it. Since you won't be able to do anything without internet connection.

Step 2 Create Filesystems and Mount Partitions

Assuming you have created the partitions using e.g cfdisk <SSD>

# cfdisk /dev/sda

Boot

# mkdir -p /mnt/boot/efi
# mkfs.fat -F32 /dev/sda1
# mount /dev/sda1 /mnt/boot/efi

Var

# mkdir -p /mnt/var
# mkfs.ext4 /dev/sda2
# e2label /dev/sda2 var
# mount /dev/sda2 /mnt/var

Root

# mkfs.ext4 /dev/sda3
# mount /dev/sda3 /mnt

Home

# mkdir -p /mnt/home
# mkfs.ext4 /dev/sda4
# e2label /dev/sda4 home
# mount /dev/sda4 /mnt/home

Swapfile

# fallocate -l 32GB /swapfile mkswap
# /swapfile swapon /swapfile

Step 3 Install Base System and Grub Bootloader

install base system

# pacstrap /mnt base linux-lts linux-firmware nano dialog iw wpa_supplicant networkmanager

install grub bootloader

# pacman -S grub efibootmgr os-prober

# grub-install --target=x86_64-efi --bootloader-id=grub --efi-directory=/boot/efi

Generate grub config

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

Step 4 Generate fstab

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

Sometimes you might get file errors that the system is readonly if you try to generate the fstab file. Remount the system to fix it.

# mount -o remount, rw /

Edit the fstab file

# nano  /mnt/etc/fstab

Enter the Swapfile to the FSTAB

# nano /etc/fstab /swapfile none swap defaults 0  0

For the mounted partitions change the UUID to the name of partition i.e inplace of UUID=xxxxxx change this to /dev/sda2. Though not necessary,it make the system boot faster.

nano commands

  • Ctrl + o : Write Edits
  • Enter : Save Edits
  • Ctrl + x : Exit nano
  • Ctrl + l : Clear Screen

Step 5 Clock and Timezone Settings

Set timezone You need to chroot to set the timezone

# arch-chroot /mnt

Then

# ln -sf /usr/share/zoneinfo/Africa/Nairobi /etc/locatime

Set hardware clock

# hwclock --systohc --utc

synchronize clock with timezone This is simply activating the NTP service

# timedatectl set-ntp true

Step 6 Set Locale and Language Settings

generate locale settings Using American English Uncomment this part #en_US.UTF-8 UTF-8 in this file /etc/locale.gen i.e

# nano /etc/locale.gen

Then run # locale-gen set language & export it to a locale config file

# echo LANG = en_US.UTF-8 > /etc/locale.conf
# export LANG = en_US.UTF-8

set hostname

change your_hostname below to what you would like to call your laptop

# echo your_hostname > /etc/hostname

Run this to verify everything is OK

# mkinitcpio -p linux-lts

Step 7 Set Default Shell and Terminal Emulator

Shell Am using zsh

# pacman -S zsh zsh-completions zsh-syntax-highlighting zsh-theme-powerlevel10k

Set it as default

# chsh -S /bin/zsh

Terminal Emulator Install terminology terminal emulator

# pacman -S terminology

Step 8 : Create a Sudo User and change the default password of Root

Root

# passwd

When prompted type and confirm the new password for root Sudo User

# useradd -m -G wheel -s /bin/zsh jay
# passwd jay

When prompted type and confirm the password for sudo user above

Uncomment the wheel group

# EDITOR=nano visudo

Exit chroot

# exit

Umount all partitions

# umount -R /mnt

Reboot the system

# reboot

NOTE While they system is rebooting you may now remove the USB installer disk. From now onwards you will be working with your fresh arch install using your sudo user instead of root user.

Step 9 Reconnect to Wifi

Since we removed the USB installer disk we have lost the iwd.service that comes with it to connect to wi-fi.But since we installed these wireless packages;wpa_supplicant and networkmanager in Step 3 We only need to enable,start them.Then connect to our wifi network and continue with the installation process.

Note that the shell prompt has changed from # to %.

Enable & Start wpa_supplicant and networkmanager services

% sudo systemctl is-enable wpa_supplicant.service
% sudo systemctl enable wpa_supplicant.service
% sudo systemctl start wpa_supplicant.service
% sudo systemctl status wpa_supplicant.service
% sudo systemctl is-enable networkmanager.service
% sudo systemctl enable networkmanager.service
% sudo systemctl start networkmanager.service
% sudo systemctl status networkmanager.service

If the status of the 2 services above is "running".Then we can connect our wifi again

nmcli is the command line client for networkmanager

List nearby wireless networks

% nmcli device wifi list

If your network is listed among the above;then connect to a wireless network

% nmcli device wifi <SSID> password <SSID_PASSWORD>

where SSID -> your wifi name and SSID_PASSWORD -> your wifi password

Sometimes your wifi could be hidden hence it won't show up in the list. If that is the case then

% nmcli device wifi connect <SSID> password <SSID_PASSWORD> hidden yes

Am assuming if you are able to get through Step 1 then the above is easier.

Step 10 : Configure your installation

Now that you have reconnected to the internet(ping to verify),you can continue configuring you installation.

Edit file hosts

% sudo nano /etc/hosts

Change the above file to

127.0.0.1 localhost
::        localhost
127.0.0.1 <your_hostname>.localdomain   <your_hostname>

Replace anything within the angle brackets inclusive.

Add multilib Repo

% sudo nano /etc/pacman.conf

Uncomment the multilib repo.

sync repos

# sudo pacman -Syy

You should also see the multilib repo syncing just like it peers Core,Extra etc

Optimize the mirrors

  • Am skipping this one till we have login out desktop environment;xfce

Install GUI Server

% sudo pacman -S xorg-server xorg-xinit xorg-xrandr

Install some important packages

% sudo pacman -S gvfs dkms xdg-user-dirs fuse2 haveged git ntfs-3g

Install the Display Manager & Desktop Environment

% sudo pacman lightdm lighdm-gtk-greeter xfce4 xfc4-goodies

Configure Display Manager(lightdm)

% sudo nano /etc/lightdm/lightdm.conf

Change these settings

greeter-session=lightdm-gtk-greeter
user-session=xfce4-session

Enable the LightDM Service

% sudo systemctl is-enabled lightdm.service
% sudo systemctl enable lightdm.service

Verify that Graphical Target is the Default If not then set it to be the default one

% sudo systemctl get-default

You can skip the below step if the above command return graphical target

% sudo systemctl set-default graphical.target

Verify the enabled service

% sudo systemctl list-unit-files | grep enabled

Reboot your system and login using your sudo user credentials

% reboot

Set Terminology Emulator as Default in xfce

  • Applications-->Settings--->Default Applications --->Utilities--->Terminal Emulator
  • Select 'Terminology' so that whenever you press ctrl + alt + t,its the one that pops up.

NOTE

  • I have skipped the installation for audio drivers and others,this could be done once desktop environment is up and running.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment