Arch Linux Post Install Steps
This is part two of the Arch Linux installation series. Part 1 describes the base installation on UEFI systems. The third part deals with getting the graphical environment running.
Customization is at the heart of Arch Linux. There's more then one way to do almost anything, more then one package for the job and no one configuration is the right way to do it. Everything I share in this article is my way of doing things. Be inspired by my choices and improve upon them to fit your own needs.
Tools and toys
Arch Linux comes with a minimal package selection. Everything else, even vim
, needs to be specifically added by the user. Unsurprisingly, this is my first step after every successful core installation. I've split the command into two. One with highly recommended packages most people will fine useful. The second command is flavored by my own preferences.
# Make sure you're up to date
pacman -Syu
# Highly recommended
pacman -S sudo unzip unrar wget curl parted xfsprogs jfsutils ntfs-3g exfat-utils openbsd-netcat htop lsof squashfs-tools tree cryfs encfs vim ethtool man
# Flavored by my own preferences
pacman -S emacs-nox mlocate tmux mc git pwgen links lftp sshfs nmap hping subversion tcpdump hexedit yarn mutt sshfs aria2 aspell-en aspell-de aspell-fr ranger zsh git-crypt
Optional: Set your default editor:
# For vim users
echo EDITOR=vim >> /etc/environment
# For emacs users
echo EDITOR=emacs >> /etc/environment
Use page keys for bash history
By default Arch Linux uses the page-up and page-down keys to jump to the beginning or end of the bash history. Not sure what good that would ever do. I find these keys much more useful to search back and forth in your bash history.
For example, if I enter emacs
and then use page-up I expect to see all my commands beginning with emacs
, like emacs /etc/fstab
.
The following snipped enables this behavior:
sed -i 's/\"\\e\[5\~\": beginning-of-history/\"\\e\[5\~\": history-search-backward/g' /etc/inputrc
sed -i 's/\"\\e\[6\~\": end-of-history/\"\\e\[6\~\": history-search-forward/g' /etc/inputrc
Defining admin user with sudo
This optional step gives your regular user root access with or without the root password when using sudo
.
Example requiring user password:
echo "myuser ALL=(ALL)" > /etc/sudoers.d/myuser
chmod 440 /etc/sudoers.d/myuser
Example requiring no password (less secure):
echo "myuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/myuser
chmod 440 /etc/sudoers.d/myuser
Enable SSH Agent for your user
Important: This step is executed by the user, not root.
Enabling the SSH user for your user removes the need to enter your SSH key passwords every time you use them. Instead use them once and the Agent keeps the key active after that.
The following steps make sure that the agent starts through a systemd user service.
mkdir -p ~/.config/systemd/user
echo -e "[Unit]
Description=SSH key agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a \$SSH_AUTH_SOCK
[Install]
WantedBy=default.target" > ~/.config/systemd/user/ssh-agent.service
echo "SSH_AUTH_SOCK DEFAULT=\"${XDG_RUNTIME_DIR}/ssh-agent.socket\"" >> ~/.pam_environment
systemctl --user daemon-reload
systemctl --user start ssh-agent.service
systemctl --user enable ssh-agent.service
Install yay
package manager
Arch Linux has two package repositories. The official one used by pacman
and the Arch user repository (AUR). The latter isn't included into pacman
.
The official repositories contain a huge collection of packages. Access to the AUR isn't a requirement to use Arch Linux. However I often use software less mainstream. Installing it through the AUR instead of manually I save time and the package becomes part of the rolling updates whenever the become available.
yay
works just like pacman
with the exception that it gives you access to AUR packages. It resolves dependencies and keeps track of the packages. Using the AUR manually these points can become time consuming tasks.
Installing yay
is easy. Run:
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd /tmp/yay
makepkg -si
cd /tmp
rm -rf /tmp/yay
Run yay
as regular user. Running it as root
isn't recommended and won't work.
Be aware that yay
doesn't just use AUR repositories. It pulls from all repositories alike. Once you use yay
you'll likely not use pacman
again.
Check out the yay repository to learn more about it.