Skip to content

sumithemmadi/ArchLinux-Installation-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

ArchLinux-Installation-Guide

This is a guide for arch linux installation with Openbox Window Manager.

Image


Installing Arch Linux

Small notes before we start

  • Arch Linux now comes with an installer, so if you just want a minimal system ready in a few minutes, you're better off just doing
    archinstall
  • The only officially supported architecture by Arch Linux is x86_64, so make sure your computer uses that architecture before attempting to install it.
  • This guide is for UEFI only, not BIOS.
  • so you should enable the UEFI mode and disable the secure boot option on your BIOS system. (Also remember to change the boot order to boot through your USB device).

Bootable Flash Drive

First of all, you need the Arch Linux image, that can be downloaded from the Official Website. After that, you should create the bootable flash drive with the Arch Linux image.

If you're on a GNU/linux distribution, you can use the dd command for it. Like:

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync && sync

Note that you need to update the of=/dev/sdx with your USB device location (it can be discovered with the lsblk command).

Otherwise, if you're on Windows, you can use balenaEtcher or Rufus. You can follow this tutorial


  • Disable Secure Boot in the UEFI.

  • Boot from the USB drive.

Check boot mode

To check if the UEFI mode is enabled, run:

ls /sys/firmware/efi/efivars

If the directory does not exists, the system may be booted in BIOS (not UEFI).

(Dual Boot) Disable Fast Startup in Windows

https://help.uaudio.com/hc/en-us/articles/213195423-How-To-Disable-Fast-Startup-in-Windows-10


Pre installation

Time to connect to the Internet:

  • If you're not going to use DHCP, check the Arch Wiki on how to manually set a static IP.

  • If you're using a wired connection (recommended), it should already be working.

  • If you're using a wireless connection, the live system comes with iwd enabled, so you can use iwctl. iwctl's man page (man iwctl) shows a simple example on how to connect to a network. iwctl

  • If scanning with iwctl isn't working (you get no networks found), simply do systemctl restart iwd and try again.

  • Do ping -4c4 archlinux.org to verify that everything is working properly.

    ping -4c4 archlinux.org

Update System Clock

Ensures that the system clock is accurate.

timedatectl set-ntp true

Partitioning

First, define your partitions size. There's no rules about this process.

Tip: If you use a SSD drive, it's recommended to leave 25% of his storage free. More info here.

My SSD has 512GB of storage. I want to have Dual-Boot with Windows11. If Windows was installed first, then you could see it's partitions. For that example, I have 4 Windows partitions already created: (in my case, I'll work with /dev/nvme0n1 disk. Use fdisk -l /dev/nvme0n1 to list partitions)

Name Size Type
nvme0n1p1 625M Windows recovery environment
nvme0n1p2 100M EFI System
nvme0n1p3 16M Microsoft Reserved
nvme0n1p4 356G Microsoft Basic Data

EFI partition was created by Windows, so we don't need to care about it. We need to create additional partitions for Linux installation.

Name Mount Size Type
nvme0n1p5 swap 4G Linux Swap
nvme0n1p6 / 32G Linux Root x86-64 (Ext4)
nvme0n1p7 /home Remaining Space Linux Home (Ext4)

Look at partitioning layout examples: https://wiki.archlinux.org/index.php/partitioning#Example_layouts

Create Partitions

Use fdisk to create partitions.

To create partitions, I'll use gdisk since to work on UEFI mode we need GPT partitions.

First, list partitions (Informational only) with the following command

fdisk -l /dev/nvme0n1

Here's a table with some handy gdisk commands

Command Description
p Print partitions table
n Add a new partition
d Delete a partition
w Write table to disk and exit
l List known partition types
t Change a partition type
m Help
  1. Enter in the interactive menu

     fdisk /dev/nvme0n1
  2. Create boot partition (If not Dual-Boot)

    • Type n to create a new partition
    • Partition Number: default (return)
    • First Sector: default
    • Last Sector: +512M
    • Type: 1 - EFI System
  3. Create root partition

    • Type n to create a new partition
    • Partition Number: default
    • First Sector: default
    • Last Sector: +32G
    • Type: 24 - Linux Root (x86-64)
  4. Create swap partition

    • Type n to create a new partition
    • Partition Number: default
    • First Sector: default
    • Last Sector: +4G
    • Type: 19 - Linux Swap
  5. Create home partition

    • Type n to create a new partition
    • Partition Number: default
    • First Sector: default
    • Last Sector: default
    • Type: 28 - Linux Home
  6. Save changes with w

Format partitions

Once the partitions have been created, each (except swap) should be formatted with an appropriated file system. So run:

mkfs.btrfs -L arch_root /dev/nvme0n1p6  #-- root partition
mkfs.btrfs -L HOME /dev/nvme0n1p7       #-- home partition

If not Dual Boot format partition for EFI boot

mkfs.fat -F32 -n BOOT /dev/nvme0n1p2  #-- boot partition

The process for swap partition is slight different:

mkswap -L swap /dev/nvme0n1p5
swapon /dev/nvme0n1p5

To check if the swap partition is working, run swapon -s or free -h.

Mount file system

  1. Mount root partition:

     mount /dev/nvme0n1p6 /mnt
  2. Mount home partition:

    mkdir -p /mnt/home
    mount /dev/nvme0n1p7 /mnt/home
  3. Mount boot partition: (to use grub-install later)

    mkdir -p /mnt/boot
    mount /dev/nvme0n1p2 /mnt/boot

    Do lsblk to verify everything is correct.


Installation

Now we'll install arch on disk

Select Mirror

Before installation,It is recommended to select the best mirror servers.

So open the file /etc/pacman.d/mirrorlist (again, you can use nano or vi to do that) and move the best mirror to the top of the file.

Tip: That link generates a mirror list based on your location, you can use them as reference.

Install Base Packages

Now that the mirrors are already set, use pacstrap to install the base package group: Open the file /etc/pacman.conf and uncomment the line #ParallelDownloads = 5

pacstrap /mnt base{,-devel} btrfs-progs dkms linux{{,-lts}{,-headers},-firmware} nano
  • If the install failed because of signature issues, run below command to update the keyring and try again
    pacman -Sy --needed archlinux-keyring

Generate fstab

Now you should generate the fstab with the genfstab script:

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

Optional: You can add noatime,commit=60,barrier=0 to the generated fstab file (on root and home partitions) to increase IO performance. https://wiki.archlinux.org/index.php/ext4#Improving_performance

Chroot

Now, we'll change root into the new system

arch-chroot /mnt

Check pacman keys

pacman-key --init
pacman-key --populate archlinux

Basic system configuration

  • Again open the file /etc/pacman.conf and uncomment the line #ParallelDownloads = 5

    nano /etc/pacman.conf
  • Uncomment this line #ParallelDownloads = 5

  • Press CRTL + S to save and CRTL + X to exit

Install some important packages with

pacman -S dhclient git man-{db,pages} nano networkmanager openssh polkit vi vim
  • Edit the file /etc/NetworkManager/conf.d/dhcp.conf to contain the following:

    [main]
    dhcp=dhclient
    
  • Edit the file /etc/NetworkManager/conf.d/dns.conf to contain the following:

    [main]
    dns=systemd-resolved
    
  • If you want to enable mDNS support, which is useful for adding network printers for example, do the following:

    • Edit the file /etc/systemd/resolved.conf and uncomment the line #MulticastDNS=yes

    • Edit the file /etc/NetworkManager/conf.d/dns.conf and add the following lines:

      [connection]
      connection.mdns=2
      

  • Do ln -svf /usr/share/zoneinfo/$(tzselect | tail -1) /etc/localtime to set your timezone.

  • Example

    ln -svf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
  • Then, do hwclock -w to update the hardware clock.

  • You can do hwclock -r to see the current time stored by the hardware clock. You'll notice that it takes the timezone into account.


  • Open the file /etc/locale.gen. Uncomment the en_US.UTF-8 and any other locales you want to use.

  • Do locale-gen to generate the uncommented locales.

  • Do echo LANG=LOCALE > /etc/locale.conf, LOCALE being your preferred locale from the ones you just generated.

  • Example

    echo LANG=en_US.UTF-8 > /etc/locale.conf
    
  • Now you'll have to execute the following command:

    locale-gen
  • Do echo KEYMAP=KEYMAP > /etc/vconsole.conf, KEYMAP being the name of the keymap you're using (set when you used the loadkeys command earlier).

  • Example:

    echo KEYMAP=mac-us > /etc/vconsole.conf
  • Do echo FONT=lat0-16 >> /etc/vconsole.conf. You can find all fonts available in /usr/share/kbd/consolefonts.


  • Do echo HOSTNAME > /etc/hostname, HOSTNAME being the name you want your system to have.

  • The hostname must be compatible with the following regex expression: ^(:?[0-9a-zA-Z][0-9a-zA-Z-]{0,61}[0-9a-zA-Z]|[0-9a-zA-Z]{1,63})$.

  • You can click here and put the hostname you want your computer to have in the text field to see if you can actually use it.

  • Edit the file /etc/hosts to contain the following:

    
    # Static table lookup for hostnames.
    # See hosts(5) for details.
    
    127.0.0.1   localhost
    ::1         localhost
    127.0.1.1   HOSTNAME
    

    Note: HOSTNAME being the hostname you chose in the previous command.


  • Enable some services with

    systemctl enable sshd NetworkManager systemd-resolved
  • If you have an SSD, do

    systemctl enable fstrim.timer
  • Run below commad for the system to automatically update the pacman keyring.

    systemctl enable archlinux-keyring-wkd-sync.timer

Initramfs

How To Set the Root Password

You may want to set a password for the root user because why not? To do so, execute the following command:

passwd

The passwd command lets you change the password for a user. By default it affects the current user's password which is the root right now.

It'll ask for a new password and confirmation password. Input them carefully and make sure you don't forget the password.


How To Install Microcode

According to PCMag,

A set of elementary instructions in a complex instruction set computer (CISC). The microcode resides in a separate high-speed memory and functions as a translation layer between the machine instructions and the circuit level of the computer. Microcode enables the computer designer to create machine instructions without having to design electronic circuits. Processor manufacturers such as Intel and AMD often release stability and security updates to the processor. These updates are crucial for the system's stability.

In Arch Linux, microcode updates are available through official packages that every user should install on their systems.

Just installing these packages is not enough though. You'll have to make sure that your bootloader is loading them. You'll learn about it in the next section.

  • Time to install the microcode updater:
    • If you're using an Intel CPU, do

      pacman -S intel-ucode
    • If you're using an AMD CPU, do

      pacman -S amd-ucode

How To Install and Configure a Boot Loader

  • Run below command to install grub and efibootmgr.

    pacman -S grub efibootmgr os-prober
  • If you're dual-booting with other operating systems, you'll have to enable os-prober before generating the configuration file. To do so, open the /etc/default/grub file in nano text editor. Locate the following line and uncomment it:

    # GRUB_DISABLE_OS_PROBER=false
    

    This should be the last line in the aforementioned file so just scroll to the bottom and uncomment it.

  • Then do

    grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch\ Linux
  • Then do

    grub-mkconfig -o /boot/grub/grub.cfg
    
  • Do exit and then umount -R /mnt.

  • You can now do shutdown now.

Congratulations! You've installed Arch Linux

But we're not done yet. We still have to create a user and do some final touches




Creating a user

  • Start by logining in as root. Do ln -svf /run/systemd/resolve/resolv.conf /etc/resolv.conf.

    ln -svf /run/systemd/resolve/resolv.conf /etc/resolv.conf
    sudo pacman -S zsh
  • Change root's shell by doing chsh -s /bin/zsh.

  • Do timedatectl set-ntp true and timedatectl status again to make sure the time is setup correctly. The RTC and Universal time should be in UTC and the Local time in your timezone.


  • Now add a user by doing useradd -m -U -G wheel -s /bin/zsh -c "REAL NAME" USERNAME, REAL NAME being the user's real name, and USERNAME a valid username. Example:

    useradd -m -U -G wheel -s /bin/zsh -c "Sumith Emmadi" sumithemmadi
  • Usernames in Unix-like OSs are valid if they're compatible with the regex expression ^[a-z_]([0-9a-z_-]{0,31}|[0-9a-z_-]{0,30}\$)$.

  • You can check if a username is valid by clicking here.

  • Set the user's password with passwd USERNAME. Example:

    passwd sumithemmadi
  • Finally, you'll have to enable sudo privilege for this new user. To do so, open the /etc/sudoers file using nano. Once open, locate the following line and uncomment it:

    # %wheel ALL=(ALL:ALL) ALL
  • Add the line Defaults pwfeedback, preferably before ## Runas alias specification in same file, if you want asterisks when inputting your password.

  • This file essentially means that all users in the wheel group can use sudo by providing their password. Save the file by hitting Ctrl + S and exit nano by hitting Ctrl + X. Now the new user will be able to use sudo when necessary.


  • Do nmtui and setup your Internet connection.

  • Open the file /etc/pacman.conf and perform the following:

    • Uncomment the line #ParallelDownloads = 5.
    • Uncomment the line #[multilib] and the line below it.
  • Do pacman -Syu to update pacman's configuration and to perform any updates available.

  • Reboot by doing shutdown -r now.




User configuration

  • Login as the user you've created. In the ZSH configuration, continue to configure zsh or press q to quit if you already have a configuration in your dotfiles.

    sudo pacman -S bat lm_sensors neofetch

Additional Tools

Install Paru AUR helper in Arch Linux, EndeavourOS, Manjaro Linux

Installing Paru in Arch Linux is easy!

  • First, install git and base-devel package group that includes tools needed for building (compiling and linking) packages from source.

    sudo pacman -S --needed git base-devel
  • Git clone Paru repository using command:

    git clone https://aur.archlinux.org/paru-bin.git

    This command will download the contents of the Paru GitHub repository in a local directory named paru-bin.

  • Change into the paru directory:

    cd paru-bin
  • Finally, build and install Paru AUR helper in Arch Linux using the following command:

    makepkg -sri
  • After the installation is done, do cd .., and then rm -rf paru-bin.

  • Now you can use paru for install packages from AUR

  • From now on we'll be using paru instead of sudo pacman.

    paru -S xdg-user-dirs pacman-cleanup-hook

oh-my-zsh

  1. Setup zsh with oh-my-zsh framework.

    paru -S oh-my-zsh-git oh-my-zsh-plugin-syntax-highlighting oh-my-zsh-plugin-autosuggestions

Extras

Set-up TTF Fonts

Follow this tutorial

Bluetooth Headphone

To connect the headphone:

  1. Install required packages:

    sudo pacman -S pulseaudio pulseaudio-bluetooth pavucontrol bluez-utils
  2. Edit /etc/pulse/system.pa and add:

    load-module module-bluez5-device
    load-module module-bluez5-discover
    
  3. Connect to bluetooth device

    $ bluetoothctl
    # power on
    # agent on
    # default-agent
    # scan on
    # pair HEADPHONE_MAC
    # trust HEADPHONE_MAC
    # connect HEADPHONE_MAC
    # quit

To auto switch to A2DP mode:

  1. Edit /etc/pulse/default.pa and add:

    .ifexists module-bluetooth-discover.so
    load-module module-bluetooth-discover
    load-module module-switch-on-connect  # Add this line
    .endif
  2. Modify (or create) /etc/bluetooth/audio.conf to auto select AD2P profile:

    [General]
    Disable=Headset
  3. Reboot PC to apply changes reboot .


Congratulations! You finally have Arch Linux installed, and it's actually usable now.


How to install Openbox Window Manager

Installing Openbox

  • To have audio, do paru pipewire and select the following packages:

    • extra/pipewire
    • extra/pipewire-alsa
    • extra/pipewire-jack
    • extra/pipewire-pulse
    • extra/wireplumber
    • multilib/lib32-pipewire
    • multilib/lib32-pipewire-jack

    or

    paru -S \
      extra/pipewire \
      extra/pipewire-alsa \
      extra/pipewire-jack \
      extra/pipewire-pulse \
      extra/wireplumber \
      multilib/lib32-pipewire \
      multilib/lib32-pipewire-jack
  • For fonts, run below command

    paru -S noto-fonts{,-{cjk,emoji,extra}} ttf-fira-code
    
  • To install Rust (which we'll need to compile packages from the AUR):

    • Do paru -S rustup.
    • Do rustup default stable.
  • I use a simple TUI greeter. To install it, do paru -S greetd{,-tuigreet}.

    • For the provider of greetd, simply select greetd.
  • Edit /etc/greetd/config.toml:

    • Change the command setting to tuigreet -itrc 'systemd-cat -t xinit xinit -- :1'.
  • Do sudo systemctl enable greetd.

  • For the base of the graphical environment, do paru -S alacritty openbox xorg-{server,xinit}.

    • Get the default configuration files by doing the following commands:

      • cp /etc/X11/xinit/xinitrc ~/.xinitrc.
      • cp /etc/X11/xinit/xserverrc ~/.xserverrc.
    • Edit ~/.xinitrc and replace the last block of commands with exec openbox-session. Remove all last lines from twm & to last line.

      image

    • replace the last block of commands with exec openbox-session

      image

    • Edit ~/.xserverrc so that the contents of the file are the following:

      #!/bin/sh
      exec /usr/bin/X -nolisten tcp -nolisten local "$@" vt$XDG_VTNR

If you want to use openbox with the setup I use => EasyOpenboxWM.

  • Install required dependencies

    pacman -S  xorg xorg-font-util xorg-xrdb xorg-xdm  xorg-server xorg-xinit sxhkd \
    xfce4-settings xfce4-terminal polybar ranger rofi startup-notification thunar   \
    openbox   obconf xarchiver dbus desktop-file-utils elinks gtk2 gtk3 man flameshot \
    zsh git  vim nano curl wget jq xarchiver firefox imagemagick geany alacritty gedit \
    bc bmon calc calcurse feh htop scrot mpc mpd mutt ncmpcpp neofetch  openssl leafpad \
    xmlstarlet xbitmaps ranger  xcompmgr nitrogen brightnessctl alsa-utils imv maim mpv 
  • Clone this repository

    cd ~/
    git clone https://github.com/sumithemmadi/EasyOpenboxWM.git
    cd EasyOpenboxWM
  • Run below command to install open box config files.

    configs=($(ls -A $(pwd)/files))
    for _config in "${configs[@]}"; do
       cp -rf $(pwd)/files/$_config $HOME;
    done
  • And wait for some time untill installation is done.

    Start Openbox Window Manager:

    startx
  • If not working, restart your PC and run again.

    If it shows a black screen then press CTRL + AL + F1 and with your username.

Enabling Tap-to-click

Follow these steps to enable tap-to-click in window manager.

Follow these steps carefully, they require root privileges! ⚠️

Install this package.

sudo pacman -S --needed xf86-input-libinput

Then Edit this file.

sudo nano /etc/X11/xorg.conf.d/30-touchpad.conf

Paste this text into 30-touchpad.conf

Section "InputClass"
  Identifier "touchpad"
  Driver "libinput"
  MatchIsTouchpad "on"
  Option "tapping" "on"
  Option "AccelProfile" "adaptive"
  Option "TappingButtonMap" "lrm"
EndSection

Save the file (Ctrl + S) Quit the editor (Ctrl + X)

Reboot

Tap to click should now be enabled!

Keybindings

Here's some shortcut keys you want to use to speed up your work. For more, Right click on desktop > Keybinds

Keys Action ----- Keys Action
W-1 Go To Desktop 1 S-W-1 Send To Desktop 1
W-2 Go To Desktop 2 S-W-2 Send To Desktop 2
W-3 Go To Desktop 3 S-W-3 Send To Desktop 3
W-4 Go To Desktop 4 S-W-4 Send To Desktop 4
W-5 Go To Desktop 5 S-W-5 Send To Desktop 5
W-S-Left Send To Prev Desktop W-S-Right Send To Next Desktop
A-Tab Next Window (Current Workspace) W-Tab Next Window (All Workspaces)
W-h Move to TopLeft W-j Move to BottomLeft
W-k Move to TopRight W-l Move to BottomRight
W-Left Move To Left Edge W-Right Move To Right Edge
W-Up Maximized W-Down Unmaximized
W-q/c Close Windows A-r/m Toggle Resize/Move
W-Space Openbox Menu W-p/A-F1 App Launcher
W-d Toggle Desktop W-v Set Tasks
W-f File Manager W-e Text Editor
W-t/return Terminal W-w Web Browser
W-x Exit Menu W-m Music Menu
W-b Battery Menu W-n Network Menu
C-A-v Vim C-A-r Ranger
C-A-h Htop C-A-n Nano

References

About

This is a guide for arch linux installation with Openbox Window Managers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published