Arch is an open source, rolling release distribution. It’s a Linux distribution well-known for its extremely complete wiki. Almost certainly, you should have reached an Arch’s wiki entry searching for troubleshooting about other distributions.
If you’re wiling to enlarge your knowledge about Linux, it’s highly recommended trying to install Arch or another terminal-installation based distro at least once, because GUI Linux installers made that task easier. On the contrary, Arch installation is completely based on terminal commands.
You can download Arch from here.
This has been the guide followed to install Arch to a partition in my hard drive. You could also try it in a virtual machine!
Beforehand you must know you’re gonna need an Internet Connection to install Arch. The main goal of installing Arch is learning, so if you follow my steps strictly to the letter, you aren’t gonna learn as much as if you found your own path. This would be handy in case you got stuck in a step.
Booting from a usb in UEFI
The image of Arch can be copied to an usb and made booteable by running dd
as it follows:
dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx && sync
It would be sufficient to boot with Secure Boot disabled (Here you’ve got some useful information about it).
Installation
Once in the installer, you’ll get a terminal.
Pre-downloading
As usual, keyboard layout may not be the desired one, so you’ll have to change it by typing:
loadkeys layout
where possibles values for layout can be consulted in the wiki.
In my case, I configured a wifi conection with wifi-menu
, but configuring dhcpcd
and its configuration file in /etc
would be sufficient.
Now it’s time to prepare partitions. At least a partition /
is needed, but you could also split these partitions from /var
, /home
, swap
partition… In order to do that I used parted, as explained in Arch’s wiki, but fdisk
and gdisk
could also fit that purpose.
I needed to do a triple boot, because I also have Widnows and Ubuntu installed in the same machine, and I wanted to keep Ubuntu’s bootloader, so once I created /
partition, I mounted both this partition and EFI’s one in a folder in mnt
:
mkdir -p /mnt/boot/efi
mount /dev/sdxB /mnt/boot/efi
where -p
option creates also parent directories if they don’t exist, and sdxB
was my EFI partition.
System installation
Can be made typing:
pacstrap -i /mnt
pacstrap -i /mnt base base-devel
This is the step that needs internet connection.
Generation of fstab
In order to mount the /
and the /boot/efi
, you should either execute:
genfstab -U -p /mnt >> /mnt/etc/fstab
or manually configure /mnt/etc/fstab
.
Up to this point, there is a bash
script that does all the donkey work, thanks to @analca3.
Configuring the system
We have to do a chroot
now to configure the system.
If we want to do it through the current terminal:
arch-chroot /mnt /bin/bash
But in case you need to complete the installation through other operative system (Linux preferred) you can mount the created Arch partition inside that system, and do a chroot
(or equivalent), with sdxA
the partition in which Arch
is stored:
mkdir arch
cd arch
sudo mount /dev/sdxA .
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
mount -t devpts pts dev/pts/
mount --rbind /run run/
chroot . /bin/bash
Once done the chroot:
If you want more information, as usual, in the Arch’s wiki there’s plenty of information: here and here.
- Tip!
- If you want to have internet connection in the chrooted system:
-
cp -L /etc/resolv.conf ./arch/etc/resolv.conf
We need to install, using pacman -S <packages>
:
-
iw
, that is used to find Wifi’s devices names. -
wpa_supplicant
, that is used to connect to WPA networks -
dialog
, which is utilized to display dialog boxes in shells.
Now with wifi-menu
we can connect to an interface.
Setting up things
Users
It’s highly advised to change root
password:
passwd
If we desire to create a new admin account we can do it by typing:
useradd -m -G wheel -s /bin/bash username
The group wheel
is normally used to give access to sudo
and su
. We gotta add it to the sudoers
file too, uncommenting the line:
%wheel ALL=(ALL) ALL
Keymap and locale
We have to change the keymap in order not to have problems typing the passwords when we restart the system. This’ll do it:
echo "KEYMAP=es\\nFONT=lat9w-16" >> /etc/vconsole.conf
To change the locale, we have to uncomment the line corresponding to our locale in /etc/locale.gen
, and we need to compile the locale file selected by typing locale-gen
. The last step concerning to locales is choosing the language: echo LANG=en_US.UTF-8 > /etc/locale.conf
and exporting the variable of that language: export LANG=en_US.UTF-8
Time and CPU clock
To set the timezone and the clock:
ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime
hwclock --systohc --utc
Again, there’s a script made by analca3 that does some of this process, but I insist in the fact that there’s no point in deciding to install Arch if you don’t realize how things gotta be set up before being able to use the system in a normal way.
Hostname
To select a hostname name:
echo myhostname > /etc/hostname
And we modify both lines in /etc/hosts
to change the hostname.
Graphical interface
We are gonna install Xorg, the usual windows management system in UNIX systems. And a display manager so that we’ll have a running graphical interface in which we could work. In my case I had hybrid graphics with an Intel integrated GPU and a Nvidia discrete GPU:
pacman -S xorg-server xorg-server-utils xorg-init
pacman -Ss xf86-video-intel nvidia xorg-xrandr
pacman -S gnome
and
# nano /etc/X11/xorg.conf
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:PCI address determined earlier"
# e.g. BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration"
EndSection
Section "Device"
Identifier "intel"
Driver "modesetting"
Option "AccelMethod" "none"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
where PCI address determined earlier can be found in the output of lspci
in format 01:00.0
which needs to be converted to 1:0:0
.
This configuration has to be changed permanently in /etc/gdm/Init/Default
by adding, before the line exit 0
:
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
Network Manager
To install classic Gnome Network Manager the steps below are suggested:
sudo pacman -S networkmanager network-manager-applet gnome-keyring
sudo systemctl enable NetworkManager.service
sudo systemctl disable dhcpcd.service
sudo systemctl disable dhcpcd@.service
sudo systemctl stop dhcpcd.service
sudo systemctl stop dhcpcd@.service
gpasswd -a USERNAME network
sudo systemctl start wpa_supplicant.service
sudo systemctl start NetworkManager.service
The commands above make Network Manager start on boot, stop and disable starting on boot of dhcpd in order for NetworkManager to be the handler of that function.
That’ll pretty much do it.
In conclusion…
… useful knowledge I’ve gained installing Arch:
– Use of chroot
. I hadn’t use that command until I’ve come to install Arch, and it can be very handy in server management and repairing of Linux installations through Live CDs and other already installed systems.
– NVIDIA GTX 860M can be correctly configured in Arch, whereas in Ubuntu 14.04 LTS can’t be.
– Arch doesn’t use init
as the initialization daemon. It uses systemd
which has, among others, some benefits over the first one:
- It’s hotplug capable: that means that if a device, like a hard disk, is plugged in the middle or even after the boot, the system will mount as normal, whereas if
init
is the handler of initialization that doesn’t work the same way.
-
It’s easier to configure, because the old
tc.sysinit
has been split up in several files. -
It handles daemons better.
-
It’s a cross-distro-project which developers of lots of distros have been working on. And the
systemd
scripts will be distributed all the same for whatever distro we’re talking about, whereas in the older times, each distro had its ownrc scripts
. -
It’s supposed to be faster.