Getting older, not necessarily wiser!
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.
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.
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.
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.
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.
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.
Now add the following lines to the hosts file and save.
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.
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.
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
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.
Don’t forget to remove the installation media before rebooting.
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.
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
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.
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 4 Configure