- Introducción
- Pasos preliminares
- Instalación principal
- Particionado de disco
- Formateado de disco
- Montado de discos
- Instalación de paquetes
- Fstab
- Cambio de contexto al sistema nuevo
- Configurar la zona horaria
- Configurar el idioma y la distribución del teclado en TTY
- Configuración de nombre de Host y otros Hosts
- Root y otros usuarios
- Configuración de GRUB
- Desmontar todo y reiniciar
- Automatic snapshot boot entries update
- Virtual machine [Optional]
- Ayudante de AUR e instalación de paquetes adicionales [Opcional]
- Finalization
- Video drivers
- Setting up a graphical environment
- Adding a display manager
- Gaming
- Things to add [WIP]
En este guía te mostraré como instalar Arch Linux con BTRFS en un sistema UEFI. Comentaré cada paso para hacerlo más entendible. Aparte de la instalación básica por terminal agregaré pasos para instalar controladores de video, un entorno de escritorio y configuraremos Arch para juegos.
El objetivo de esta guía es ayudar a nuevos usuarios a que se acoplen con Arch Linux al resumir el proceso de instalación y agregando opciones de configuración extra al mismo tiempo de que se añade un toque moderno, minimalista y personal, que consiste en decisiones de "diseño". Por estas razones, cuando es posible he agregado referencias externas por si alguien desea indagar en los detalles.
No prepararemos el sistema para arranque seguro porque el procedimiento de enrolar claves personalizadas en el BIOS es peligroso y puede conducir a un sistema bloqueado. Lea sobre las advertencias (en inglés) aquí. Si te estas preguntando por qué no usar las claves por defecto del OEM en el BIOS, es porque harán el arranque seguro inútil ya que probablemente no sean lo suficientemente seguras, como la wiki de Arch especifica.
No encriptaremos el sistema ya que no lo necesito y en mi opinión hay pocas situaciones donde de verdad se requiere. (siempre puedes encriptar información sensible con GPG). Además, el arranque se hará inevitablemente más lento.
Nos saltaremos la descarga de la imagen ISO, firmas GPG y la preparación del medio de instalación.
Usaré una conexión cableada, por lo que no habrá pasos para configuración inalámbrica. Si quieres conectarte al WiFi, puedes ya sea lanzar wifi-menu desde la terminal ya que es una TGUI (interfaz gráfica de usuario por terminal) ó usar iwctl.
Primero, configura tu distribución del teclado
# Lista todas las distribuciones del teclado y las filtra usando grep. En este caso estamos buscando distribuciones del teclado españolas, las cuales suelen empezar por "es". Las latinoamericanas suelen empezar por "la"
ls /usr/share/kbd/keymaps/**/*.map.gz | grep es
# Si lo prefieres, puedes desplazarte por la lista completa de esta forma
ls /usr/share/kbd/keymaps/**/*.map.gz | less
# O de esta forma
localectl list-keymaps
# Ahora identifica su nombre sin la ruta ni la extensión (localectl regresa solo el nombre) y carga la distribución. En mi caso (teclado latinoamericano) se llama "la-latin1"
loadkeys la-latin1Checa que estás en modo UEFI
# Si este comando regresa 64 ó 32, estás en modo UEFI
cat /sys/firmware/efi/fw_platform_sizeCheca que tengas conexión a Internet
ping -c 5 archlinux.orgCheca el reloj del sistema por si acaso
# Checa si ntp está activo y que la hora es correcta
timedatectlHaremos dos particiones:
| Número | Tipo | Tamaño |
|---|---|---|
| 1 | EFI | 512 Mb |
| 2 | Linux Filesystem | 99.5Gb (El resto del espacio en el disco) |
# Checa el nombre del disco. El mío es /dev/nvme0n1
# Si tienes un disco SATA es probable que sea sdax
fdisk -l
# Invoca el programa fdisk para particionar tu disco
fdisk /dev/nvme0n1
# Ahora ejecuta los siguientes comandos. Cuando escriba ENTER, presionas la tecla Enter.
g
ENTER
n
ENTER
ENTER
ENTER
+512M
ENTER
t
ENTER
ENTER
1
ENTER
n
ENTER
ENTER
ENTER # Si no quieres usar todo el espacio entonces selecciona el espacio que quieras escribiendo +XG (por ejemplo, para hacer una partición de 10GB escribe +10G)
p
ENTER # Revisa que las particiones estén bien
# Si lo están, escribe los cambios
w
ENTER
# Si no lo están, puedes salirte sin guardar y empezar de nuevo desde el inicio
q
ENTERComo sistema de archivos he escogido usar BTRFS ya que ha evolucionado mucho con los años. Tiene un conjunto de increíbles funcionalidades, pero es más conocido por su característica de Copia en Escritura que permite hacer instantáneas en un parpadeo y ahorrar espacio en disco, y si se habilita la compresión se puede ahorrar aún más espacio. También permite la creación de subvolúmenes, los cuales se puede generar instantáneas individualmente. Puedes aprender más aquí.
# Encuentra la partición EFI con fdisk -l ó lsblk y formateala. En mi caso es /dev/nvme0n1p1
mkfs.fat -F 32 /dev/nvme0n1p1
# Encuentra la partición raíz y formateala. En mi caso es /dev/nvme0n1p2. Usaremos BTRFS
mkfs.btrfs /dev/nvme0n1p2
# Monta la partición raíz para hacerla accesible
mount /dev/nvme0n1p2 /mnt# Crea los subvolúmenes. En mi caso he escogido hacer un subvolúmen para / y otro para /home. Los subvolúmenes se identifican poniendo un arroba al principio
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
# Desmontemos el sistema de archivos raíz
umount /mntPara esta guía hemos decidido comprimir los subvolúmenes BTRFS con el algoritmo Zstd ya que ha demostrado ser un buen algoritmo de los disponibles
# Monta los subvolúmenes de raíz y home. Si no quieres compresión, solamente quita la opción "compress=".
mount -o compress=zstd,subvol=@ /dev/nvme0n1p2 /mnt
mkdir -p /mnt/home
mount -o compress=zstd,subvol=@home /dev/nvme0n1p2 /mnt/homeAhora tenemos que montar la partición EFI. En general, hay dos puntos de montaje comunes: /efi ó /boot, pero en esta configuración estoy forzado a usar /efi ya que si escogemos /boot podríamos experimentar un fallo del sistema al intentar restaurar el subvolúmen @root a un estado previo después de actualizar el kernel. Esto ocurre porque los archivos de arranque como el kernel no están almacenados en @root sino en la partición EFI y por lo tanto no pueden ser guardados al hacer una instantánea de @root. Esta opción también otorga separación de preocupaciones y también es buena si uno quiere encriptar /boot, ya que no puedes encriptar los archivos EFI. Aprende más aquí.
mkdir -p /mnt/efi
mount /dev/nvme0n1p1 /mnt/efi# Esto instalará algunos paquetes para "inicializar" nuestro sistema, metafóricamente hablando. Siéntete libre de agregar los que quieras
# "base, linux, linux-firmware" son necesarios
# "base-devel" paquetes de desarrollo básicos
# "git" para instalar el sistema de control de versiones GIT
# "btrfs-progs" son utilidades del espacio de usuario para manejar el sistema de archivos (necesarias para sacarle todo el provecho a BTRFS)
# "grub" es el gestor de arranque
# "efibootmgr" es necesario para instalar GRUB en sistemas UEFI
# "grub-btrfs" agrega soporte para BTRFS en el gestor de arranque GRUB y permite al usuario arrancar directamente desde instantáneas
# "inotify-tools" usado por por el daemon de GRUB btrfsd para detectar nuevas instantáneas automáticamente y generar entradas de arranque en GRUB
# "timeshift" una interfaz gráfica para crear, planear y restaurar instantáneas usando las capacidades de BTRFS
# "amd-ucode" actualizaciones del microcódigo para procesadores AMD. Si tienes un procesador Intel, instala "intel-ucode" en su lugar
# "vim" mi editor de preferencia. Si no lo conoces bien, usa "nano" en su lugar
# "networkmanager" para manejar conexiones a internet ya sean cableadas o inalámbricas (también tiene un applet para la bandeja del sistema llamada "network-manager-applet")
# "pipewire pipewire-alsa pipewire-pulse pipewire-jack" para el nuevo sistema de audio que reemplaza a PulseAudio y JACK. Una pregunta sobre qué manejador de sesión quieres usar. Yo usaré "Wireplumber"
# "reflector" para administrar servidores espejo de pacman
# "zsh" mi interfaz shell favorita
# "zsh-completions" para poder completar comandos y otras cosas en ZSH usando la tecla Tab
# "zsh-autosuggestions" muy útil, te ayuda a escribir comandos [necesita ser configurado en el archivo .zshrc]
# "openssh" para usar SSH y manejar claves
# "man" para tener páginas del manual
# "sudo" para correr comandos como otros usuarios
pacstrap -K /mnt base base-devel linux linux-firmware git btrfs-progs grub efibootmgr grub-btrfs inotify-tools timeshift vim networkmanager pipewire pipewire-alsa pipewire-pulse pipewire-jack reflector zsh zsh-completions zsh-autosuggestions openssh man sudo# Toma los puntos de montado de los discos a como están en este momento (los montamos previamente) y genera instrucciones para informarle al sistema como montar las particiones de forma automática
genfstab -U /mnt >> /mnt/etc/fstab
# Checa que el archivo fstab esté correcto
cat /mnt/etc/fstab# Para acceder a nuestro nuevo sistema "hacemos chroot" (cambiamos de raíz) a el
arch-chroot /mnt# In our new system we have to set up the local time zone, find your one in /usr/share/zoneinfo mine is /usr/share/zoneinfo/Europe/Rome and create a symbolic link to /etc/localtime
ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
# Now sync the time to the hardware clock
hwclock --systohcEdit /etc/locale.gen and uncomment the entries for your locales, this will "enable" ( NOT ACTIVATE ) the language but also formats for time, date, currency and other country related settings. In my case I will uncomment ( ie: remove the # ) en_US.UTF-8 UTF-8 and it_IT.UTF-8 UTF-8 because I use English as a "display" language and Italian for date, time and other formats.
# To edit I will use vim, feel free to use nano instead.
vim /etc/locale.gen
# Now generate the locales
locale-genCreate the configuration file /etc/locale.conf and set the locale to the desired one, by setting the LANG variable accordingly. In my case I'll write LANG=it_IT.UTF-8 to apply Italian settings to everything and then override only the display language to English by setting LC_MESSAGES=en_US.UTF-8. ( if you want formats and language to stay the same DON'T set LC_MESSAGES ). More on this here
touch /etc/locale.conf
vim /etc/locale.confNow to make the current keyboard layout permanent for tty sessions , create /etc/vconsole.conf and write KEYMAP=your_key_map substituting the keymap with the one previously set here. In my case KEYMAP=it
vim /etc/vconsole.conf# Create /etc/hostname then choose and write the name of your pc in the first line. In my case I'll use Arch
touch /etc/hostname
vim /etc/hostname
# Create the /etc/hosts file. This is very important because it will resolve the listed hostnames locally and not over the Internet.
touch /etc/hostsWrite the following ip, hostname pairs inside /etc/hosts, replacing Arch with YOUR hostname:
127.0.0.1 localhost
::1 localhost
127.0.1.1 Arch
# Edit the file with the information above
vim /etc/hosts# Set up the root password
passwd
# Add a new user, in my case mjkstra.
# -m creates the home dir automatically
# -G adds the user to an initial group, in this case is wheel, the administration group.
useradd -mG wheel mjkstra
passwd mjkstra
# Uncomment the wheel group to allow execution of any command( ie: remove the # from the wheel line ). if you want to use nano then write EDITOR=nano instead.
EDITOR=vim visudoNow I'll deploy grub
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUBGenerate the grub configuration ( it will include the microcode installed with pacstrap earlier )
grub-mkconfig -o /boot/grub/grub.cfg# Enable newtork manager before rebooting otherwise, you won't be able to connect
systemctl enable NetworkManager
# Enable the network time synchronization
timedatectl set-ntp true
# Exit from chroot
exit
# Unmount everything to check if the drive is busy
umount -R /mnt
# Reboot the system and unplug the installation media
rebootEdit grub-btrfsd service to enable automatic grub entries update each time a snapshot is created. Because I will use timeshift i am going to replace ExecStart=... with ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto. If you don't use timeshift or prefer to manually update the entries then lookup here
sudo systemctl edit --full grub-btrfsd
# Enable grub-btrfsd service to run on boot
sudo systemctl enable grub-btrfsdFollow these steps if you are running Arch on a Virtualbox VM.
# Install the guest utils
pacman -S virtualbox-guest-utils
# Enable this service to automatically load the kernel modules
systemctl enable vboxservice.serviceNote: the utils will only work after a reboot is performed.
Warning: the utils seems to only work in a graphical environment.
To gain access to the arch user repository we need an aur helper, I will choose yay which also works as a pacman wrapper ( which means you can use yay instead of pacman. Cool, right ? ). Yay has a CLI, but if you later want to have an aur helper with a GUI, I advise installing pamac, which is the default on Manjaro.
To learn more about yay read here
Note: you can't execute makepkg as root, so you need to log in your main account. For me it's mjkstra
# Install yay
pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si
# Install "timeshift-autosnap", a configurable pacman hook which automatically makes snapshots before pacman upgrades.
yay -S timeshift-autosnapLearn more about timeshift autosnap here
# To complete the main/basic installation reboot the system
rebootAfter these steps you should be able to boot on your newly installed Arch Linux, if so congrats !
The basic installation is complete and you could stop here, but if you want to to have a graphical session, you can continue reading the guide.
In order to have the smoothest experience on a graphical environment, Gaming included, we first need to install video drivers. To help you choose which one you want or need, read this section of the arch wiki.
Note: skip this section if you are on a Virtual Machine
For this guide I'll install the AMDGPU driver which is the open source one and the recommended, but be aware that this works starting from the GCN 3 architecture, which means that cards before RX 400 series are not supported. ( FYI I have an RX 5700 XT )
# What are we installing ?
# mesa: DRI driver for 3D acceleration
# xf86-video-amdgpu: DDX driver for 2D acceleration in Xorg
# vulkan-radeon: vulkan support
# libva-mesa-driver: VA-API h/w video decoding support
# mesa-vdpau: VDPAU h/w accelerated video decoding support
sudo pacman -S mesa xf86-video-amdgpu vulkan-radeon libva-mesa-driver mesa-vdpauIF you want add 32-bit support, we need to enable the multilib repository on pacman: edit /etc/pacman.conf and uncomment the [multilib] section ( ie: remove the hashtag from each line of the section. Should be 2 lines ). Now we can install the additional packages.
# Refresh and upgrade the system
yay
# Install 32bit support for mesa, vulkan, VA-API and VDPAU
pacman -S lib32-mesa lib32-vulkan-radeon lib32-libva-mesa-driver lib32-mesa-vdpauIn summary if you have an Nvidia card you have 2 options:
I won't explain further because I don't have an Nvidia card and the process for such cards is tricky unlike for AMD or Intel cards. Moreover for reason said before, I can't even test it.
Installation looks almost identical to the AMD one, but every time a package contains the radeon word substitute it with intel. However this does not stand for h/w accelerated decoding, and to be fair I would recommend reading the wiki before doing anything.
I'll provide 2 options:
- KDE-plasma
- Hyprland
On top of that I'll add a display manager, which you can omit if you don't like ( if so, you have additional configuration steps to perform ).
KDE Plasma is a very popular DE which comes bundled in many distributions. It supports both the older more stable Xorg and the newer Wayland protocols. It's user friendly and also it's used on the Steam Deck, which makes it great for gaming. I'll provide the steps for a minimal installation and add some basic packages.
# Install the plasma desktop environment, the audio and network applets, task manager, screen configurator, global shortcuts, power manager, some useful basic addons, configuration for GTK application theming and other package of personal interest
pacman -S plasma-desktop plasma-pa plasma-nm plasma-systemmonitor kscreen khotkeys powerdevil kdeplasma-addons kde-gtk-config breeze-gtk alacritty dolphin firefox kate okular mpv gimpNow don't reboot your system yet. If you want a display manager, which is generally recommended, head to the related section in this guide and proceed from there otherwise you'll have to manually configure and launch the graphical environment each time (which I would advise to avoid).
Hyprland is a tiling WM that sticks to the wayland protocol. It looks incredible and it's one of the best Wayland WMs right now. It's based on wlroots the famous library used by Sway, the most compatible/working Wayland WM there is. I don't know if I would recommend this to beginners because it's a different experience from Windows/Ubuntu/PopOs and distros like that, moreover it requires you to read the guide for configuration. The good part is that even if it seems discouraging, it's actually an easy read because it is written beautifully even better than the Arch wiki !
# Install hyprland from tagged releases and other utils
pacman -S --needed hyprland swaylock wofi waybar dolphin alacritty
yay -S wlogoutNote: this section needs configuration and misses a lot of stuff, I don't know when and if I will expand it but at least you have a starting point, which is the wiki and the master tutorial
Display managers are useful when you have multiple DE or WMs and want to choose where to boot from in a GUI fashion, also they take care of the launch process. I'll show the installation process of SDDM, which is highly customizable and compatible.
Note: hyprland does not support any display manager, however SDDM is reported to work flawlessly from the wiki
# Install SDDM
sudo pacman -S sddm
# Enable SDDM service to make it start on boot
sudo systemctl enable sddm
# If using KDE I suggest installing this to control the SDDM configuration from the KDE settings App
pacman -S --needed sddm-kcm
# Now it's time to reboot the system
rebootGaming on linux has become a very fluid experience, so I'll give some tips on how to setup your arch distro for gaming.
Let's break down what is needed to game:
- Gaming client ( eg: Steam, Lutris, Bottles, etc..)
- Windows compatibility layers ( eg: Proton, Wine, DXVK, VKD3D )
Optionally we can have:
- Generic optimization ( eg: gamemode )
- Overclocking and monitoring software ( eg: CoreCtrl, Mangohud )
- Custom kernels
I'll install Steam and to access games from other launchers I'll use Bottles, which should be installed through flatpak.
# Install steam and flatpak
pacman -S steam flatpak
# Install bottles through flatpak
flatpak install flathub com.usebottles.bottlesProton is the compatibility layer developed by Valve, which includes DXVK( DirectX 9-10-11 to Vulkan), VKD3D ( DirectX 12 to Vulkan ) and a custom version of Wine. It is embedded in Steam and can be enabled directly in Steam settings. A custom version of proton, Proton GE exists and can be used as an alternative if something is broken or doesn't perform as expected. Can be either downloaded manually, like explained here or through yay as below.
# Installation through yay
yay -S proton-ge-custom-binTips: To have a more fluid shader compilation when using steam, enable from its settings shader precaching and background processing of vulkan shaders
We can use gamemode to gain extra performance. To enable it read here
# Install gamemode
pacman -S gamemodeTo live monitor your in-game performance, you can use mangohud. To enable it read here
# Install mangohud
pacman -S mangohudTo overclock your system, i suggest installing corectrl if you have an AMD Gpu or TuxClocker for NVIDIA.
Tip: On KDE disabling mouse acceleration is simple, just go to the settings via the GUI and on the mouse section enable the flat acceleration profile. If not using KDE then read here
Tip: To enable freesync or Gsync you can read here, depending on your session ( Wayland or Xorg ) and your gfx provider ( Nvidia, AMD, Intel ) the steps may differ. On a KDE wayland session, you can directly enable it from the monitor settings
About custom kernels: To be fair I don't recommend changing the kernel to a custom one, for many reasons:
- You have to manually update it and recompile it each time unless you use a precompiled kernel from pacman or aur such as
linux-zen- Performance gain is little to none and sometimes it may results in losses with other scenarios
- In my opinion changing to a custom kernel should be considered only if you experience problems or for the sake of science
- Additional pacman configuration ( paccache, colors, download packages simultaneously )
- Reflector configuration