DEV Community

Fran C.
Fran C.

Posted on

How i install Arch Linux on my dev machine

I use ArchLinux on my 2 dev machines. One is an old Alienware M17xR4 that somehow is still alive and that I can only use plugged in (or on battery for like 20 minutes) and a powerful desktop machine that I share with Windows for playing videogames.

The reasons why I use Linux for development are basically because I enjoy it. I've never used Windows for development so I don't know if I would enjoy it and I've used Mac... and I just don't like it. I feel MacOS gets in my way all the time and doesn't always allow me to do what I want to do.

The reason why I use Arch? ... I don't know and I honestly ask myself this question every time I need to reinstall the system. But whenever I try something else I end up coming back to my Arch setup. It is just customized the way I like it.

Installing Arch isn't easy or straightforward, you normally need to know what you're doing and last time I tried it took me around 3 hours because I'm dummy and lazy and I still don't understand EFI or how to make Grub work with it (spoiler: I used refind).

In order to avoid this pain again I've decided to write this down so that I don't need to go through the same again 🤷

Most of it is just copied from the awesome Arch installation guide, with just a pinch of what I want and explaining the same steps just for myself (if you want to install Arch please go and use the installation guide instead of this!)

https://wiki.archlinux.org/index.php/Installation_guide

1. Bootstrap from the live USB

2. Get internet

If wifi just works

wifi-menu
Enter fullscreen mode Exit fullscreen mode

If not, make sure your Ethernet cable or mobile tethering is connected. Arch will enable DHCP for the Ethernet devices it finds them (that includes USB tethering) while it boots. You only need to:

systemctl restart dhcpcd@enps0swhatever
Enter fullscreen mode Exit fullscreen mode

check you have ping to ping archlinux.org

3. Sync time

timedatectl set-ntp true
Enter fullscreen mode Exit fullscreen mode

4. Partition

Use cfdisk. Important, make sure /var is not on the SSD. There's probably no reason for that on modern SSDs? I don't know, it just scares me.

Laptop

I use these partitions. /dev/sda is the normal HDD and /dev/sdb is the 32GB SSD.

/dev/sda1, 1G, /boot/efi
/dev/sda2, 1G, /boot
/dev/sda3, 100G, /var
/dev/sda4, all, /home

/dev/sdb1, all, /
Enter fullscreen mode Exit fullscreen mode

Desktop partition schema

  • /dev/sda is the Windows installation disk on SSD
  • /dev/sdb is the Windows storage HDD
  • /dev/sdc is the Linux SSD
  • /dev/sdd is the Linux storage HDD

EFI exists already from the Windows partition, don't format it, just mount it.

/dev/sda2, /boot/efi
/dev/sdc1, all,  /
/dev/sdd1, 300G, /var
/dev/sdd2, all, /media/store
/dev/sda4, exists, /media/windows
/dev/sdb2, exists, media/store_win
Enter fullscreen mode Exit fullscreen mode

5. Bootstrap the system

pacstrap /mnt base linux linux-firmware neovim vi zsh networkmanager sudo
genfstab -U /mnt >> /mnt/etc/fstab
Enter fullscreen mode Exit fullscreen mode

On desktop remember to add linux-headers base-devel broadcom-wl-dkms to the list of pacstrap packages. Because I have a broadcom wireless card and otherwise I don't have wifi on my first boot (and it is a pain to configure it later!)

6. Chroot

arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
hwclock --systohc
nvim /etc/locale.gen # uncomment en_US.UTF-8 and es_ES.UTF-8
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "my-hostname" > /etc/hostname
Enter fullscreen mode Exit fullscreen mode

Setup hosts nvim /etc/hosts

127.0.0.1   localhost
::1     localhost
127.0.1.1   my-hostname
Enter fullscreen mode Exit fullscreen mode
passwd
Enter fullscreen mode Exit fullscreen mode

7. Boot manager

I tipically install grub, but last time I wasn't able to do it and ended up installing refind.

Install grub

This just worked on the laptop 🤷

pacman -S grub efibootmgr
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
grub-mkconfig -o /boot/grub/grub.cfg
Enter fullscreen mode Exit fullscreen mode

Or refind

pacman -S refind
refind-install
Enter fullscreen mode Exit fullscreen mode

Edit /boot/refind_linux.conf and make sure it has a line that refers to the / partition

    "Boot using default options"   "root=PARTUUID=978e3e81-8048-4ae1-8a06-aa727458e8ff rw quiet splash"
Enter fullscreen mode Exit fullscreen mode

PARTUUID can be found with blkid

Sometimes I add this theme https://github.com/bobafetthotmail/refind-theme-regular

8. Restart!

Exit from chroot

umount -R /mnt
reboot
Enter fullscreen mode Exit fullscreen mode

9. Connect wifi

systemctl enable NetworkManager
systemctl restart NetworkManager
nmcli device wifi rescan
nmcli device wifi list
nmcli device wifi connect SSID-Name password wireless-password
Enter fullscreen mode Exit fullscreen mode

10. Create my new user

visudo # to enable sudo to members of wheel group
userad -m -G wheel -s /bin/zsh username
passwd username
Enter fullscreen mode Exit fullscreen mode

Then exit and login with this new user

11. Bootstrap the new system

If you're here and you're not me, ⚠️stop⚠️. This is how to install my own personal dot-files and you don't want them, believe me.

sudo pacman -S python python-pip python-neovim git base-devel
git clone https://github.com/franciscoj/dot-files ~/Documents/src/dot-files
cd ~/Documents/src/dot-files
./boostrap/linux.sh
sudo DIFFPROG="nvim -d" pacdiff
sudo pip install dotbot
dotbot -c install.conf.yaml
Enter fullscreen mode Exit fullscreen mode

Enable lightdm

sudo systemctl enable lightdm
Enter fullscreen mode Exit fullscreen mode

Done!

Enjoy!

Top comments (0)