Part 5: Arch Linux Installation Guide
Tags: linux, archlinux, tutorial
Published: 2021-08-12 15:20:53

*Originally published on [xhalford.com](https://www.xhalford.com/part-5-arch-linux-installation-guide/)*

---

In part 5 of this **series**, we will be creating a user, adding access to more programs and setting up a graphical environment. Then we can finally boot up into out fresh install of Arch Linux. This follows on from installing Arch, configuring it's setup and boot process in [previous part](https://www.xhalford.com/part-4-arch-linux-installation-guide/) of this guide series.

> _**Notes:** There are a few presumptions being made for this guide. Regarding yourself and your current setup._
> 
> - *You will be moving from another \*nix system.*
>     - *This will help with the initial steps, with the programs being used to download the image and write it to a USB drive.*
>     - *If you are coming from Windows, I will try to link to articles explaining this fairly trivial difference.*
> - *Have access to this guide on another device.*
>     - *As once we get to installing Arch Linux, we'll be stuck in a terminal for some major steps.*
> 
> - *Can handle looking deep into the empty void of the tty.*
> - *Make sure not to make any typos - as I try to do the same throughout these guides.*


---

## What you'll need:

- The patience to re-read every command you type, and output given.
- It's not the end of the world if you "mess up" at any stage here. You'll just save yourself the time of redoing anything, if you do.


---

# Creating a User

When using the new installation, we don't want to be the root user. Therefore, we should now create a user, and give it a password.

```sh
$ useradd -m richard
$ passwd richard
```

When logged in as this new user, we probably want to be able to have access to some necessary functions. Here we will use the _usermod_ command to do this. Selecting a few appropriate groups to add the user to.

```sh
$ usermod -aG wheel,audio,video,input,storage richard
```
> This command will output and error if you use spaces between commas.

---

## Sudo Privileges

As we want to give this user root privileges, by adding it to the wheel group. Without having to rely on entering root with _su_, and exiting out of the interactive shell every time. We can install the package, _sudo_, for the ability to perform one-off root commands.

```sh
$ pacman -S sudo
```

To make sure this user has the privileges of root, thanks to being added to the wheel group. We need to comment out the following line in the sudoers file.

```sh
 $ EDITOR=nano visudo

%wheel ALL=(ALL) ALL
```
> So that you don't need to enter a password to use sudo, as a wheel group member. You can also uncomment the next line in the file, `%wheel ALL=(ALL) NOPASSWD: ALL`

---

# Network Manager

For future's sake, and making life easier every time you boot up your computer. You'll want to automatically connect to the internet. For this, a very useful package is _NetworkManager_. Which comes with both a CLI (nmcli) and TUI (nmtui) program, to view, edit and activate network connections.

```sh
$ pacman -S networkmanager
```

Now to make sure the init system, _systemd_, has _NetworkManager_ enabled and will run when the computer starts up.

```sh
$ systemctl enable NetworkManager
```

---

# Extending Program Availability

At the moment, the only way to download and install, comes from Arch's official stable repositories; core, extra and community.

If you want to have access to the [Arch User Repository, _AUR_](https://aur.archlinux.org/). Which will provide you with an endless amount of programs. We will first need to install the _base-devel_ metapackage, to provide the tools necessary to for compiling software. Including _git_, a version control system, which will allow you to clone programs from online repositories.

```sh
$ pacman -S --needed base-devel git
```

To make life easier when installing packages from the AUR, it's recommended to install an AUR helper. My recommendation here is to use _Yay_, as it works in a similar way to pacman. 

We will move into the _/opt/_ directory to install yay, as it seems like an appropriate directory. Given it's meant for installing add-on application software packages. Then we will clone yay, give our new user access to it and then build it.

```sh
$ cd /opt
$ git clone https://aur.archlinux.org/yay.git
$ chown -R richard:wheel ./yay
$ cd yay/
$ makepkg -si
```

And that's it for extending software availability on Arch Linux. Now we can focus on making the operating system user friendly, and add a graphical user interface.

---

# Rebooting Arch

With Arch Linux finally installed, added to the bootloader menu, and with a user to log in with. We can now after all this time, reboot the computer. First we need to exit the chroot environment, unmount all partitions, and shutdown the computer.

```sh
$ exit
$ umount -R /mnt
$ shutdown now
```

With this done all you have to do is remove the USB installation media and hit the power button.

With that done. You should now be prompted to enter the desktop (hostname) login and password for your user.

🥳 You're done! 🎉

But... things still look the same.

---

# Graphical User Interface

So far, we've spent our lives in tty purgatory. Staring at a black screen with harsh white text. We need to get out of this. We need to add a display server and graphical environment.

---

## Display Server & Graphics Drivers

On Linux there a two major display servers available, Xorg and Wayland. In this tutorial I am going to go over installing and setting up with Xorg. It's got more support, and a greater user-base. If you have problems in the future, it'll be easier to solve with Xorg.

To make sure you get all necessary utilities that go along with Xorg. We will install the _xorg_ meta package.

```sh
$ pacman -S xorg
```

Followed by installing the hardware drivers relating to your current system.

![GPU Driver Table](https://i.imgur.com/L4eTm7v.png)
> If you have an NVIDIA GPU, I would actually suggest using their proprietary drivers 😱

For further explanations for your specific graphics driver.

  - [Intel graphics](https://wiki.archlinux.org/index.php/Intel_graphics)
  - [AMDGPU](https://wiki.archlinux.org/index.php/AMDGPU)
  - [AMDGPU PRO](https://wiki.archlinux.org/index.php/AMDGPU_PRO)
  - [NVIDIA](https://wiki.archlinux.org/index.php/NVIDIA)
  - [Nouveau](https://wiki.archlinux.org/index.php/Nouveau)

---

## Desktop Environment or Window Manager

Traditionally, operating systems and Linux distributions come bundled with a desktop environment and programs. You might already be used to using one, but here are a few that you can check out. Including what packages and configurations you may need to get it working.

  - [GNOME](https://wiki.archlinux.org/index.php/GNOME)
  - [KDE](https://wiki.archlinux.org/index.php/KDE)
  - [Xfce](https://wiki.archlinux.org/index.php/Xfce)

These desktop environments come with a; file manager, terminal emulator, text editor, icons, browser, etc.

If you want to have a more custom and light-weight graphical user interface. You might want to opt for a window manager like [dwm](https://dwm.suckless.org/), [i3](https://i3wm.org/), or [Openbox](https://wiki.archlinux.org/index.php/Openbox). Then you can decide what extra programs you want to have without the added "bloat" of what comes with desktop environments.

---

## Display Manager

If you chose to use a desktop environment, you will most likely have a display manager. But, if you installed a window manager, you will either have to install one yourself or forgo having one. Without a display manager, you will have to start your Xorg server with the `startx` command. To make this command run automatically when you log in, edit the systems shell initialisation file.

```sh
if [[ "$(tty)" = "/dev/tty1" ]]; then
  exec startx
fi
```
> Remove `exec` and just have `startx` if you want to kill the server but remain logged in.

This if statement will run `startx` if you log in on tty1. But will keep you in the tty if you need to, when using the other five. Which can be helpful if you need to debug a graphical problem. Accessing these other tty's with, Ctrl+Alt+F2 up to F6 on Arch Linux.

---

# User Directories

To create all the standard directories within you user's home directory (Documents, Downloads, etc.). It is useful to install the _xdg-user-dirs_ packager. Which helps keep your /home/ directories organised, by using the [_XDG Base Directory_ specification](https://wiki.archlinux.org/index.php/XDG_Base_Directory).

```sh
$ pacman -S xdg-user-dirs
$ xdg-user-dirs-update
```

The generated _~/.config/user-dirs.dirs_ file can be edited to fit your use case. This is what mine looks like given I don't have a desktop with my window manager.

```sh
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Media/Music"
XDG_PICTURES_DIR="$HOME/Media/Pictures"
XDG_VIDEOS_DIR="$HOME/Media/Videos"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
```
> Notice how I have also consolidated my pictures, videos and music directories within a Media/ directory. To remove even more /home/user/ clutter.

---

# Summary

At the end of this final part in the Arch Linux Installation Guide, we have covered a lot.

  - Creating a user account and given it root priveleges.
  - Installed a way to manage our internet connection.
  - Provided ourselves with a way of downloading programs from almost anywhere.
  - **Finally** rebooted our system, and into our new home.
  - Added a graphical server and looked at potential desktop environments and window mangers.
  - Gone through two methods to automatically login and keep things clean.

If after all five parts of this guide you have questions. I will try my best to answer them in the comments below. The best resource really is the [Arch Wiki](https://wiki.archlinux.org/index.php/). And would be my recommended first stop before installing, configuring or debugging a problem.

Thank you for taking the time to read through this guide, and I hope you have managed to get your Arch Linux installed and operational.

---

Follow me on [Twitter!](https://twitter.com/intent/user?screen_name=richardhalford_)