1   Introduction

Arch Linux is exceptionally pleasant to use. However, there is no visual installer with a "friendly" GUI interface. So, you do the installation by booting from a "live CD", then running commands at the bash command line (or maybe it's zsh). And, while the installation instructions at the Arch Wiki are excellent, a few additional notes might be helpful.

And, by the way, if a GUI installer is a must-have for you, take a look at Manjaro Linux: https://manjaro.org/. It's a different and separate Linux distribution, but it is based on Arch.

If you are looking for an even easier way to install Arch Linux, take a look at EndeavourOS -- https://endeavouros.com/. It's Arch Linux with a more friendly installer. From their Web site:

We’re offering you an installation with a friendly installer that will set up your system in a headache-free and swiftly manner.

After install you’re set up with a lightly customized and an almost bare Xfce desktop shipped with Firefox, our in-house update-notifier, an AUR helper called Yay and a welcome greeter that guides you through the first steps, ready to discover the endless possibilities an Arch-based system has. At first glance, EndeavourOS may look intimidating with its terminal commands, but we have the premium advantage of an active and friendly community, our wiki and an online magazine called Discovery to guide you through your journey into Archlinux.

One possible downside is that the EndeavourOS iso or image is about 1.6 GB and you need to be able to copy that onto a device that you can boot from. Likely you will want to use a USB drive. In contrast, the plain Arch Linux iso can be burned on a 700 MB CD. If the USB drive works for you, consider giving EndeavourOS a try. In my case, my old laptop did not support booting from a USB drive. So, I installed plain Arch. And, that's what the rest of this blog article is about. And, that's what the rest of this blog article is about.

2   Arch Linux Web sites

Here are a few sites/pages you will want to look at for information about and help with Arch Linux:

3   Booting with and using the live CD

Insert and boot from the live CD.

3.1   Connect to the Internet

The easiest way to do this is to use a wired connection. To do so, plug in an Ethernet cable connected to your router.

If you need to use a wireless connection, follow the instructions in the "Installation guide".

Note that in order to use a wireless connection after you reboot to your new installation, you will need network management software. See below.

Verify your connection with something like this:

# ping archlinux.org

3.2   Update the system clock

Do this:

# timedatectl set-ntp true

3.3   Partitions -- prepare your hark drive

Note that on some machines you will have a static drive.

Warning: This operation possibly destroys data. I'm going to assume here that you are going to clear out your hard drive and wipe it clean of any existing contents. If, for example, you have a partition that you want to preserve, then you will do something different.

The install guide suggests that you use fdisk. That's certainly a good choice, and, for the straight forward layout that we're going to create, is easy enough to use, once you have learned a few commands.

The Arch Linux live CD that I used (dated 11/01/2019) also contained cfdisk. You might find that a little more friendly and intuitive than fdisk, although for my purposes, fdisk seemed easy enough to use.

If you want a slightly more intuitive program, consider cfdisk:

Note that cfdisk provides basic partitioning functionality with a user-friendly interface. If you need advanced features, use fdisk(8) instead.

Using fdisk, we'll need the following commands:

  • m -- print this menu -- Display a menu of available commands.
  • p -- print the partition table -- Display a table of the existing partitions.
  • d -- delete a partition -- Delete an existing partition. You will be asked for the number of the partition you wish to delete.
  • n -- add a new partition -- Create a new partition. You will be asked for:
    • The partition number -- Accept the default.
    • Whether to create a primary or extended partition -- Respond "p": primary.
    • The starting position -- Accept the default.
    • The ending position/size -- Specify the size in gigabytes, for example: "+200G".
  • t -- change a partition type -- For the swap partition, change it to "Linux swap".
  • l -- list known partition types -- Use these numbers with the t command, in particular change the type of the swap partition to "Linux swap".
  • a -- [mark partition as bootable] -- Do this to your first partition.
  • w -- write table to disk and exit.
  • q -- quit without saving changes.

For the purposes of illustration in this blog article, we'll create the following rather simple partition layout:

  1. A root partition / -- 40 GB.
  2. A swap partition -- 10 GB.
  3. A users partition /home -- the remainder of the disk.

Here are the steps you can follow:

  1. Determine the device. You can use df or df -h. Example:

    $ df -h
    Filesystem                    Size  Used Avail Use% Mounted on
    udev                          3.5G     0  3.5G   0% /dev
    tmpfs                         723M  1.7M  721M   1% /run
    /dev/sda2                      37G   14G   22G  40% /
    tmpfs                         3.6G  151M  3.4G   5% /dev/shm
    tmpfs                         5.0M  4.0K  5.0M   1% /run/lock
    tmpfs                         3.6G     0  3.6G   0% /sys/fs/cgroup
    /dev/sda3                     1.9G  6.1M  1.9G   1% /boot/efi
    /dev/sda4                     860G   56G  761G   7% /home
        o
        o
        o
    
  2. Start fdisk. Example:

    $ fdisk /dev/sda
    

    You might need to use sudo.

    Note that we use the device without a partition number, for example /dev/sda and not /dev/sda1.

  3. Delete all existing partitions. Use the d command, several times if necessary.

  4. Create the root partition. Use the n command. Specify a primary (not extended) partition. Accept the default for the start location. For the end, specify a size, for example "+40GB".

  5. Create a swap partition. Specify a primary (not extended) partition. Accept the default for the start location. For the end, specify a size, for example "+8GB".

  6. Create a home partition. Specify a primary (not extended) partition. Accept the default for the start location. For the end/size, specify the remainder of available space.

  7. Mark the first partition (the root partition) as bootable. Use the "a" command.

  8. Change the type of the swap partition to Linux Swap. Use the "t" command.

  9. Save your configuration and exit. Use the "w" and "q" commands.

Notes on partitions:

  • Above I recommend that you create a primary partitions rather than an extended partition. There are other layouts that might work for you. However, in what I describe above, we only need three partitions, so primary partitions will work well. There is a limitation on the number of primary partitions, and since that limit is a maximum of four, we're good with three. If you wanted more than four partitions, then you'd make one of your partitions an extended partition and you'd create logical partitions within that extended partition.
  • Why a separate home partition? Why not create a swap partition and a root partition. A separate home partition is not really necessary. A number of years ago, I wanted to be able to reformat and re-install Linux in the root partition ("/") without losing my home and data partition. If you think that might be a need for you, then create three partitions, as described above, with a separate home partition. Arch Linux, with its rolling releases, makes that need less likely, I suppose, but still ...
  • A note on partition sizes -- The example sizes that I give above are somewhat arbitrary and likely are excessive. A common recommendation is to have a swap partition whose size is double the size of your machines RAM (memory) up to 8 GB. A quick Web search will turn up recommendations. Here is one: https://opensource.com/article/19/2/swap-space-poll.

3.4   Format the partitions

Assuming that you followed the above partition scheme (partition 1: root, partition 2: swap, partition 3: home), do the following, replacing "sdX" with your device:

$ mkfs.ext4 /dev/sdX1
$ mkswap /dev/sdX2
$ swapon /dev/sdX2
$ mkfs.ext4 /dev/sdX3

The above commands format the two data partitions with ext4 file systems and initializes the swap partition.

3.5   Mount the file systems

On my system, I did the following:

$ mount /dev/sda1 /mnt
$ mkdir /mnt/home
$ mount /dev/sda3 /mnt/home

Notes:

  • Replace "sda" with your device, if necessary.
  • You want to mount /home in addition to / so that both these partitions are configured in /etc/fstab when you, later, run genfstab. See below.

3.6   Installation -- select the mirrors

The mirror list is in /etc/pacman.d/mirrorlist. You can move files (lines) higher up in the list to give them priority.

3.7   Installation -- install essential packages

Run the following:

$ pacstrap /mnt base linux linux-firmware

In order to create a functioning system, you will want to install additional packages. See the following: https://wiki.archlinux.org/index.php/Installation_guide#Install_essential_packages

In particular, you may want to consider installing the following:

  • Networking -- Install networkmanager or netctl. With networkmanager installed, you can use nmtui to select and connect to a wireless network. netctl is an alternative to networkmanager.
  • A text editor -- nano is a simple text mode editor. vim is a much more powerful editor. neovim is a more modern implementation of vim.
  • If you intend to be compiling and installing packages written in C, install package base-devel.

Notes:

  • As long as you can connect to the network after you reboot without the live CD, you can install any of the packages you need later.

  • You can install a package with the following:

    $ pacman -S <package-name>
    
  • You can search for a package if you know part of its name with the following:

    $ pacman -Ss <name>
    $ pacman -Ss <name> | less
    
  • If after rebooting, you find that you omitted some needed step. If so, you can reboot from the live CD, remount your file systems, then, for example, install additional needed packages.

3.8   Configure the system -- generate fstab

Generate /etc/fstab. This will enable the system to automatically mount your file systems when you boot. Run this:

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

View file /etc/fstab (e.g. with nano or vim). Make sure that it has lines for / and /home and swap.

3.9   Chroot

Change root into the new system -- This will enable us to run commands with root privileges:

$ arch-chroot /mnt

3.10   Time zone

Set the time zone -- Make a symbolic link to the time zone file for your region. Use the following, but replace "Region" and "City":

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

For example, I did:

$ ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

3.11   Generate /etc/adjtime

Run hwclock(8) to generate /etc/adjtime:

$ hwclock --systohc

This command assumes the hardware clock is set to UTC. See System time#Time standard for details.

3.12   Localization

Uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen, and generate them with:

$ locale-gen

Create the locale.conf(5) file, and set the LANG variable accordingly. Add the following to /etc/locale.conf:

LANG=en_US.UTF-8

If you set the keyboard layout, make the changes persistent in vconsole.conf(5) -- /etc/vconsole.conf:

KEYMAP=de-latin1

3.13   Network configuration

Create the hostname file -- Edit /etc/hostname. Insert a line that give the host name for your system:

myhostname

Add matching entries to hosts(5) -- For example, add the following in /etc/hosts:

127.0.0.1       localhost
::1             localhost
127.0.1.1       myhostname.localdomain  myhostname

If the system has a permanent IP address, it should be used instead of 127.0.1.1.

You may want to install some network tools. For example, I installed networkmanager:

$ pacman -S networkmanager

3.14   Set the root password

Do this:

$ passwd

And, enter a new password.

3.15   Install a boot loader

Choose and install a boot loader. I installed grub:

$ pacman -S grub
$ grub-install --target=i386-pc /dev/sdX

Notes:

  • For grub-install, use "/dev/sdX", not "/dev/sdX1". For example, on my system, I used "/dev/sda".

3.16   Reboot

Exit the chroot environment -- Type exit or use Ctrl-d.

Remove the live CD from the CD drive.

Reboot -- Type reboot.

4   Additional things to know and to do

4.1   System services

Some capabilities are provided as system services. You will want to enable them, so that they automatically start up during the boot process and you may want to start them immediately. The following does that, for example, for the networkmanager service:

$ systemctl enable networkmanager
$ systemctl start networkmanager

4.2   Adding a new user

On my system, I wanted to add myself as a user who could use sudo to run commands with root privileges. So, I did the following:

$ useradd -m dkuhlman
$ passwd dkuhlman               # and enter a new password

And, to give add myself to the sudoers group and enable myself to use sudo to run commands with root privileges, I used visudo and added a line for myself by copying the one for root and replacing "root" with my user name:

# User privilege specification
##
root ALL=(ALL) ALL
dkuhlman ALL=(ALL) ALL

4.3   Using pacman

pacman is our tool for installing and maintaining packages on Arch Linux. It's our not-so-intuitive package manager. But, if your experience is anything like mine, you will find that using pacman becomes very convenient quite quickly.

There is a good cheat sheet on pacman commands and options here:

https://wiki.archlinux.org/index.php/Pacman_Rosetta

Here are a few common tasks that you are likely to want to do:

  • Get help for pacman commands -- Examples:

    $ pacman -h
    $ pacman -h -S
    $ pacman -h -F
    
  • Search for a package:

    $ pacman -Ss some_search_string
    
  • Install a package:

    $ sudo pacman -S package_name
    
  • Upgrade installed packages -- Use this command to update the package database on you system and then upgrade the packages installed on your system so that they are the latest versions:

    $ sudo pacman -Syu
    
  • Search installed packages for the packages that contain a file:

    $ pacman -F some_file_name
    
  • List the files installed by a package:

    $ pacman -Fl package_name
    

4.4   Installing desktop window managers and video drivers

I installed Arch Linux on a rather old laptop. I had a bit of trouble figuring out which video drivers I needed to install in order to support Xorg (package xserv-org). Here is what I did.

Install support for Xorg -- I wanted to be able to use both the Xfce4 desktop and the i3 window manager. So, using pacman, I installed the following packages:

Installing needed video drivers -- There is good information and help here: https://wiki.archlinux.org/index.php/Xorg#Driver_installation. The above page tells you both (1) how to detect which drivers you need and (2) what packages are available containing the supporting drivers.

Basically, I installed driver packages until I was able to bring up the Xfce4 and i3 desktops. I likely installed some drivers that I did not need. But, that's OK. Now, it works.

4.5   Support for audio/sound

Consider installing packages for Alsa and PulseAudio.

On my system, sound was initially muted. I fixed this by starting up alsamixer, and then unmuting "Master".

4.6   LAN (network) setup

I have multiple machines connected to my LAN (local area network). I wanted those other machines to be able to address my Arch Linux machine by host name. To support that, I installed the avahi support packages. Actually, I believe that I have avahi installed on all my Linux machines.

5   Installing packages from AUR (Arch User Repository)

The AUR is here: https://aur.archlinux.org/

You can learn how to install packages from the AUR here: https://wiki.archlinux.org/index.php/Arch_User_Repository

Here is a summary of the steps you follow. Details are here: https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages.

  1. Find the package you want.

  2. Click on the version you want to install.

  3. Use the "Git Clone URL" on the package details page to clone the repository. Example:

    $ git clone https://aur.archlinux.org/cdargs.git
    
  4. Go to the new directory. Example:

    $ cd cdargs
    
  5. Check the build file. It should be plain text and should have no binary code:

    $ less PKGBUILD
    
  6. Download dependencies, build the package, and install it:

    $ makepkg -si
    

Published

Category

linux

Tags

Contact