Skip to main content

Configuration

Entering our system

Since we're unable to reboot yet, as we've not configured our system properly yet, the Arch Linux project has supplied us with a handy command to enter the system without booting into it. This can also be used to diagnose any issues you might have if you can't boot into the system.

root@archiso ~ # arch-chroot /mnt

You'll notice that the command prompt changes from the pretty red to a colorless and boring prompt. This is good as contrary as it may seem. You are now in your system!

Date and time

We need to set our timezone properly before we continue. For that, we can create a symlink:

[root@archiso /]# ln -sf /usr/share/zoneinfo/<Continent>/<City> /etc/localtime

Replace <Continent> and <City> with your appropriate time zone. For example, if my timezone would be the same as in Berlin, I would type Europe/Berlin in here. If you're not sure what timezone you should specify, you can press Tab to autocomplete.

Check if you set your timezone correctly by typing

[root@archiso /]# date

If your time seems correct, you can synchronise your system clock. Otherwise, reset your timezone correctly.

[root@archiso /]# hwclock --systohc

Language

We can set the correct locale for software to use by editing the following file:

[root@archiso /]# nano /etc/locale.gen

Inside that file, you can search for your preferred locale. I'm going to use en_US for this example. Uncomment the line with the locale of your choice. Press Ctrl-O, Enter and then Ctrl-X to save.

#en_US.UTF-8 UTF-8
^ uncomment this line by removing the #

Tip: With nano you can filter for words by pressing Ctrl-W.

Once you've set your locale, we need to generate it. Run this command to do so

[root@archiso /]# locale-gen

Now we need to set it. Edit /etc/locale.conf and add the following line:

[root@archiso /]# nano /etc/locale.conf
# Add the line below to this file.
LANG=en_US.UTF-8

If you need to set a different keyboard layout other than us, edit the following file:

[root@archiso /]# nano /etc/vconsole.conf
# Add the value below if you want to change your keyboard layout to (in this example) german.
# You can set KEYMAP= to any keymap you'd like. See the Arch Wiki for more.
KEYMAP=de-latin1

Users and Groups

We need to secure your root account, which is basically the system admin, and create your own user, as it is not a good idea to daily-drive the root account.

First off, change root's password. You will not see what you're typing. That's a common security measure in Linux. Just type in your password and hit enter.

[root@archiso /]# passwd
New Password:
Retype new password:
passwd: password updated successfully

Now let's create your own user you're going to use. Run the following command to create your user, and change your password immediately. Try not using the same password you use for the root account.

[root@archiso /]# useradd -m -G wheel -s /bin/bash <username>
[root@archiso /]# passwd <username>
New Password:
Retype new password:
passwd: password updated successfully

In the useradd command, we specify that

  • You need a home directory (-m)
  • You belong to the wheel group (This is the admin group we're going to set up later) (-G wheel)
  • Your shell is bash (-s /bin/bash)
  • Your username is <username>

Let's make you an admin by giving the wheel group the necessary privileges. Edit the sudoers file by using a special command designed to edit that file safely.

[root@archiso /]# EDITOR=nano visudo

Here we specify the editor we want to use, which is nano. Uncomment the line below inside this file and save and close it.

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL:ALL) ALL

Now log into your user and test out your privileges. If the following command outputs root, you've successfully configured your sudo privileges.

[root@archiso /]# su <username>
[<username>@archiso /]# sudo whoami
root
[<username>@archiso /]# exit

Hostname

You can set your hostname by editing the following file:

[root@archiso /]# nano /etc/hostname
# replace <hostname> with the hostname of your choice, then save and exit
<hostname>

Enable Network Manager

You need to enable Network Manager to have it get started every time you boot.

Note: This command is case-sensitive! It won't work if you type it wrong.

[root@archiso /]# systemctl enable NetworkManager

Grub Setup

We need to install GRUB to the harddrive and generate it's default configuration. Type the following commands to do so.

Note: Replace /dev/vda with your proper drive name!

[root@archiso /]# grub-install /dev/vda
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg

Rebooting safely

You can now exit out of the live-shell by simply typing exit. You'll know when you're back in the flash drive when you see the good old red shell.

# prepare exit of live environment
[root@archiso /]# exit
---
root@archiso ~ #

Now, unmount all unmountable drives (which should include your harddrive) and reboot into your fresh Arch installation!

root@archiso ~ # umount -a
root@archiso ~ # reboot

Continue with the next guide if you'd like to install a GUI on top of Arch for ease of use.