JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

Programming in Linux. Installing Arch from Scratch II.

Microsoft gives you Windows, Linux gives you the whole house.

Talk is cheap. Show me the code, Linus Torvalds.

PostInstall3a.sh: 1st Post Installation script

# Update the system
sudo pacman -Syu

Reflector is a Python script that can retrieve the latest mirror list from the Arch Linux Mirror Status page. It filters the most up-to-date mirrors from your location, sorts them by speed, and overwrites the file /etc/pacman.d/mirrorlist.

sudo reflector --verbose --country 'Spain' --latest 5 --sort rate --save /etc/pacman.d/mirrorlist

echo "Setting Pacman options."
sudo sed -i '/Color/s/^#//' /etc/pacman.conf # It adds color to the package manager.
sudo sed -i '/Color/a ILoveCandy' /etc/pacman.conf
sudo sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
pacman -Sy powerpill # "Powerpill is a pacman wrapper that uses parallel and segmented downloading to try to speed up downloads for Pacman", Arch Wiki.
sudo sed -i '/Color/s/^#//' /etc/pacman.conf # It adds color to the package manager.
  1. sed –in-place edits text on the file /etc/pacman.conf. The syntax of the s (substitute) command is ‘s/regexp/replacement/flags’.
  2. First, the first pattern is: Color “/Color/”
  3. Next, we are going to do a search and replace “s” and we match the comment with the hash (#) character (second pattern or match) at the beginning of the line: s/^#
  4. And replace it with nothing, in other words, remove it: //’. The end result is that we uncomment the color line in /etc/pacman.conf.
sudo sed -i '/Color/a ILoveCandy' /etc/pacman.conf

In this example, the pattern is: Color “/Color”, but we don’t search and replace text, but append “/a” the line “ILoveCandy” after the line where condition matches. The end result is that we add the line ILoveCandy.

sudo sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf

Let’s explain it:

  1. sed –in-place edits text on the file /etc/pacman.conf. The syntax of the s (substitute) command is ‘s/regexp/replacement/flags’.
  2. First, the two patterns at the beginning are "/[multilib]/,/Include/", i.e., [multilib] and Include.
  3. Then, we can match the comment with the hash (#) character at the beginning of the line: ’s/^#
  4. And replace it with nothing, in other words, remove it: //'

The result is /etc/pacman.conf: […]

[multilib] # Enable multilib in pacman’s config file by uncommenting these two lines in pacman.conf. It is used to run 32-bit applications on a 64-bit system.
Include = /etc/pacman.d/mirrorlist

echo "BASH TOOLS - https://wiki.archlinux.org/index.php/Bash"
sudo pacman -Sy --noconfirm curl bc rsync mlocate bash-completion reflector bash-completion bleachbit gtop neofetch zsh zsh-completions conky variety
sudo pacman -Sy --noconfirm ranger alacritty nautilus cmatrix newsboat bat tmux kitty powerline cowsay calcurse task zsh fish fortune-mod lolcat lsd firefox
sudo pacman -Sy --noconfirm cmatrix bat tmux cowsay calcurse taskd fish fortune-mod lsd stow copyq man-db wget scrot cron clamav copyq pulseaudio pavucontrol libpulse

echo "(UN)COMPRESS TOOLS - https://wiki.archlinux.org"
sudo pacman -Sy --noconfirm tar gzip bzip2 unzip unrar p7zip
echo "SSH - https://wiki.archlinux.org/index.php/Ssh"
sudo pacman -Sy --noconfirm openssh

echo "LibreOffice, Atom, gedit"
sudo pacman -Sy --noconfirm libreoffice-still atom hunspell hunspell-en gedit

echo "Graphics, Multimedia, Messaging, Utilities"
sudo pacman -Sy --noconfirm htop grsync wine wine\_gecko virtualbox-host-modules-arch virtualbox-guest-iso filezilla lollypop vlc barrier espanso-git
sudo pacman -Sy --noconfirm gimp inkscape python2-numpy python-lxml blender mcomix kodi variety keepassxc gnupg pulseaudio pavucontrol libpulse
sudo pacman -Sy --noconfirm gparted rofi a52dec faac faad2 flac jasper lame libdca libdv libmad libmpeg2 libtheora libvorbis libxv wavpack x264 xvidcore barrier

# Installing fonts
sudo yay -S --noconfirm ttf-dejavu ttf-liberation ttf-ubuntu-font-family ttf-droid
sudo pacman -Sy --noconfirm noto-fonts noto-fonts-cjk noto-fonts-emoji ttf-hack ttf-roboto
sudo pacman -Sy --noconfirm ttf-ubuntu-font-family ttf-dejavu ttf-freefont ttf-liberation ttf-droid terminus-font ttf-font-awesome

# Installing Nerd Font
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Hermit.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Hack.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/SourceCodePro.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/OpenDyslexic.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/DejaVuSansMono.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Meslo.zip
unzip Hermit.zip
unzip Hack.zip
unzip DejaVuSansMono.zip
unzip FiraCode.zip
unzip OpenDyslexic.zip
unzip SourceCodePro.zip
unzip Meslo.zip
rm \*.zip

After installing the fonts, fc-cache scans the font directories and builds font information cache files for the system’s applications.

fc-cache -fv

You can configure your terminal to use one of these fonts: Linux Terminal and Administration.

# Theme
sudo pacman -Sy --noconfirm arc-gtk-theme deepin-gtk-theme gtk-engine-murrine papirus-icon-theme

PostInstallb3. Install Yay

# Install Yay, Yet Another Yogurt - An AUR Helper Written in Go
pacman -S --needed git base-devel

# The Arch User Repository (AUR) is a community-driven repository for Arch users. It contains package descriptions (PKGBUILDs) that allow you to compile a package from source with makepkg and then install it via pacman. 
# First, we clone the project and move to the directory.
git clone https://aur.archlinux.org/yay.git
cd yay
# Second, we build the package and install it.
makepkg -si
cd ..
rm -rf yay

# Install Spotify, Dropbox, Chrome, Espanso, etc.
yay -S colorpicker dropbox dropbox-cli google-chrome spotify espanso-git rambox-bin nuclear-player-bin
rambox (rambox-bin) users cannot sign in into their Gmail accounts. There is a fix for that. .

Launch the application and navigate through File, Preferences, Override User-Agent for all services: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Safari/537.36 (www.whatismybrowser.com).

The user-agent is a value passed by a HTTP client (browser) when it makes an HTTP request. It includes information about the client software, such as the name, version, OS, etc.

espanso service register
espanso start

Espanso’s synchronization. Espanso uses files to manage its configuration, so we have already added default.yml to Dropbox (it is called base.yml in older versions).

rm /home/nmaximo7/.config/espanso/match/base.yml
ln -s ~/Dropbox/espanso/default.yml ~/.config/espanso/match/base.yml
espanso start
espanso install all-emojis
# Since version 0.7.0, espanso introduced a few gui-related features that require modulo to be installed in your system.
# It is not strictly required, but it's highly suggested to install it.
git clone https://aur.archlinux.org/modulo.git
cd modulo
makepkg -si
cd ..
rm -rf modulo
espanso restart

PostInstall3ci3.sh: Installing i3

First, you need to install a driver for your graphics card: sudo pacman -S xf86-video-intel (Intel Graphics driver), sudo pacman -S xf86-video-ati (ATI graphics drivers), etc.

How do you know which drivers to install?

[email protected]:~$ lspci -k | grep -A 2 -E “(VGA|3D)”

My output is:
01:00.0 VGA compatible controller: NVIDIA Corporation GM204 [GeForce GTX 970] (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 3160
kernel driver in use: nvidia

echo "Nvidia GPU driver installation"
pacman -S --noconfirm nvidia nvidia-utils nvidia-settings nvidia-dkms

We are going to install: xorg, Xorg is a display server that just works; dmenu, an application launcher; lightdm, a cross-desktop display manager; nautilus, a file manager; audio -pulseaudio and pavucontrol utilities-, etc.

pacman -S xorg-server xorg-apps xorg-xinit xorg-xset xorg-xrandr lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings i3 i3-gaps i3status i3lock
pacman -S i3blocks numlockx dmenu picom nautilus gedit pulseaudio pavucontrol dmenu lxappearance nitrogen archlinux-wallpaper
# Enable lightdm service
systemctl enable lightdm

# Autologin lightdm
sudo groupadd -r autologin
sudo gpasswd -a nmaximo7 autologin
echo "edit /etc/lightdm/lightdm.conf and uncomment the lines under the [Seat:*] section: autologin-guest=false, autologin-user=nmaximo7, and autologin-user-timeout=0"

You may want to read our article Freedom of choice: Window and login managers to learn more about i3.

PostInstall3d.sh: Final touches

First, we are going to add our favorite quotes. The format needs to be as follows: You cannot achieve the impossible without attempting the absurd. %

nvim .zsh_aliases: alias fortune=’fortune ~/.config/myquotes/fortunes'

mkdir myquotes && cd myquotes
wget https://github.com/ruanyf/fortunes/blob/master/data/fortunes
strfile fortunes 

# fzf is a general-purpose command-line fuzzy finder.
git clone --depth 1 [email protected]:junegunn/fzf.git ~/.fzf

Then, we can add these new two aliases .zsh_aliases. Read our article Linux terminal and administration for a full in-depth explanation:

alias preview="fzf --preview 'bat --style=numbers --color=always {}'" 
searchEdit() { du -a ~/Dropbox/ ~/.config/ | awk '{print $2}' | fzf | xargs -r $EDITOR ; }
# Installing Brave
git clone https://aur.archlinux.org/brave-bin.git
cd brave-bin
makepkg -si
cd ..
rm -rf brave-bin

# Wallpapers. 
git clone https://gitlab.com/dwt1/wallpapers.git ~/Pictures/wallpapers

Add the following line in i3’s config file ~/.config/i3/config: exec_always nitrogen –set-zoom-fill –random ~/Pictures/wallpapers

Nitrogen is a fast and lightweight wallpaper manager. The –random argument selects a file from the defined folder and applies this file as a wallpaper using the zoom fill size (–set-zoom-fill) setting.

# Python, [Visual Studio Code](https://code.visualstudio.com/)
sudo pacman -S python python-pip
git clone https://aur.archlinux.org/visual-studio-code-bin.git
cd visual-studio-code-bin
makepkg -si
cd ..
rm -rf visual-studio-code-bin
yay -S consolas-font

# Zsh is a particularly powerful shell. 
sudo pacman -s zsh
# Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# zsh-autosuggestions is a fish-like fast/unobtrusive autosuggestions for zsh.
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH\_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# zsh-syntax-highlighting provides Fish shell-like syntax highlighting for zsh.
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH\_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# Powerlevel10k is a theme for Zsh. It emphasizes speed, flexibility and out-of-the-box experience.
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH\_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
You need to set ZSH_THEME=“powerlevel10k/powerlevel10k” in ~/.zshrc.

Neovim and vim-plug.

Neovim is an hyperextensible Vim-based text editor.

git clone https://aur.archlinux.org/neovim-git.git
cd neovim-git && makepkg -si
cd .. && rm -rf neovim-git
# vim-plug is a minimalistic Vim plugin manager.
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
You need to open Neovim and type :PlugInstall to install all plugins.


Timeshift is an application similar to the Time Machine tool in Mac OS. It protects your system by taking incremental snapshots of the file system at regular intervals. Read our article Internet Safety for a full in-depth explanation.

git clone https://aur.archlinux.org/timeshift.git
cd timeshift && makepkg -si
cd .. && rm -rf timeshift


ClamAV is an open-source antivirus engine for detecting trojans, viruses, malware & other malicious threats.

# First, we need to install the clamav package.
sudo pacman -Sy clamav
# Update the virus definition
sudo freshclam
# Get the latest definitions at boot so that our virus definitions are kept recent.
sudo systemctl enable --now clamav-freshclam.service
# Start the daemon.
sudo systemctl enable --now clamav-daemon.service
# Test ClamAV. The output must contain: stdin: Win.Test.EICAR\_HDB-1 FOUND
curl https://secure.eicar.org/eicar.com.txt | clamscan -
# Install more signatures (databases) from other repositories
yay -S clamav-unofficial-sigs
# Enable the clamav-unofficial-sigs. It will regularly update the unofficial signatures.
sudo clamav-unofficial-sigs.sh --install-all
# Scan for viruses. Check our post-install scripts.
clamscan --recursive --remove ~


Firewalld is a firewall that uses nftables by default.

# Install necessary packages
sudo pacman -s firewalld ipset ebtables
# Enable and start firewalld.service.
sudo systemctl enable --now firewalld.service
# Change the default zone to home.
sudo firewall-cmd --set-default-zone=home
# Open ftp and htpp services: --permanent because changes made in Runtime configuration are lost when the firewalld service is restarted.
sudo firewall-cmd --add-service=ftp --permanent
sudo firewall-cmd --add-service=http --permanent
# Allow traffic on an incoming port (24800) -Barrier-
sudo firewall-cmd --add-port=24800/tcp --permanent
# Open samba service
sudo firewall-cmd --permanent --add-service={samba,samba-client,samba-dc}
# Restart the firewall.
sudo firewall-cmd --reload
# List allowed service and ports on the system
sudo firewall-cmd --list-service

# bpytop is a resource monitor that shows usage and stats for processor, memory, disks, network and processes.
cd && git clone https://aur.archlinux.org/bpytop.git
cd bpytop && makepkg -si
cd .. && rm -rf bpytop

PostInstallRepo.sh: restoring our dotfiles.

# Git. First-Time git setup. Set your username and email address:
git config --global user.name "myName"
git config --global user.email [email protected]

# Configure SSH on an Arch Linux
sudo pacman -Sy openssh gnupg

Let’s Generate two SSH (ed25519 and an RSA) key-pairs:

ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "[email protected]"
ssh-keygen -t rsa -b 4096 -C "[email protected]"

The ssh-agent is a helper program that keeps track of your keys and their passphrases. Let’s add the newly generated Ed25519 key to the SSH Agent.

First, we need to make sure that the SSH agent is running by executing: eval “$(ssh-agent -s)” Next, let’s add our SSH private key to the ssh-agent:

ssh-add ~/.ssh/id_ed25519
echo "Copy the public key to your GitHub account:"
cat ~/.ssh/id_ed25519.pub

# Let's allow authentication to our computer using any of our keys by adding our public keys to the list of allowed keys ~/.ssh/authorized_keys:
cat ~/.ssh/id_ed25519.pub > ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

# Let's migrate our dotfiles in github.com to the new computer. 
# First, we need to clone your repository.
git clone https://github.com/nmaximo7/dotfiles.git

You need a token and enter it instead of your password when performing Git operations over HTTPS. There is a cool mechanism in Git to avoid having to type your password over and over again: git config ‐‐global credential.helper store

Let’s stow the files and directories into the target directory. First, check that it is working as expected: stow ‐‐adopt -nvSt ~ *, then do it: stow ‐‐adopt -vSt ~ *

You may want to read our article Advanced: Servers, Terminals, and Scripts, Manage and sync dotfiles with Git + GNU Stow.

Final post-install script

Let’s install bat and some Appimages: Ferdi, VLC, and Stacer. They are self-contained apps that can simply be downloaded and run on any Linux distribution. Be aware that update is not always an option.

sudo pacman -Syu fuse2 bat 
# AppImage requires fuse to mount the embedded sqashfs filesystem.

mkdir -p ~/AppImages
cd ~/AppImages
# Ferdi, All your apps in one place. Find your Appimages in AppImageHub, https://appimage.github.io/apps/
wget ...Ferdi.AppImage
# VLC is a free and open-source cross-platform multimedia player (pacman -S vlc).
wget ...VLC.AppImage 
# Stacer is an open-source application to monitor and optimize the entire Linux system with different aspects.
wget ...Stacer.AppImage, 
# To be able to execute a .appimage file, it has to be set as an executable:
chmod a+x *

# bat is a cat clone with wings. nvim ~/zsh\_aliases: alias cat='bat'
ln -s /usr/bin/batcat ~/.local/bin/bat
Replace cat with bat, nvim .zsh_aliases: alias cat=‘bat ‐‐style=plain’
Bitcoin donation

JustToThePoint Copyright © 2011 - 2022 PhD. Máximo Núñez Alarcón, Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.