Arch Linux Install

Published 12-30-2018 14:13:25

Boot your computer to a USB drive with the latest Arch Linux iso, then follow these steps:

Ping a public DNS or IP address to make sure you’re connected to the internet.

ping 8.8.8.8

Turn NTP on

timedatectl set-ntp true

Prepare your disk

Use lsblk to determine which disk to prepare. This example will use disk sda.

fdisk to set partitions

fdisk /dev/sda

Create new partitions.

# Delete existing partitions, if needed
	d -- delete partition
	[Enter] -- default partition number
# Repeat until no partitions exist

# Boot partition
	n -- new partition
	p -- primary
	[Enter] -- default partition number
	[Enter] -- default first sector
	+200M -- last sector

# Swap partition (change +8G to match 100% or 150% of your RAM size)
	n -- new partition
	p -- primary
	[Enter] -- default partition number
	[Enter] -- default first sector
	+8G -- last sector

# Root partition
	n -- new partition
	p -- primary
	[Enter] -- default partition number
	[Enter] -- default first sector
	+50G -- last sector

# Home partition
	n -- new partition
	p -- primary
	[Enter] -- default partition number
	[Enter] -- default first sector
	[Enter] -- uses the rest of the drive space

# Write the changes to finish fdisk

	w

Create filesystems

mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda4
mkswap /dev/sda2
swapon /dev/sda2

Mount partitions

mount /dev/sda3 /mnt
mkdir /mnt/home
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
mount /dev/sda4 /mnt/home

Confirm these mounts

lsblk

Install base packages to /mnt with pacstrap

pacstrap /mnt base base-devel vim

Create a new fstab file

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

Enter the new root dir

arch-chroot /mnt

Install more packages

pacman -S networkmanager
systemctl enable NetworkManager

Install and setup grub

pacman -S grub
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

Change root password

passwd

Set locale

vim /etc/locale.gen

#	Uncomment the lines:
#	en_US.UTF-8 UTF-8
#	en_US.ISO-8859-1
#	To save your changes in vim, hit ESC, then type :wq [Enter]
locale-gen
vim /etc/locale.conf

	LANG=en_US.UTF-8

Set Timezone

ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime

Set your hostname

vim /etc/hostname

Exit your new root

exit

Unmount your partitions

umount -R /mnt

Reboot

reboot

How to Setup Autologin Service

To login automatically (at tty1) after boot, type

sudo systemctl edit getty@tty1

paste this:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin YourUserName --noclear %I 38400 linux

ref. https://wiki.archlinux.org/index.php/Automatic_login_to_virtual_console#Virtual_console

To automatically start X after tty login, add the following to the bottom of ~/.bash_profile:

(if the file does not exist, copy a skeleton version from /etc/skel/.bash_profile)

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

ref. https://wiki.archlinux.org/index.php/Start_X_at_Boot#Shell_profile_files

To execute i3lock after i3 session is executed, add i3lock to your ~/.i3/config file:

exec --no-startup-id i3lock -c 000000