User:Erkexzcx

From ArchWiki
Jump to navigation Jump to search
Note:

This is my unofficial Arch Linux installation guide for very beginners with basic Linux/Computing knowledge, who wish to start using Arch Linux, but finds it impossible to install. Things to note:

  • Tutorial does not go much into the details, so consider this tutorial only as a starting point.
  • This is UEFI based Arch Linux installation. If you are installing in BIOS mode - your partitioning and grub set-up will be different.

Basic Arch Linux installation

Understanding the installation

  1. Boot up Arch Linux from USB stick (live mode).
  2. Set up internet connectivity.
  3. Set up partitions.
  4. Format partitions.
  5. Mount partitions.
  6. Install Arch Linux to those mounted partitions.
  7. Generate FSTAB partitions scheme to Arch Linux installation (so it knows how to mount everything before booting up)
  8. Chroot (AKA "login") to Arch Linux installation.
  9. Basic configuration - timezone, locale, hostname, root user password etc...
  10. Install some required (common) packages.
  11. Set up GRUB bootloader (it boots your system)

At the end of this page I will also give few tips on how to further set up complete desktop on this basic arch linux installation.

Internet connectivity

Test internet connection

Use ping www.google.com to see if you are getting responses from a Google's server.

Connect to a WiFi

Execute command wifi-menu to use automated step by step program to connect to WiFi. Follow the instructions and you should be good to go. Test internet connectivity afterwards with ping www.google.com.

Tip: In case you need to define which Wifi interface to use, use wifi-menu wlpxxxxxxxxx instead, where wlpxxxxxxxxx can be found with command iw dev.

Partitioning

Use lsblk and lsblk -f to see the information about your detected hard drives and their partitions.

Destroy all partitions

This completely destroys all data on your hard drive:

# sgdisk --zap-all /dev/sda

Create partitions

Create 2 partition on your hard drive - one is for EFI installation, second is for Arch Linux installation. Type command cgdisk /dev/sda to enter interactive CLI menu.

First, delete all the partitions (if any).

Then create new partition, first sector is default size suggested (just press enter), but for last sector, write 500M and hit enter. Partition code is ef00 and give any partition title you want.

Then create new partition, first and last sector is default size suggested (just press enter). Partition code is also default (should be 8300) and give any partition title you want.

At the end - write and quit. Use lsblk and lsblk -f to confirm your new partitions - first should be the size of approximately 500Mb and the other partition should be the rest of your hard drive size.

Format partitions

The new created partitions cannot be used until you format them.

Format the first EFI partition (the one that has about 500Mb space):

# mkfs.fat -F32 /dev/sda1

Then format second partition (the one that has the rest of hard drive space):

# mkfs.ext4 /dev/sda2

Mount partitions

Mount your prepared partitions so you can write some data (files) to them:

Mount first the second partition (the one that has the rest of your hard drive size) to /mnt directory :

# mount /dev/sda2 /mnt

Create boot folder in mounted partition:

# mkdir /mnt/boot

And mount EFI partition to that boot folder:

# mount /dev/sda1 /mnt/boot

Use lsblk and lsblk -f to confirm if you successfully mounted your partitions.

Install base Arch Linux system

Configure mirrors

Note: Pacman mirrors configuration is completely optional, but it is very likely that you will be downloading ~450mb of packages with download speed of 20-100kb/s (instead of approx 2-8mb/s).

First, go to /etc/pacman.d/:

# cd /etc/pacman.d/

Then comment out every mirror in pacman mirrors list:

# sed -i 's/^Server/#Server/' mirrorlist

Then edit the file:

# nano mirrorlist

And uncomment only preferred mirrors (from the same or nearby countries). For example - uncommented mirror from Lithuania:

## Lithuania
Server = http://mirrors.atviras.lt/archlinux/$repo/os/$arch

Install system

Perform this command to install base Arch Linux installation to /mnt directory:

# pacstrap /mnt base base-devel

Create fstab

Fstab file contains what and how must be mounted before booting up. The good thing that there is an app to generate fstab file automatically for you:

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

You might also want to check if there is at least 2 lines containing information about partitions and their options:

# cat /mnt/etc/fstab

Enter the chroot mode

If you don't know what is chroot - think about logging into the installed system (AKA directory, where it is installed) with a root user, but without password. Everything you do in chroot mode will be permanent (will not be lost after reboot) and this procedure is usually used to fix existing systems when they no longer boots.

Enter Chroot mode with this command:

# arch-chroot /mnt

Set up locale

Set the US locale to your system.

Uncomment #en_US.UTF-8 UTF-8 to en_US.UTF-8 UTF-8:

# nano /etc/locale.gen

Then apply changes to the system:

# locale-gen

Also write LANG=en_US.UTF-8 to /etc/locale.conf file. This is needed for most of the programs:

# echo LANG=en_US.UTF-8 > /etc/locale.conf

Set up timezone

Just run this and follow the steps:

# tzselect

Then create symbolic link as per below command. Ensure you replace Zone and SubZone accordingly:

# ln -sf /usr/share/zoneinfo/Zone/SubZone /etc/localtime

Example: ln -sf /usr/share/zoneinfo/Europe/Vilnius /etc/localtime

Set the hardware clock

Execute this command:

# hwclock --systohc --utc

Set the hostname

Just give a name to your computer (without space). Example would be ARCHLINUX:

# echo ARCHLINUX > /etc/hostname

Set the password

Use command passwd root to change root user password.

Install bootloader

We will be using the most popular bootloader GRUB.

Install required packages for grub installation & configuration:

# pacman -S grub efibootmgr

Then install GRUB as a bootloader:

# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
Note: Check the output - if grub-install says that errors occurred, then there is almost 100% chance your system will not boot.

Then (re)generate GRUB config file:

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

Install other required packages

Common networking applications

I believe these are must packages to have for fully functioning system. Later or sooner you will need them, so install:

# pacman -S net-tools wireless_tools dialog iw wpa_supplicant

Microcode updates

You might also want to install Microcode updates to your system:

# pacman -S intel-ucode      # For Intel processors only
# pacman -S amd-ucode        # For AMD processors only

And do not forget to update grub configuration afterwards:

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

Reboot

Exit the chroot mode:

# exit

Reboot computer:

# reboot

And GRUB menu should show up when computer starts to boot. After it the system boots. Login will be user root and the password you set previously.

Make functioning desktop out of basic installation

Below are the steps to set up fully functioning desktop (GUI) on your PC/Laptop. Again - this is intended for beginners, therefore I am not going much into the details. Consider you already booted up to your installed Arch Linux system.

Understanding steps

  1. Connect to the internet (we will be downloading packages)
  2. Create regular user (and allow him to have root permissions)
  3. Set up graphics:
    1. Install Xorg video server (do not confuse - this is not a driver.)
    2. Install XFCE Desktop Environment
    3. Install LightDM login manager
  4. Install Pulseaudio audio server (allows to have audio)
  5. Install NetworkManager (manage internet connectivity)
  6. Finishing touches:
    1. Fix broken fonts (arch linux issue)
    2. Set up user directories (desktop, downloads, documents...)
    3. Install Web browser
    4. Install Trizen (install AUR packages with "pacman")

Note that most of the steps does not need to be performed in order! :)

Internet connectivity

Same steps as per User:Erkexzcx#Internet_connectivity.

Create regular user

Create user

First create new user with its home directory:

# useradd --create-home name

Then set user password:

# passwd name

Add user to wheel group:

# gpasswd -a name wheel

Allow user to gain root access

Install sudo package:

# pacman -S sudo

Then using nano editor edit sudoers file:

# nano /etc/sudoers

And uncomment this line (delete # in front of it):

# %wheel ALL=(ALL) ALL

Then save that file.

Tip: If you do not want to enter password when using sudo command, then uncomment # %wheel ALL=(ALL) NOPASSWD: ALL instead.

Install Xorg video server

# pacman -S xorg-server

Install XFCE desktop environment

# pacman -S xfce4 xfce4-goodies

Install NetworkManager

Install required packages with this command:

# pacman -S networkmanager network-manager-applet gnome-keyring

Then enable NetworkManager on boot:

# systemctl enable NetworkManager.service

And your system automatically connects to WiFi/Ethernet on boot. Going forward, usage from terminal:

$ nmtui

If you want to use from GUI - the network manager applet should appear in your XFCE panel.

Install LightDM login manager

# pacman -S lightdm lightdm-gtk-greeter

Then enable lightdm on boot:

# systemctl enable lightdm.service

Install Pulseaudio packages

Install Pulseaudio audio server as well as few additional configuration packages (applications):

# pacman -S pulseaudio pulseaudio-alsa alsa-utils pavucontrol

Install browser

Note: google-chromeAUR is installable from AUR, not from official repositories. At the end of this tutorial you will be able to install it easily using trizen command (pacman wrapper}.
# pacman -S firefox

Install monospace font

If you do not install this, then your terminal (in desktop environment) fonts will be broken (characters overlapping):

# pacman -S ttf-dejavu

Reboot

Reboot the system. After reboot you should see lightdm login manager - login using your created user to XFCE desktop environment.

Note: Audio might not be working, so use GUI application pavucontrol or alsa-mixer to unmute/configure it. You might also need to add pulseaudio mixer to XFCE panel in order to change audio with a mouse.

Install user directories

Install required package:

# pacman -S xdg-user-dirs

Then execute this command:

$ xdg-user-dirs-update

Then default directories in your home directory will be created (like Downloads or Desktop).

Install trizen

Trizen is pacman wrapper, which does everything that pacman does, but also adds extra functionality, so you can install packages from AUR and from official repositories with the same command.

Install it by executing below commands (P.S. This is how packages from AUR are being installed manually):

$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/trizen.tar.gz   # Download compressed AUR package script files
$ tar -xvzf trizen.tar.gz                                               # Decompress those files
$ cd trizen                                                             # Enter decompressed folder
$ makepkg -si                                                           # Download dependencies, build package and install it
$ trizen                                                                # Execute once to generate config file

Example of installing Google Chrome from AUR:

$ trizen -S google-chrome

Example of installing Firefox from official repositories:

$ trizen -S firefox
Tip: It is not necessary (neither recommended), but if you do not want to inspect AUR files or be asked to retry building AUR packages, then run as regular user trizen command and at the end of output, you will see full path to config file. Edit it and change line ask_for_retry => 0 to ask_for_retry => 1 and also change noedit => 0 to noedit => 1.

Further reading

I suggest reading these Arch Wiki pages to get familiar with Arch Linux and Arch Wiki:

Tip: XFCE, by default, looks ugly (IMHO), so to make it look nicer, install packages xfce-theme-manager arc-gtk-theme arc-icon-theme, then open XFCE Theme Manager GUI app and change the theme as well as icons. :) Reboot the system if some elements were not affected by theme.

How to fix completely broken system

This is just a guidance on where to start looking for issues if they cannot be fixed from the same system (e.g. system not booting up).

First, boot up Arch Linux from USB stick (live mode).

Then connect to internet (if you need it) as per instructions in User:Erkexzcx#Internet_connectivity.

Then using lsblk and lsblk -f detect which partition is Arch Linux installation and which is EFI installation. EFI should be the size of about 500Mb. Let's assume dev/sda1 is EFI partition and dev/sda2 is linux installation:

# mount /dev/sda2 /mnt          # Mount /dev/sda2 on /mnt directory
# mount /dev/sda1 /mnt/boot     # Mount /dev/sda1 on /mnt/boot directory
# arch-chroot /mnt              # Chroot to /mnt directory (our system is mounted to it)

Example 1

Lightdm is not starting or not allowing to login or access terminal.

Chroot to system, then it is likely a good idea to disable Lightdm (no longer start on boot):

# systemctl disable lightdm.service

Then reboot your system:

# exit
# reboot

Example 2

Forgot user (or root user) password.

Chroot to system, then:

# passwd user

Then reboot your system:

# exit
# reboot