How to install Arch Linux [Guide]

Today, many people are approaching the GNU / Linux world, an ever-growing operating system, thanks to the Ubuntu distribution, or a Linux Mint, then they become more experienced and get bored ... They usually opt for distributions like Debian or Fedora (excellent distributions , nothing to say about it, I used both), but a distribution remains (almost) always in the dark: Arch Linux. Usually, because it's difficult to install. Well, in this article I will convince you that this is not the case, with my short tutorial for minimal installation and the following steps, to customize GNOME, install ALSA, Xorg, GDM, set the console values, the keymap, the font, the language, time zone, the strengths of Arch Linux, among which we find the forum, and the wiki, from where it is possible to take an abnormal amount of information on this fantastic distribution.

To whom it is dedicated Arch Linux?

Arch Linux, is a GNU / Linux distribution, whose image weighs roughly 600 MB, all you need to do a complete boot, the kernel, bootloader, a shell, the package manager, without a graphical shell, let alone an installer graphic. Therefore, Arch Linux must be installed through the CLI (Command Line Interface), it is difficult for those who have always used very simple graphical installers to use (see the Ubuntu installer), or do not know about bootloaders, fstab, partitioning ( even more because GParted is not even installed), and more ...

In this guide / tutorial and review, I will explain the meaning of each command in the simplest way there is.

Derivatives of Arch Linux

Arch, like other respected distributions (Debian, RedHat, etc ...) has derivatives, which integrate the same core, the same workarounds, the same init system, the same package manager, with improvements, or additions to the various teams.

Usually you install the derivatives of Arch to get Arch Linux in a very simple way with a graphical installer that does everything automatically. Or maybe with a semi-graphical interface (ncurses - C library [header C: ncurses.h] for the development of GUI-Friendly interfaces (similar to the windows written in GTK or Qt, or some other library used for the development of graphical interfaces , development follows GNU))

The derivative that I recommend most is Antergos, with Cnchi (the graphical installer, developed in Python language), pre-installed Numix theme, LigthDM (see Display Manager at the bottom) and a choice between KDE, GNOME, LXDE, MATE, or yes install a text shell without Desktop Environment (see Desktop Environment and Graphic Server at the bottom).

Returning to us, the most popular derivatives are (general purpose):

  • Antergos
  • ArchBang
  • BlackArchLinux (Pentesting)
  • Chakra
  • Manjaro
  • ArchAssault (Pentesting)
  • BBQLinux (For ROM, Kernels and Android Application developers)
  • BlueStar Linux

And many others.

How to install Arch Linux? Let's begin!

(It is assumed that the user has flashed a USB flash drive, with bootloader installed and ready to use, otherwise download ArchLinux from the Italian repository)

Start the machine, according to the boot mode that the user prefers for the installation, then, when you are in front of the bootloader (see Bootloader, at the bottom), you boot by selecting the architecture that your CPU supports (in most cases x86_64 [64 bit] is fine).
After several seconds you are in front of a tty with automatic login, we wait for 1 second and we have entered as root in zsh, the default shell of the Arch installation process. Let's start with partitioning,

load the Italian layout of the keyboard (ie the layout of the keys)

# loadkeys it

Starting and using the CFDisk partitioning program

we perform

# cfdisk / dev / sdX # where X is a value a, b, c, d, e, f, g, h, i, l, m, n, or etc ...
Partitioning with cfdisk, image not available

Image Credits: aptosid.com

thus we enter the CLI manual partitioning program

we find ourselves in front of a screen similar to this, to delete the entire hard disk and rewrite the partition table from 0 (MBR or GPT recommended), it is necessary to apply DELETE to all the hard disk partitions. If you should rethink the installation, do not panic, the changes have not yet been written, simply select "quit" to abandon the changes and write poweroff to turn off the PC and restart it from Hard Disk, otherwise, if you are convinced, select " Write ”, at this point, we have our totally clean hard disk, we need to recreate 3 partitions

  1. Partition without filesystem from 1MB, for the bootloader, type: BIOS Boot
  2. Partition with mount point / (root), ext4 filesystem, type Linux Filesystem (ie ext4), ID: 8300
  3. Partition for swap, type: Linux Swap (swap)

to create the partitions just select New, then specify the size, or the size in MegaByte or GigaByte, to specify the unit of measurement, simply write the quantity in whole numbers or in the desired floating point, if the size is in MegaByte you must specify

M

, if in GigaByte

G

Example:

1M #True 1 MB
390G #True 390 GB
4.5G #True 4,5 GB

now we will have partitions identified with

/ Dev / sd

for the 1 partition, that is the one dedicated to the bootloader, we must specify it as such, therefore, having selected that item, we click on Type and select

BIOS boot

, and so on for the other partitions, for the second:

Linux Filesystem

, for the third:

Linux swap

Ext4 formatting of the second partition and execution of the swap area

We use the tool mkfs.ext4 and mkswap

# mkfs.ext4 / dev / sdX # where X is the letter of the second partition
# mkswap / dev / sdX # where X is the letter of the third partition

Assembly of the second partition on / mnt and "switching on" of the swap area

We use the mount tool

# mount / dev / sdX / mnt

We use swapon to turn on the swap area

# swapon / dev / sdX

What is the swap area?
it is the extension of the volatile memory of the computer (or RAM memory), using a portion of a mass storage medium (for example the hard disk) or a flash memory (the pendrive)

Installation of the base Operating System su / mnt
Using pacstrap, we first configure the connection
For Ethernet connections:

# ip link set up

For wireless:

# ip link set up
# wifi-menu

, now, in wifi-menu, a program with ncurses interface you can select the desired wifi, and if a WPA or WEP passphrase is required

once connected with pacstrap:

# pacstrap -i / mnt base base-devel dialog wpa_supplicant

where the base group contains the basic programs: the kernel, a shell, the headers, the GCC compiler, the init system and more ... Dialog is a wifi-menu dependency, wpa_supplicant may be necessary.

after about fifteen minutes, the basic system was installed in / mnt (ie / dev / sdX)

FStab generation
With the genfstab tool

# genfstab -p / mnt> / mnt / etc / fstab

where / mnt is the mount point of the partition, ">" indicates output redirection to / mnt (which stands for / dev / sdX) / etc / fstab

What is FStab?
a simple text file that contains information about partitions,

an example could be the fsbt of my PC

     # UUID = fb0c5cb6-a286-438d-9ccd-f95fbe02224f / dev / sda2 / rw ext4, relatime, data = ordered0 1 # UUID = 921aa11c-ad6b-471a-bb81-125bfc6c9a47 # / dev / sda3 none swap defaults 0 0

Enter the chroot
executing the command

# arch-chroot / mnt

then switch from zsh to sh

What is chroot?
Ch = change root = root or change root, changing root, consists of the transition from a parent environment to a child environment, explained in simpler words, goes to another directory, where the child processes are executed. It is used for security purposes.

Setting the locale, hostname, root password, time zone (timezone)

1) first of all, with nano, we edit the file

/etc/locale.gen

, removing the comment (removing the #) to it_IT.UTF-8 UTF-8 and it_IT.ISO-XXXX ...

then:

# nano /etc/locale.gen
 * remove the hash (#) from it_IT.UTF-8 UTF-8 to uncomment *
 * save with CTRL + O *
 * exit with CTRL + X *

the local file is generated with the command locale-gen

# locale-gen

2) we set a hostname, that is the name of the PC in the local network

# echo "your-PC-name"> / etc / hostname

so instead of producing the output the-name-of-your-PC in the standart output channel (stdout), it is redirected to the file / etc / hostname

it is also possible to create the file / etc / hostname and enter the name of the hostname directly from nano in the first line

# nano / etc / hostname

3) We set a root password

with the passwd command

# passwd

so we will be asked to enter the new UNIX password
and then to re-enter it a second time

4) We set the timezone

# ln -sf / usr / share / zoneinfo / Europe / Rome / etc / localtime

then a symbolic link of ../Rome is created in / etc / localtime

ReBuilding of the initial ramdisk with mkinitcpio

# mkinitcpio -p linux

where -p stands for preset (–preset) and linux is the preset which is a set of hooks and Arch's default modules,
mkinitcpio is a Bash script developed by the Arch Linux community
hooks are scripts that are loaded from the ramdisk, before loading and then passing control to the kernel.
The ramdisk takes care of this: loading the kernel modules, the scripts (hooks) and the actual kernel, then takes care of passing the control to him, which in turn launches the so-called init system (in our case systemd), which launches the required daemons, display managers, network services (WICD daemon for example) and more ...
It is the first "program" (not a real program) that is loaded after the bootloader.

GRUB installation

As suggested by one of our readers (Simone Padovan, whom we thank), we install os-prober to allow GRUB to detect other operating systems, install it with pacman, from the package

os-prober
# pacman -S os-prober

downloading and installing it with pacman

# pacman -S grub

install the bootloader in / dev / sdX, which I remind you is the SECOND partition

# grub-install / dev / sdX

update of the bootloader configuration

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

What is a bootloader?
A bootloader is the first program that is run at computer startup (that the operating system is run from Hard Disk, pendrive etc.), is responsible for providing a view of the operating systems installed on your computer and launching them, and it is of fundamental importance, because without it, it is not possible to use a computer. GNU GRUB is nowadays one of the most used and most advanced bootloader, in fact it is not a simple bootloader, in fact it is possible to assign it a theme for example, change its color, manage it more easily thanks to special applications (Grub-customizer ad example). Obviously, there are other bootloaders: LILO, Syslinux etc ... Even those who use Winz (ehm ... dows) go first to the bootloader, then switch to the kernel. and so on, it's just not as obvious as in the Linux kernels.

Exit from the chroot, dismount partitions, switch off swap and restart the computer
you exit the chroot with

# exit

disassembly of the second partition

# umount / mnt

switching off the swap

# swapoff / dev / sdX

reboot

# reboot

First start, setting values ​​of /etc/vconsole.conf
first we set the values ​​of vconsole.conf
now you will have the keymap us if I'm not mistaken,
to set the Italian one:

loadkeys it

then execute

# nano /etc/vconsole.conf

and write the following values:

 KEYMAP = it LANG = it

save with

CTRL + O

and go out with

CTRL + X

User setting
suppose we want to create a user without root privileges called user1

# useradd -m -s / bin / bash user1

where the options mean:

  • -m: create the directory / home / user1
  • -s, argument / bin / bash: the userXXUMX user uses bash as a login shell
  • user1: indicates the name of the user to be created

we assign a password to the user:

# passwd user1

and as we did for root, we assign the 2 password times

if we want to assign the user the possibility of obtaining root privileges:
we must include it in the / etc / sudoers file

so, let's say, that we can write it where we want, but by order we write it under root:

with nano:

# nano / etc / sudoers

we add this string:

 user1 ALL = (ALL) ALL

therefore, now, at the next login, we can log in with user1, the password we have chosen, and the possibility of having a root shell
with the command:

 sudo -s

(I don't recommend the use of visudo)

reboot

#reboot

Wireless network (WiFi) or ethernet configuration
1) For the Ethernet network should be sufficient:

# ip link set up

for Dynamic IP addresses:

# systemctl enable dhcpcd.service

for Static IP addresses:
use netctl

# cd / etc / netctl
# cp examples / ethernet-static configuration_net

browse in / etc / netctl
copy ethernet-static from examples into net configuration
then modify the values ​​of the configuration_net file (INTERFACE, DNS, and others ...) with nano:

# nano configuration_net

once the file is saved:

# netctl enable configuration_rete

2) For the wireless network, if you have installed and dialog from pacstrap:

# ip link set up
wifi-test

follow the instructions above, although it is very simple to interpret, as it integrates a semi-graphical interface (ncurses).

Complete system update: package and database synchronization
we verify, before continuing that the system is updated:

# pacman -Syu

then we will focus on pacman, and on repository management.

restarting

# reboot

Installation and configuration of ALSA
ALSA, or Advanced Linux Sound Architecture, is a set of audio drivers of the Linux kernel, at the moment it is the most advanced,
to install ALSA and activate the sound:

# pacman -S alsa-utils

a few seconds and launch the program

# alsamixer

which provides a ncurses interface (semi-graphic) of an audio mixer, increase the volume of masters and speakers, it will be possible to verify that everything works once the DE is installed

Installing the drivers !! Important !!
1) Open source video driver

# pacman -S xf86-video-intel

for integrated Intel GPUs

# pacman -S xf86-video-ati

for dedicated ATI GPUs
(for a complete list:

pacman -Ss xf86-video | less

)

2) Driver vesa:
does not provide acceleration, is general and works with almost all GPUs, if Xorg does not find a better driver, it will refer to vesa

# pacman -S xf86-video-vesa

3) Input driver
for users like me who are on laptops or with touch-screens have to install this driver:

# pacman -S xf86-input-synaptics

4) Mesa driver for 3D acceleration:

#pacman -S mesa

Xorg installation
Xorg is the graphical server that manages the windows, it is the basis of every desktop environment (GNOME, KDE, Unity, Mate, Cinnamon, etc.), which allows you to run a GUI

Packages to install:

#pacman -S xorg-server xorg-xinit xorg-server-utils

IMPORTANT: Continue in ArchWiki # TestareX
Installation of GDM

to install and enable GDM simply run:

# pacman -S gdm
# systemctl enable gdm

GNOME installation
to install gnome:

# pacman -S gnome

, basic package

# pacman -S gnome-extra

, additional package, after the basic package
For more information: ArchWiki: GNOME

In theory, the installation is over, we hope that everything went well and we'll see you in the second part, with tips & tricks on customization and review on Arch Linux, plus my opinions.

I remind you to consult the Arch Wiki, linked above, and the forum, linked above. We assume no liability for damage caused to your machines! We recommend installing first on VirtualBox, then on a physical machine.

Receive the latest posts by email

Enter the email and choose the inscriptions on the new page

InTheBit.it
Added devices
  • Compare Smartphone (0)
  • Compare Notebook (0)
Compare