Crossing the Arch (Linux) Part 4 Configure

Published on February 7, 2022 at 5:01 am by LEW

Arch LogoIntroduction

We are in the home stretch now. In the last post we installed Arch to our drive. Just a few more things to do before we can reboot. With the exception of generating an fstab file, we will need to do everything else from within the new system we just installed. Don’t worry, it will not be difficult.

Some items might seem a bit repetitive from previous posts, just remember they applied to the live Arch instance running in RAM. When we do them again, they will apply to the Arch we installed on the drive.

Setup FSTAB

At this point we should generate an fstab file for our new install. The fstab file lists drives that will be mounted at boot time, and in what order they will be mounted. We use the following command for this.

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

The -U option uses UUID to identify the drives. We specify our root partition, which is currently mounted to /mnt. The “>>” causes the output to be appended to the file we identified (see the post on standard output, redirects and pipes).

After running the above command, we should take a quick look at the fstab file to make sure it was updated properly.

cat /mnt/etc/fstab

Change-Root into New Install

Next we want to enter our new install and set a few things up, before rebooting. To do this we use the arch-chroot command, which is a variation on the standard chroot command. The following command will change us to the new Arch install. Note the change to the command prompt when we do this.

arch-chroot /mnt

Once we are in the chgroot  environment, we no longer need to enter “/mnt” as part of the path, as it has become the base of our path.

Set Hardware Clock: Use the following command to set the hardware clock.

hwclock --systohc --utc

Set Locale: The locale sets the language, date, numbering, and currency format for your system.

The /etc/locale.gen holds a list of all locales available. Open the file in a text editor, and scan the entries.

vi /etc/locale.gen

All of them should be commented out. Find the entries that match your situation and un-comment them. Once you have saved the file, issue the following commands to generate your locale configuration. Use your chosen locale name where indicated.

locale-gen

echo LANG=[locale_name] > /etc/locale.conf

Hostname and Hosts: You will need to setup both the hostname and hosts files located in the /etc directory. To setup the hostname for your computer, use the following command with your chosen host name.

 echo [computer_hostname] > /etc/hostname

Open the hosts file with the following command.

vi /etc/hosts

Now add the following lines to the hosts file and save.

127.0.0.1    localhost

::1          localhost

127.0.1.1   [computer_hostname]

Network: We installed networkmanager when we installed the rest of the system. To use it, we want to stat and enable the service with the following command (note the capital letters).

systemctl enable NetworkManager

Root Password: Now we need to set a root password, so we will be able to log in after restart. Use the following command and follow the prompts.

passwd

Install Grub Boot loader

This is the final piece of the process, installing and configuring grub. First we need to download both grub and efibootmanager, using pacman.

pacman -S grub efibootmgr

Note, we could have done this using pacstrap earlier. I am doing it here just to keep related items together.

We need to create a directory to attach our efi partition too, then mount it using the following two commands.

mkdir /boot/EFI

mount /dev/sda1 /boot/EFI

Next we need to install grub to the efi partition we just mounted. Note this command is a little long, and one line. Make sure you type it correctly.

grub-install --target=x86_64-efi –-bootloader-id=GRUB
–-efi-directory=/boot/efi

Once installed, we need to create the grub configuration file. Use the below command to accomplish this.

grub-mkconfig -o /boot/grub/grub.cfg

It looks like we are finally there. It is time to exit back to our live Arch instance, then reboot the system.

exit

Don’t forget to remove the installation media before rebooting.

reboot

First Boot

Once the reboot is finished, log into your shiny new Arch Linux system.

There are two more items we need to take care of before we can call the install finished.

Set Time Zone: I used to do this during the install, however for a variety of reasons the timedatectl no longer works from the chroot environment we were in earlier.

We need to make sure the time is correctly presented. If you do not know your timezone, you can list them with the following command.

timedatectl list-timezones

You may want to do some filtering as the list can be somewhat long. After finding your timezone, you can set it with the following command adding your specific time zone entry. In my current case I am using Asia, and Manila

timedatectl set-timezone Asia/Manila

Unprivileged user

To create an unprivileged user for daily operations (logging in as root all the time can be both dangerous and a security risk). Use the following two commands to create a everyday user.

useradd -m [username]
passwd [username]

The -m option creates the user home directory at /home/[username]. The passwd command with the [username] will set the user password. You can’t log in without a password.

Conclusion

If everything went smoothly, you should boot to a login screen. Be aware that the Arch system installed is very minimal. Log in as root and check to make sure you have a notwork connection.

Also use pacman -Syu to make sure everything is up to date.

When I have time and resources, I plan to post some additional information about setting up Arch for production.

Crossing the Arch (Linux) Part 1 Introduction

Crossing the Arch (Linux) Part 2 Prepping

Crossing the Arch (Linux) Part 3 Install

Crossing the Arch (Linux) Part 4 Configure

Add New Comment

Your email address will not be published. Required fields are marked *