loading...

How i install Arch Linux on my dev machine

nflamel profile image Fran C. ・4 min read

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

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

check you have ping to ping archlinux.org

3. Sync time

timedatectl set-ntp true

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, /

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

5. Bootstrap the system

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

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

Setup hosts nvim /etc/hosts

127.0.0.1   localhost
::1     localhost
127.0.1.1   my-hostname
passwd

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

Or refind

pacman -S refind
refind-install

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"

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

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

10. Create my new user

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

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

Enable lightdm

sudo systemctl enable lightdm

Done!

Enjoy!

Posted on May 20 by:

nflamel profile

Fran C.

@nflamel

I break code for a living... wait no, I fix it, most of the times. Well, sometimes.Yeah, I break code for a living.

Discussion

markdown guide