DEV Community

Richard Halford
Richard Halford

Posted on • Originally published at xhalford.com on

Part 5: Arch Linux Installation Guide

Originally published on xhalford.com


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 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.

$ useradd -m richard
$ passwd richard
Enter fullscreen mode Exit fullscreen mode

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.

$ usermod -aG wheel,audio,video,input,storage richard
Enter fullscreen mode Exit fullscreen mode

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.

$ pacman -S sudo
Enter fullscreen mode Exit fullscreen mode

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.

 $ EDITOR=nano visudo

%wheel ALL=(ALL) ALL
Enter fullscreen mode Exit fullscreen mode

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.

$ pacman -S networkmanager
Enter fullscreen mode Exit fullscreen mode

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

$ systemctl enable NetworkManager
Enter fullscreen mode Exit fullscreen mode

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. 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.

$ pacman -S --needed base-devel git
Enter fullscreen mode Exit fullscreen mode

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.

$ cd /opt
$ git clone https://aur.archlinux.org/yay.git
$ chown -R richard:wheel ./yay
$ cd yay/
$ makepkg -si
Enter fullscreen mode Exit fullscreen mode

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.

$ exit
$ umount -R /mnt
$ shutdown now
Enter fullscreen mode Exit fullscreen mode

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.

$ pacman -S xorg
Enter fullscreen mode Exit fullscreen mode

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

GPU Driver Table

If you have an NVIDIA GPU, I would actually suggest using their proprietary drivers 😱

For further explanations for your specific graphics driver.


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.

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, i3, or 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.

if [[ "$(tty)" = "/dev/tty1" ]]; then
  exec startx
fi
Enter fullscreen mode Exit fullscreen mode

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.

$ pacman -S xdg-user-dirs
$ xdg-user-dirs-update
Enter fullscreen mode Exit fullscreen mode

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.

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"
Enter fullscreen mode Exit fullscreen mode

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. 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!

Discussion (0)