Skip to content

Instantly share code, notes, and snippets.

@rstacruz
Created October 22, 2018 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rstacruz/821509d2419f16c548ff44b7f2b2ad20 to your computer and use it in GitHub Desktop.
Save rstacruz/821509d2419f16c548ff44b7f2b2ad20 to your computer and use it in GitHub Desktop.

Installing Arch Linux

This is not a replacement for the Arch Wiki Installation Guide! Consider this a refresher course.

First steps

Change keyboard layout

(Optional) If you're using different keyboard layout, change it now using loadkeys.

# Changes keyboard layout
loadkeys dvorak

# also available:
#   colemak
#   mac-dvorak / mac-us / mac-uk

Tip: See ls /usr/share/kbd/keymaps/**/*.map.gz for additional layouts.

Check if you're in UEFI mode

Check if this path exists:

# See if this path exists
ls /sys/firmware/efi/efivars

If it is, you're using UEFI mode. If not, you're using Legacy mode. This will be important later.

Go online

See if you're online

You may already be online if you're using wired ethernet. Once you're online, skip this section!

ping 8.8.8.8

Connect to the Internet

  • via Android tethering

    If you have an Android phone, this is the easiest way to go online. Connect your phone to your computer, then SettingsTethering & Mobile HotspotUSB Tethering (it's disabled unless your phone is connected). Then connect to it:

    # Find interface names:
    ls /sys/class/net
    
    # Enable it:
    dhcpcd enp0s26f7u3u3
    #      ^^^^^^^^^^^^^ replace this with the actual interface name

    See: Android tethering (wiki.archlinux.org)

System clock

Update system time

This will update your system clock via NTP (Network Time Protocol).

# Enable ntp time updates
timedatectl set-ntp true

Disks

Partition the disks

It's complicated. You'll probably use fdisk or parted. See Partition the disks (wiki.archlinux.org) for details.

Format disks

Format any ext4 partitions you made:

# Format a partition as ext4
mkfs.ext4 /dev/sda1
#              ^^^^ replace this

Format swaps

(Optional) If you made a swap partition, use mkswap to format them:

# Format a partition as swap space
mkswap /dev/sda3
swapon /dev/sda3
#              ^^^^ replace these

Mount

Mount the root to /mnt:

mount /dev/sda1 /mnt

(If using UEFI mode) mount the boot partition:

mkdir /mnt/boot
mount /dev/sda2 /mnt/boot

Installing Arch Linux

Edit your mirror list, and move the geographically-closest location to you up the list.

# Find your closest country, and bring it up
vi /etc/pacman.d/mirrorlist

Install packages

Install packages using pacstrap. This will take a while!

# Make some coffee while this is happening
pacstrap /mnt base

Tip: You can add base-devel as well for some developer tools.

Configure list of partitions

Generate the list of partitions (/etc/fstab) to be mounted at boot time. This will be based on what partitions are already mounted right now.

# Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab

Enter the system

Use arch-chroot to "enter" the new file system. This will make root path (/) be what's in the new partition (until you exit).

# ~Enter the system~
arch-chroot /mnt

Once in chroot

Set timezone

# Set your timezone (eg, Asia/Manila)
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

# Update time config (/etc/adjclock)
hwclock --systohc

Set up locales

# Uncomment `en_US.UTF-8 UTF-8` in this file
vi /etc/locale.gen

# Generate locale config (/etc/locale.gen)
locale-gen

Set keyboard layout

(Optional) If you use a different keyboard layout, make it persist on boot.

vi /etc/vconsole.conf

Set it to:

KEYMAP=de-latin1

Set hostname

Update /etc/hostname:

echo "myhostname" > /etc/hostname
#     ^^^^^^^^^^ change it to whatever you feel like using

Update /etc/hosts:

vi /etc/hosts
127.0.0.1	localhost
::1		localhost
127.0.1.1	myhostname.localdomain	myhostname

Change root password

passwd

Create your user

Create your user

# Create the user
useradd rsc
#       ^^^ change this

# Create their home dir
mkdir /home/rsc
#           ^^^

Add to the admin group

The admin group is named wheel.

usermod -a -G wheel rsc
#                   ^^^ change this

Tip: You'll want to add them eventually to audio,input,video too.

Set up sudo

Add and configure the sudo package to grant your user some superuser rights.

# Install sudo
pacman -S sudo

# Update config
visudo

Add this:

rsc ALL=(ALL) all

Next steps

Install a boot loader

It's a long story. See GRUB for details. For example, this was what I had to do with a MacBook Air 2015. It might be diffirent for your system!

# Install grub
sudo pacman -S grub

# https://wiki.archlinux.org/index.php/GRUB#Installation
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub
grub-mkconfig -o /boot/grub/grub.cfg

# via https://wiki.archlinux.org/index.php/Mac#Setup_bootloader
bootctl --path=/boot install

Reboot

Remove the USB stick and reboot. You may need to update your BIOS to boot to your new partition.

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