Skip to content

Instantly share code, notes, and snippets.

@ccarrasc
Last active April 19, 2023 11:07
Show Gist options
  • Save ccarrasc/6f007f4f9a63bb69ef194ad1cd746985 to your computer and use it in GitHub Desktop.
Save ccarrasc/6f007f4f9a63bb69ef194ad1cd746985 to your computer and use it in GitHub Desktop.
archlinux installation and configuration notes

Misc notes on things I've done for my build with archlinux:

Download

https://wiki.archlinux.org/index.php/Category:Getting_and_installing_Arch

Download iso and signature: https://mirrors.kernel.org/archlinux/iso/2018.02.01/

From macOS:

$ gpg --keyserver wwwkeys.pgp.net --recv-keys 4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC
gpg: key 7F2D434B9741E8AC: 28 signatures not checked due to missing keys
gpg: key 7F2D434B9741E8AC: public key "Pierre Schmitz <pierre@archlinux.de>" imported
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2019-06-12
gpg: Total number processed: 1
gpg:               imported: 1
$ gpg --keyserver-options auto-key-retrieve --verify archlinux-2018.02.01-x86_64.iso.sig
gpg: assuming signed data in 'archlinux-2018.02.01-x86_64.iso'
gpg: Signature made Thu Feb  1 12:59:30 2018 EST
gpg:                using RSA key 4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC
gpg: Good signature from "Pierre Schmitz <pierre@archlinux.de>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 4AA4 767B BC9C 4B1D 18AE  28B7 7F2D 434B 9741 E8AC

https://pierre-schmitz.com/about/gpg-keys/pierre-packager-key/

https://www.archlinux.org/people/developers/

Boot media

https://wiki.archlinux.org/index.php/USB_flash_installation_media#In_macOS

From macOS:

$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         500.1 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.1 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            340.3 GB   disk1s1
   2:                APFS Volume Preboot                 22.8 MB    disk1s2
   3:                APFS Volume Recovery                509.8 MB   disk1s3
   4:                APFS Volume VM                      3.2 GB     disk1s4

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *1.0 GB     disk2
   1:                 DOS_FAT_32 ARCHLINUX               1.0 GB     disk2s1

$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
$ sudo dd if=~/Downloads/arch/archlinux-2018.02.01-x86_64.iso of=/dev/rdisk2 bs=1m
539+0 records in
539+0 records out
565182464 bytes transferred in 193.070781 secs (2927333 bytes/sec)

Install

  1. Insert USB with iso
  2. Power on
  3. Enter boot menu (F11)
  4. Select UEFI boot from flash (UEFI: Generic Flash Disk 8.07)

Check if UEFI

$ ls /sys/firmware/efi/efivars

Check network

$ ping archlinux.org

Set time

$ timedatectl set-ntp true
$ timedatectl list-timezones
$ timedatectl set-timezone America/New_York
$ timedatectl status

GPT Partitioning

$ fdisk -l
$ gdisk /dev/nvme0n1

# /boot
Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-488397134, default = 2048) or {+-}size{KMGTP}: 2048
Last sector (2048-488397134, default = 488397134) or {+-}size{KMGTP}: +550M
Hex code or GUID (L to show codes, Enter = 8300): ef00

# /
Command (? for help): n
Partition number (1-128, default 2):
First sector (34-488397134, default = 1128448) or {+-}size{KMGTP}:
Last sector (1128448-488397134, default = 488397134) or {+-}size{KMGTP}: +32G
Hex code or GUID (L to show codes, Enter = 8300): 8304

# /home
Command (? for help): n
Partition number (1-128, default 3):
First sector (34-488397134, default = 68237312) or {+-}size{KMGTP}:
Last sector (68237312-488397134, default = 488397134) or {+-}size{KMGTP}:
Hex code or GUID (L to show codes, Enter = 8300): 8302

Command (? for help): p
Number  Start (sector)  End (sector)    Size        Code    Name
1               2048       1128447     550.0 MiB    EF00    EFI System
2            1128448      68237311     32.0 GiB     8304    Linux x86-64 root (/)
3           68237312     488397134     200.3 GiB    8302    Linux /home

Command (? for help): v

No problems found. 2014 free sectors (1007.0 Kib) available in 1
segments, the largest of which is 2014 (1007.0 KiB) in size.

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/nvme0n1.
The operation has completed successfully.

# List disks and new partitions
$ fdisk -l

# Format the EFI System Partition as FAT32
$ mkfs.fat -F32 /dev/nvme0n1p1
$ mkfs.ext4 /dev/nvme0n1p2
$ mkfs.ext4 /dev/nvme0n1p3

# Mount the file systems
$ mount /dev/nvme0n1p2 /mnt
$ mkdir /mnt/boot
$ mount /dev/nvme0n1p1 /mnt/boot
$ mkdir /mnt/home
$ mount /dev/nvme0n1p3 /mnt/home

$ pacstrap /mnt base

$ genfstab -U /mnt >> /mnt/etc/fstab
$ cat /mnt/etc/fstab

$ arch-chroot /mnt

$ bootctl --path=/boot install
$ vi /boot/loader/loader.conf
# Edit to contain the following:
default arch
timeout 5
editor 0

$ cp /usr/share/systemd/bootctl/arch.conf /boot/loader/entries/
# Get the partition uuid for /
$ blkid -s PARTUUID -o value /dev/nvme0n1p2

$ vi /boot/loader/entries/arch.conf
# Edit to contain the following:
title   Arch Linux
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
options root=PARTUUID=ccd6b018-0cc3-4488-a061-ba8631e5329b rootfstype=ext4 add_efi_memmap

$ ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
$ hwclock --systohc

$ vi /etc/locale.gen
# Uncomment en_US.UTF-8 UTF-8
$ locale-gen

$ vi /etc/locale.conf
LANG=en_US.UTF-8

# Create /etc/hostname with hostname in it
$ vi /etc/hostname
arch0

# Add default entires to /etc/hosts
127.0.0.1   localhost
::1         localhost

$ passwd

$ exit
$ umount -R /mnt
$ reboot

Enable dhcpcd at boot

$ systemctl enable --now dhcpcd.service

Check if wireless driver is loaded (in use)

$ lspci -k | grep -i wifi
# If not, find and install firmware

Install wireless packages

$ pacman -S iw wpa_supplicant dialog

Install Weston (Wayland) display server

$ pacman -S weston
  • AMD/ATI driver already installed (mesa was installed with weston)

Install GNOME desktop environment

$ pacman -S gnome

Enable GDM

$ systemctl enable --now gdm.service
  • I didn't realize gnome came with things I don't care to have
$ pacman -Rsc evolution evolution-data-server epiphany gnome-software

Add my user and set password

$ useradd -m -s /bin/bash cesar
$ passwd cesar

Install sudo and add myself to the sudoers fils

$ pacman -S sudo
$ visudo

Login as user and install some apps

$ sudo pacman -Syu vim firefox git openssh tmux tmux-bash-completion nodejs npm yarn jdk8-openjdk clang cmake gdb postgresql bash-completion
$ sudo pacman -S remmina libvncserver

Change gnome config

#$ vim .config/gtk-3.0/settings.ini
[Settings]
gtk-application-prefer-dark-theme = true

Enable AUR

$ sudo pacman -S --needed base-devel

Install VSCode

$ mkdir aur
$ git clone https://aur.archlinux.org/visual-studio-code-bin.git
$ cd visual-studio-code-bin
$ makepkg -si
# Increase default inotify watchers
$ echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system
$ sudo tar xf ideaIC-2017.3.5-no-jdk.tar.gz -C /opt/
$ cd /opt/idea-IC-173.4674.33/bin
$ ./idea.sh
  • Verify the desktop config in ~/.local/share/applications/jetbrains-idea-ce.desktop

Configure usb keyboard

$ sudo pacman -S evtest
$ sudo evtest

Install NetworkManager so it can be accessed in GNOME

$ sudo pacman -S networkmanager
$ sudo systemctl enable --now NetworkManager.service

Grab tweak tool

$ sudo pacman -S gnome-tweak-tool
$ sudo unzip android-studio-ide-171.4443003-linux.zip -d /opt/
# Enable multilib by uncommenting the multilib and it's Include in pacman.conf
$ sudo vim /etc/pacman.conf
$ sudo pacman -S lib32-gcc-libs gperf wxgtk2 squashfs-tools schedtool perl-switch zip python2-virtualenv bc rsync lib32-zlib lib32-ncurses lib32-readline
$ cd ~/aur
$ gpg --recv-keys 702353E0F7E48EDB
$ git clone https://aur.archlinux.org/ncurses5-compat-libs.git
$ cd ncurses5-compat-libs
$ makepkg -si

$ cd ..
$ git clone git clone https://aur.archlinux.org/lib32-ncurses5-compat-libs.git
$ cd lib32-ncurses5-compat-libs
$ makepkg -si

Add a desktop entry Android Studio

#vim ~/.local/share/applications/android-studio.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Icon=/opt/android-studio/bin/studio.png
Exec="/opt/android-studio/bin/studio.sh" %f
Categories=Development;IDE;
Terminal=false

Init postgres

$ sudo -u postgres -i
$ initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
$ exit

# Start postgres
$ sudo systemctl start postgresql.service

# Create users and dbs foo and foo-test
$ sudo -u postgres -i
$ createuser test --interactive
$ createdb -O test foo-test
$ createuser dev --interactive
$ createdb -O dev foo

# Connect via shell
$ sudo -u postgres -i
$ psql
# or
$ psql -d foo dev

Set initial git global config

$ git config --global user.name "Cesar"
$ git config --global user.email cesar@machinemode.com
$ git config --global core.editor vim

# Gen ssh key
$ ssh-keygen
$ sudo tar xf Postman-linux-x64-6.0.10.tar.gz -C /opt/

Add a desktop entry

#$ vim ~/.local/share/applications/postman.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Postman
Icon=/opt/Postman/resources/app/assets/icon.png
Exec=/opt/Postman/Postman
Categories=Development;
Terminal=false

Install hipchat

$ cd aur
$ git clone https://aur.archlinux.org/hipchat.git
$ cd hipchat
$ makepkg -si

Install fzf

$ sudo pacman -S fzf
# Source the following in .bashrc or .bash_profile
$ source /usr/share/fzf/completion.bash
$ source /usr/share/fzf/completion.bash

Install vlc

$ sudo pacman -S vlc

Install skype

$ cd aur
$ git clone https://aur.archlinux.org/skypeforlinux-stable-bin.git
$ cd skypeforlinux-stable-bin
$ makepkg -si

Similar setup as before, except this time I had to mount another disk on /data after formatting the main disk.

Installed zsh

pacman -S zsh zsh-completions
zsh

Add my user, install sudo, and add me as a sudoer

useradd -m -s /bin/zsh cesar
passwd cesar
pacman -S sudo
visudo

Added cesar ALL=(ALL) ALL

Switched to my user to kick off zsh-newuser-install via su cesar

Install xfce

sudo pacman -S xorg xfce4 xfce4-goodies
cp /etc/X11/xinit/xinitrc ~/.xinitrc
# Replace the exec's at the end with: exec startxfce4" >> ~/.xinitrc

Create a ~/.zprofile and tell it to start x:

if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
  exec startx
fi

Install stuff:

sudo pacman -S vim ttf-droid ttf-dejavu chromium firefox git openssh nodejs npm yarn jdk-openjdk clang cmake gdb
@ccarrasc
Copy link
Author

ccarrasc commented Apr 18, 2023

https://wiki.archlinux.org/title/Ryzen

I am having issues with random freezes. Hoping the change to set the max cstate to 5 and update microcode helps. Here is my systemd-boot config after installing amd-ucode:

title   Arch Linux
linux   /vmlinuz-linux
initrd  /amd-ucode.img
initrd  /initramfs-linux.img
options root=PARTUUID=5cd6b0a7-9164-41fc-b66e-0f07a6b4d912 rootfstype=ext4 processor.max_cstate=5 add_efi_memmap

@ccarrasc
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment