Learn how to – How to Install Arch Linux complete steps.
Arch Linux is not a Linux Operating system for distro hoppers. It’s that kind of distro which once installed, you forget about formatting your hard drive and doing a fresh installation all over again. In this tutorial, we’ll look at how to install Arch Linux.
Arch Linux and its derivatives are rolling release, meaning you get fresh packages from upstream as soon as they are released.
Major advantages of Arch Linux are:
- It is not a bloated distro: Arch doesn’t ship with software packages that might not be of any use to the user. Arch let you install only the things you really need, this let you strip unnecessary features that comes by default with many Linux distros like Ubuntu, Fedora, OpenSUSE e.t.c. You build a lean and fast system.
- AUR ( Arch User repository) is really amazing, easy and peasy. It gives you access to lots of software packages not available in official repositories. This is a plus as compared to other Linux systems.You can use PKGBUILD without any manual intervention.
- Pacman package manager that automatically compile packages for you.
- Rolling release: This means you won’t have to reinstall your system. You always have newest packages in your system since all the packages are vanilla, practically pure from upstream
- Arch has a very detailed wiki making it best Linux reference, not only providing Arch Linux tutorials and how to, it gives you general Linux knowledge.
How to install Arch Linux is a bit complicated as compared to many other Linux distributions. There are projects aimed at simplifying Arch Linux installation, these include Manjaro, Antergos, Apricity,Ninja and many others. You can try simplifying installation of Arch Linux with those distributions if you don’t have all the time to build your Arch from the ground up.
Arch Linux installation – motivation
This mini-ebook was written to help you build your own Arch Linux desktop or server without the need of pre-build distros. I will provide here overview of the common ways to boot the installation media and get started. Remember that any installation of Arch needs an active internet connection since its installation process retrieves packages from a remote repository. You can do an offline installation of packages but I don’t recommend this method since it requires deep understanding of Arch Linux and Linux system in general.
Most guidelines provided here are simplified wiki’s. You can use my ebook alongside Arch’s wiki documentation. I’ve used a lot of screenshots and pictures for illustration purposes and to help new users follow along easily.
If you’re installing an Arch-based Linux distribution like Manjaro or Antergos, you may have to skip some parts of this section because they do offer GUI installer. It is a point to note that Arch installation is done in text mode (using terminal) only.
Download Arch ISO
You have to download Arch Linux ISO image to use in installation, it can be downloaded from the website’s downloads section.
You can install Arch using bootable DVD or USB flash drive/key/stick for booting in BIOS and UEFI systems. A LiveUSB, LiveCD system can be used for installing Arch Linux, perform system recovery or maintenance. It is to be noted that live media uses SquashFS which discards all changes once the computer shuts down.
Complete steps of installing Arch Linux are as outlined below.
The next section captures complete process that is to be used when doing an installation of Arch Linux on Laptop, Desktop, or any other dedicated hardware.
1.1 Create bootable medium
We start with the creation of an installation medium before Arch Linux install on the system.
1.1.1: Create bootable USB flash stick on a Linux system.
The best tool to create a bootable ISO on a Linux host is dd command. Make sure you’ve selected correct drive before issuing dd command, failure to may render your external storage drive unusable.
I recommend you use lsblk command to confirm usb drive.
My USB drive is on /dev/sdb.The syntax for creating bootable USB stick with dd command is:
dd if=/path/to/archlinux.iso of=/dev/sdX bs=block-size status=status-like-progress && sync
Below example will create bootable arch from iso located in /home/josepy/Downloads (input file) to device at /dev/sdb ( output file) , using block size of 4M, showing transfer progress and doing sync to complete before ejecting.
sudo dd if=~/archlinux.iso of=/dev/sdb bs=4M status=progress && sync
1.1.2: Using Manual Formatting:
For this method to work, you should have syslinux package installed. If you’re running Arch, do:
sudo pacman -S syslinux
I suppose you have a flash drive with targeted partition as /dev/sdb2 that must be formatted to FAT32. We’ll create a directory to mount Flash drive partition and ISO image.
mkdir -p /mnt/{iso,usb}
mount -o loop ~/arch-linux.iso /mnt/iso
mount /dev/sdb2 /mnt/usb
rsync -av /mnt/iso/* /mnt/usb
umount /mnt/iso
1.2 Create bootable USB flash stick on Windows.
Download Rufus USB Partitioner. When you run it, you have two partition schemes options to select from:
- MBR for BIOS
- UEFI
The file system of FAT32 is required.
- 1.2.2: Using Win32disk imager
- 1.2.3: Using PowerISO
1.3 Boot and start Installation
Once you’ve created USB drive that’s bootable, plug in and start the system.
Choose ” Boot Arch Linux ( Architecture)”, since my machine is 64-bit, i will choose ” Boot Arch Linux (x86_64)”, then press enter key.
Now it’s time to start partitioning hard drive on the terminal session.
1.4 Partitioning
We’ll need three partitions. Partitioning can be done from existing/ other installed Linux system using GUI tools like gparted. Then just pointing root, home and swap partitions to respective partitions created earlier. Using GUI tools is a recommended method if you’ll be dual booting with other Linux
- Root partition
- Home partition
- Swap partition
First, check your disk location using lsblk command:
As you can see, my internal hard drive is /dev/sda. I will partition it to get three partitions. I’ll use fdisk command to do this:
The syntax is,
# fdisk /dev/sdX
My drive as used in this guide is /dev/sda.
1.4.1 Create root partition
I’ll create a 10GB root partition, steps are
- Type fdisk /dev/sda
- Press n to create a new partition
- Press p to specify the primary partition type
- Press enter for default partition number
- Press Enter key for default First sector
- Type +10G to specify 10GB disk size for the root partition. Replace it with your value. M for MB, G for GB, T for terabyte e.t.c
- Type w to write changes to the partition table.
1.4.2 Create Home partition
Repeat the same process as in 1.4.1 to create a home partition,1.4.3 Create a Swap partition
Repeat the same procedure as in 1.4.2 and 1.4.3 to create a swap partition.
You can view partition table by typing;
# fdisk /dev/sda
Then press p
We’ve successfully created three partitions, which are:
- Root partition on /dev/sda1
- Home partition on /dev/sda2
- Swap partition on /dev/sda3
1.4.4 Create a filesystem on created partitions
# mkfs.ext4 /dev/sda1
# mkfs.ext4 /dev/sda2
# mkswap /dev/sda3
# swapon /dev/sda3
See image below
1.4.5 Mount the partitions
Mount /dev/sda1
mount /dev/sda1 /mnt
Create dir for mounting /dev/sda2
mkdir /mnt/home
Mount /dev/sda2
mount /dev/sda2 /mnt/home
If you Love what we do, support us by downloading this tutorial as pdf from the link below:
1.5 Install the base packages
Before you begin installation of base packages, it’s advisable to choose mirror closest to you. You can do this by editing the mirrorlist file located in /etc/pacman.d/ directory.
1.5.1 Modify Mirror list
nano /etc/pacman.d/mirrorlist
Locate mirror close to you, then move it to the top, below nano keys can help you do easy navigation and copy-pasting:
- Ctrl + w : To do searching
- Alt+6: To copy a line
- page-up: To go to the top of the file
- Ctrl+ U: To paste a line
- Ctrl+X: To save changes, then press Y then enter key.
Since I reside in Africa, the mirror closest to my location is
## Score: 1.4, South Africa Server = http:ftp.wa.co.za/pub/archlinux/$repo/os/$arch//
It will be the first one in the mirror list. After editing mirror list, it’s time to install base packages from the fastest mirrors near you. But first, you should have a working internet connection:
1.5.2 Configure Networking
> Check if you have an ip address, if not and have DHCP, request for IP related information.
You can request for IP via DHCP by
# dhclient ens3
# ifconfig ens3
Then test if you’ve internet connection by doing a ping test
# ping -c 3 8.8.8.8
If you’re using wireless networking, use tool called wifi-menu
# wifi-menu
On the popup window, Select your Wireless network then Press OK.
Set profile name and Press OK
If it has security key, enter it and press OK.
Pacstrap installs packages to the specified root directory. If no packages are given, packstrap defaults to the “base” group.
Pacstrap usage:
pacstrap [options] root [packages…]
Options:
-C : Use an alternate config file for Pacman
-c : Use the package cache on the host, rather than the target
-d : Allow the installation to a non-mountpoint directory
-G : Avoid copying the host’s Pacman keyring to the target
-i : Avoid auto-confirmation of package selections
-M : Avoid copying the host’s mirrorlist to the target
-h : Print help message
Now do the pacstrap installation of base and base-devel
pacstrap -i /mnt base base-devel
1.5.3 Create Local Repository
NOTE: THIS IS NOT DONE ON THE INSTALLATION MACHINE !!!
If you have an already installed Arch Linux system on your network, it’s not necessary to redownload base packages from the internet. This will help you save bandwidth if you’re on slow internet connection. I’m going to show you a trick on how to set local repo based on pre-installed Arch Linux.
- On installed Arch Linux, i’ll setup Apache web server server:
sudo pacman -S apache
Then start Apache web server:
systemctl start httpd
systemctl enable httpd
Check status of httpd to make sure it’s running
systemctl status httpd
- Next step is to create directory to house pacman packages on installed Arch Linux Apache’s root directory.
mkdir /srv/http/arch
Rsync all packages at /var/cache/pacman/pkg directory to /srv/http/arch .
rsync -av /var/cache/pacman/pkg /srv/http/arch
Change group ownership of /srv/http contents to http.
chown -R root:http /srv/http
Use repo-add command included with Pacman to generate a database for the custom repository.
# repo-add /srv/http/arch/pkg/custom.db.tar.gz /srv/http/arch/pkg/*.pkg.tar.xz
Wait for it to complete, then
- Go back to machine you’re installing New Arch Linux on. Modify pacman.conf file:
– Comment out core, extra and community repos, to look like below:
#[core]
#Include = /etc/pacman.d/mirrorlist
# [extra]
# Include = /etc/pacman.d/mirrorlist
# [community]
# Include = /etc/pacman.d/mirrorlist
Then add below repository just before the core repo:
[custom]
SigLevel = Never
Server = http:192.168.122.1/arch/pkg//
See below image:
- Run pacstrap to install base packages:
pacstrap -i /mnt base base-devel
After successful installation of base packages, you can move on to system configurations stage.
1.6 System configurations
1.6.1 Generating fstab file for auto-mounting partitions
fstab is a static information about the filesystems which contains descriptive information about the filesystems the system can mount. It is only read by programs. It is your duty to properly create and maintain this file.
Arch installation comes with a package called genfstab which tries to automate this process for you. genfstab generates output suitable for addition to an fstab file based on the devices mounted under the mount point specified by the given root.
Options that can be used with genfstab are:
Options:
-L Use labels for source identifiers (shortcut for -t LABEL)
-p Exclude pseudofs mounts (default behavior)
-P Include printing mounts
-t TAG Use TAG for source identifiers
-U Use UUIDs for source identifiers (shortcut for -t UUID)
-h Print help message
The syntax of usage is:
# genfstab [options] root
To generate fstab file, type
genfstab -U /mnt >> /mnt/etc/fstab
You can check generated fstab file and modify if necessary.
cat /mnt/etc/fstab
Then chroot to run command or interactive shell with special root directory of /mnt
arch-chroot /mnt/
If you had set local custom repository and would like to use it in the next installations, issue below commands before typing arch-chroot /mnt
cp /etc/pacman.conf /mnt/etc/pacman.conf
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
1.6.2 Set timezone
We need to configure Timezone to get correct time on the system. Timezones are listed in /usr/share/zoneinfo/
Since my timezone is Africa/Nairobi, i will issue command:
ls -s /usr/share/zoneinfo/Africa/Nairobi > /etc/localtime
You can find your timezone by going through the list of timezones.
ls -l /usr/share/zoneinfo
1.6.3 Generate correct locale
Since i’m using US english, my locale will be set to en_US.UTF-8.
mylocale=en_US
sed -i '/en_US.UTF-8/s/^#//g' /etc/locale.gen
echo LANG=$mylocale.UTF-8 > /etc/locale.conf
1.6.4 Set the hostname
The syntax is:
# echo hostname > /etc/hostname
In my case:
# echo archy > /etc/hostname
1.6.5 Enable multilib repository
# nano /etc/pacman.conf
Uncomment multilib repository to look like below.
[multilib]
Include = /etc/pacman.d/mirrorlist
This is necessary if you’re running 64-bit system and would like to install 32-bit packages on it.
1.6.6 Add AUR repo
Add the following AUR repo content at the end of pacman.conf file.
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
For how to use AUR, check: yay – Best AUR Helper for Arch Linux / Manjaro and Pacman and yaourt package manager mastery Cheat Sheet
1.6.7 Install boot loader
Install Grub bootloader. Since this installation of Arch is on PC using BIOS, we don’t need a different partition to install bootloader on. If you’re using UEFI, consult Arch Wiki for details on how to set it up.
Download grub:
# pacman -S grub
Install grub
# grub-install /dev/sda/
If you encounter any problem trying to install grub, use –force flag:
# grub-install /dev/sda --force
1.6.7.1 Install os-prober
Os-prober utility is necessary if you have more than one OS on your machine. It will automate the process of adding other operating systems to grub menu for easy dual booting. Install it by typing:
# pacman -S os-prober
# os-prober
1.6.7.2 Generate a GRUB configuration file
# grub-mkconfig -o /boot/grub/grub.cfg
1.7 Install Crucial software packages
It’s a rule of thumb to do system update and upgrade before installing any package:
sudo pacman –Syu
- Install bash
# pacman -S bash bash-{completion,docs}
- Install X server
# pacman -S xorg-{server,utils,xinit,xinput,xwininfo,xlogo,xauth,xclock,twm}
3. Install Mesa 3D acceleration if you don’t want to install proprietary ones.
pacman -S mesa mesa-libgl
4. Install Touchpad drivers
pacman -S xf86-input-{keyboard,synaptics,mouse,libinput}
5. A single command to get X working is:
pacman -S xorg
Install Audio drivers
pacman -S alsa-{utils,plugins,plugins,firmware} pulseaudio pulseaudio-{equalizer,alsa,gconf}
- Install net-tools
pacman -S net-{snmp,tools}
Net-tools package provide network management tools. Arch comes with ifconfig replacement tool ip. To use ifconfig, net-tools package is required.
- Install sudo
pacman -S sudo
Sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.
- Install dhclient – Dynamic Host Configuration Protocol Client
pacman -S dhclient
Dhclient, provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol and BOOTP protocol.
1.8 Add standard user account
Installed Arch comes only with root account. In this section, we’re going to add standard user account:
- Set root password:
# passwd root
Enter your desired password and confirm.
- Add new user to the system.
username="jose"
useradd -m -g users $username
usermod $username -a -G wheel,storage,power,audio,games
chsh -s /bin/bash $username
- Set password for the user
# passwd $username
Enter desired password for the account and confirm .
- If you want the added user, a member of group wheel to execute any command, do the following:
> Set EDITOR to your favorite
echo export EDITOR=vim >> ~/.bashrc
> Run visudo command
visudo
And uncomment the line
#%wheel ALL=(ALL) ALL
to be:
%wheel ALL=(ALL) ALL
Then save and quit.
1.9 Install your favorite Desktop Environment
All linux systems are Desktop Environment agnostic. You can install any DE you want, at any time. I’m a big fan of KDE but i’ve used almost all Linux DE. In this section i will guide you through installation of top Linux Desktop Environments. The list is as shown below.
1.9.1 Install KDE plasma Desktop Environment
pacman -S plasma kde-applications-meta plasma-mediacenter
systemctl enable sddm.service
1.9.2 Install Gnome Desktop Environment
pacman -S gnome gnome-extra gnome-tweak-tool
Then install GDM display manager:
pacman -S gdm
Start and enable gdm to start at boot:
systemctl enable gdm
1.9.3 Install xfce Desktop Environment
pacman -S xfce4 xfce4-goodies xfce4-mixer gstreamer0.10-good-plugins libxnvctrl xscreensaver
1.9.4 Install cinnamon Desktop Environment
pacman -S cinnamon nemo-fileroller
Display manager.
pacman –S gdm
Enable gdm to start at boot and start it
systemctl enable gdm
Upto this point, you’ve finished install Arch Linux on your machine, so, Kudos!!.
You can now exit chroot , unmount partitions and reboot your system.
# exit # umount -R /mnt/ # reboot
While it’s rebooting, you may eject installation medium since install Arch Linux process is complete. If you Love what we do, support us by downloading this tutorial as pdf from the link below:
Once it’s done rebooting, you’ll see a Login screen. Since i’m using KDE, my Login screen looks like below:
Upto this point, We’ve completed a how to Install Arch Linux, if you’re here i know you’ve a running Arch with DE. Computinforgeeks have many tutorials on Linux and Arch Linux.
Tags:
- How to install Arch Linux from scratch
- How to install Arch Linux on a Desktop, PC or server
- Installing Desktop Environments on Arch Linux
- How to install KDE, XFCE, GNOME 3 and others.
- Arch Linux basic softwares installation
Leave a Reply
You must be logged in to post a comment.