This is a simple setup script that helps with installing applications, dotfiles and a Neovim configuration to a fresh Arch-Linux machine in order to replicate a productive development environment based on i3wm, tmux and other minimalistic terminal apps.
Important
Please note that this is my personal setup script for my work machine. It helps to quickly replicate my development environment for my day job. Since your needs might differ, simply feel free to fork this repository and make it fully yours.
The installation process can be divided into three main steps.
This setup assumes that a bootable USB drive with the Arch ISO was already created. Arch-Linux will be installed using the archinstall command. A working internet connection is required during installation and can be established using an iPhone hotspot via USB.
During the installation process choose the following configuration:
- Bootloader: Systemd Boot
- Environment:
i3wmwith thelightdm-slick-greeter. - Network configuration: NetworkManager (default backend)
- Additional packages:
- base-devel
- bash
- broadcom-wl (for macs)
- curl
- firefox
- git
- vim (just in case)
When the installation has finished, remove th USB drive and boot into the fresh installation.
After running archinstall successfully and booting the first time into the fresh installation, the following steps are required in order to set up a readable terminal and connect to WiFi.
-
Open the default
xtermterminal withalt+enter. Optionally start a new terminal window from there with a larger font size usingxterm -fa 'Monospace' -fs 24 &
-
Start the NetworkManager:
sudo systemctl start NetworkManager
-
Connect to a WiFi:
nmcli device wifi list nmcli device wifi connect [SSID] password [PASSWORD]
Now, install all packages, dotfiles and Neovim configuration.
Note
Neovim is installed from the GitHub release page using a pinned version. The version can be configured using the NVIM_VERSION variable in setup.sh.
-
Download and run the setup script:
curl -OL https://raw.githubusercontent.com/marcantondahmen/arch-setup/master/setup.sh bash setup.sh
-
Open Neovim and run
PackerSync. It is possible that Neovim has to be restarted multiple time in order to complete the setup. -
Reboot the machine.
Note
Pacman logs can be found in ~/.arch-setup-logs.
This script can be also used to update all packages.
bash setup.shNote
Note that the kernel is excluded from system updates. In order to run a full update including kernel updates, run:
sudo pacman -Syu
cd ~/.yay/yay
git pull
makepkg -si
yay -SyuYou can confirm the latest kernel version by running after a reboot:
uname -rIn order to chroot into a broken installation with an encrypted drive (LVM on LUKS) follow the steps below. This guide assumes that the root partition is on /dev/sda2 while the boot partition is on /dev/sda1.
-
Open container:
cryptsetup open /dev/sda2 cryptroot
-
Activate LVM volume:
vgscan vgchange -ay
-
Mount volumes (mkdir mountpoints if needed):
mount -t btrfs -o subvol=@ /dev/mapper/[VGNAME-root] /mnt mount -t btrfs -o subvol=@home /dev/mapper/[VGNAME-root] /mnt/home mount -t btrfs -o subvol=@log /dev/mapper/[VGNAME-root] /mnt/log mount -t btrfs -o subvol=@pkg /dev/mapper/[VGNAME-root] /mnt/pkg mount /sda1 /mnt/boot
-
Chroot into system
arch-chroot /mnt
-
Do whatever is required to fix the installation like:
pacman -Syu pacman -S linux bootctl update mkinitcpio -P
-
In order to exit the session run:
exit umount -R /mnt reboot
It is recommended to also install the linux-lts kernel as fallback. The LTS kernel can be added as follows:
-
Install the following packages:
sudo pacman -S linux-headers linux-lts linux-lts-headers dkms
Also install the DKMS wifi driver in case you use an older Macbook:
sudo pacman -S broadcom-wl-dkms
Confirm replacing the driver when being asked.
-
Create a bootloader entry:
cd /boot/loader/entries/ sudo cp [date]_linux.conf [date]_linux-lts.conf sudo vim [date]_linux-lts.confThen edit the
title,linuxandinitrdvalues.title Arch Linux LTS (linux-lts) linux /vmlinuz-linux-lts initrd /initramfs-linux-lts.img options ...
-
Optionally set the default kernel in the boot menu in
/boot/loader/loader.conf:default [date]_linux-lts.conf
-
Reboot and verify using
uname -r.
The following steps are optional and might also depend on the machine Arch-Linux is running on.
This setup ships with a fully configured SSH Agent that also stores passphrases of keys in the gnome-keyring.
This setup ships with the GitHub CLI. It can be used to authenticate your machine to GitHub running:
gh auth loginIn order to get Astrill running, follow these steps:
-
Install GTK2 using
yay -S gtk2. -
Go to astrill.com and download the CLI installer.
-
Make the downloaded file executable and then run it.
cd ~/Downloads chmod + x astrill-setup-linux64.sh && ./astrill-setup-linux64.sh
-
Fix GTK errors with:
echo 'gtk-theme-name = "Raleigh"' > ~/.gtkrc-2.0
-
Createl a symlink with:
sudo ln -s /usr/local/Astrill/astrill /usr/local/bin/astrill
-
Run
astrillto start the app.
You can easily store and switch between multiple display profiles with autorandr. Monitor configuration can be changed using xrandr.
In order to save the currently used setup, run:
autorandr --save somenameYou can run the following command to automatically load the current setup:
autorandr --changeSetting up a dual-monitor configuration where a laptop has sometimes a secondary screen attached can be realized as follows:
-
First, only the laptop: Disconnect all other screens and run
xrandrto configure the built-in screen. For example:xrandr --output eDP-1 --auto --scale 0.675
-
Save the mobile config as follows:
autorandr --save mobile
-
Reboot, just in case.
-
Attach the secondary screen configure both displays using
xrandras follows:xrandr --output eDP-1 --auto --scale 0.675 xrandr --output DP-2 --auto --scale 1 --right-of eDP-1 --primary
In case there is an error showing up when running the commands above, the actual framebuffer might be too small. This can happen when connecting an external monitor using a DisplayPort cable. In such a case, the framebuffer has to be set using the
--fbargument:xrandr --fb 4816x1504 \ --output eDP-1 --mode 2256x1504 --pos 0x0 \ --output DP-2-6-6 --mode 2560x1440 --pos 2256x0 --primary
Note that in this step the Laptop screen is configured as well!
-
Save the home office configuration:
autorandr --save home
Now changes of the connected monitors should be detected correctly.
On a high-dpi laptop, the font size will be quite small when entering the passphrase for encrypted drives. Follow these steps in order to use another font:
-
Edit
/etc/vconsole.confand add or change:FONT=ter-v32n
-
Rebuild the initramfs:
sudo mkinitcpio -P
-
Reboot
It also might be needed to set a correct size for the cursor. The cursor size can be defined by adding the following line to ~/.Xresources:
Xcursor.size: 10Then load the .Xresources in your ~/.xprofile:
xrdb -merge ~/.XresourcesThe bluetooth utility bluetoothctl is included in this setup. You can follow this guide in order to pair your devices.
You can use Rclone in order to connect and mount a Google Drive. It is also pre-installed in this setup.
-
Configure Rclone:
rclone config
Note that you can authenticate using the browser and therefore all keys and token fields can be left empty.
-
Mount the drive:
mkdir -p ~/gdrive rclone mount gdrive: ~/gdrive
-
Automatically mount on boot:
(crontab -l 2>/dev/null; echo "@reboot rclone mount --daemon gdrive: $HOME/gdrive") | crontab -
Some laptops require some work in order to get them running properly. For example it might be required to use a specific patched kernel that matches your machine or modify the boot loader options.
In case you are using a surface laptop, the best is to install a kernel from the linux-surface project. This will most likely help to make things like sleep, shutdown and other issues work.
Also it could be that a lot of ACPI errors show up on shutdown and in journalctl. In such case adding the acpi_osi and pci kernel parameters to the boot loader options might fix those issues. For example if a Surface Laptop 5 is also running Windows 10 in parallel, the additional parameters would be acpi_osi='Windows 2020' pci=hpiosize=0.
Generally, using thermald can help to keep your quite and cool. Since this step is entirely optional, the default setup doesn't include thermald out of the box. Follow these steps to install and configure the thermald service.
-
Install
thermald:sudo pacman -S thermald
-
Add a configuration file (
thermal-conf.xml) to the/etc/thermald/directory. You find macthing configurations on the internet. One that can be used for Surface Laptops can be found here. -
Enable service:
sudo systemclt enable thermald.service sudo systemclt start thermald.service
© 2024-2026 Marc Anton Dahmen, MIT license
