Skip to content

Instantly share code, notes, and snippets.

@xatier
Last active May 9, 2024 08:20
Show Gist options
  • Save xatier/5dc88654738845fc5fea to your computer and use it in GitHub Desktop.
Save xatier/5dc88654738845fc5fea to your computer and use it in GitHub Desktop.

Archlinux installation


Download the Archlinux ISO from a mirror site, dd into a USB stick.

After booting from a USB stick, you'll get a zsh root shell.

check for networking

  • ping google
ping google.com

network settings

DHCP

  • the DHCP client daemon should be started automatically

Public IP

  • dhcpcd -k or systemctl stop dhcpcd.service first to disable DHCP networking

  • use ip command and resolv.conf to configure network manually

ip link                       # interface, something like 'eth0' or 'enp2s0'
ip link set <if> up
ip addr add <ip address>/<subnetmask> dev <if>
ip route add default via <gateway's ip address>

vi /etc/resolv.conf
-------------------
nameserver 8.8.8.8
nameserver 8.8.4.4
search foo.bar.com

wireless

  • remember to install netctl after chroot, otherwise the network will be broken after rebooting
iw dev
wifi-menu

update the system clock

timedatectl set-ntp true
timedatectl status

partition table

  • check for old partitions first
fdisk -l
lsblk
lsblk -f
cfdisk /dev/sda

=================================
An example for creating  partition tabel
/         25G      /dev/sda1
swap      1G       /dev/sda2
/home     else     /dev/sda3
  • format partitions (ext4)
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda3
  • swap
mkswap /dev/sda2 && swapon /dev/sda2
  • verify all things are done well
lsblk /dev/sda

mount root and home

mount /dev/sda1 /mnt
mkdir /mnt/home && mount /dev/sda3 /mnt/home

select a mirror

  • choose NCTU or tku in Taiwan
vi /etc/pacman.d/mirrorlist

pacstrap

  • base system
pacstrap -i -K /mnt base linux linux-firmware vim intel-ucode
  • if the keylist is out-of-date
pacman -S archlinux-keyring
pacman-key --init && pacman-key --populate archlinux

generate fstab

genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
  • edit /mnt/etc/fstab and add discard,noatime if you're using SSD

chroooooooooot!

arch-chroot /mnt
. /etc/profile
PS1="(chroot) $PS1"

timezone and hwclock

tzselect
ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
hwclock --systohc

timedatectl status

locale settings

  • remove comments for your locale
vi /etc/locale.gen
------------------
en_US.UTF-8 UTF-8
en_US ISO-8859-1
zh_TW.UTF-8 UTF-8
locale-gen
locale
echo "LANG=en_US.UTF-8" > /etc/locale.conf

hostname

  • set hostname
echo hostname > /etc/hostname
  • add your hostname in /etc/hosts
vi /etc/hosts

network configurations

systemctl enable systemd-networkd.service
systemctl enable systemd-resolved.service
  • do the following later after first reboot
    • systemctl restart systemd-networkd

/etc/resolv.conf

  • delete or rename the existing file and create the following symbolic link
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

different network types

networkctl list -a
networkctl status -a

DHCP

vim /etc/systemd/network/wired.network
--------------------------------------
[Match]
Name=enp1s0

[Network]
DHCP=ipv4

Static IP

vim /etc/systemd/network/wired.network
--------------------------------------
[Match]
Name=enp1s0

[Network]
Address=10.1.10.9/24
Gateway=10.1.10.1
[Link]
MTUBytes=1460

Wireless

  • try Wicd or basic wifi-menu

  • note: dialog is required by wifi-menu

pacman -S iw wpa_supplicant dialog
vim /etc/systemd/network/wireless.network
-----------------------------------------
[Match]
Name=wlp2s0

[Network]
DHCP=ipv4

generate initial ramdisk

mkinitcpio -P
  • note: you might take a look of /etc/mkinitcpio.conf and add some HOOKS if necessary

    • for QEMU/VKM/Google Compute Engine, in order to boot from a virtio drive, add the following:
MODULES="virtio virtio_blk virtio_pci virtio_net"

root passwd and add user

passwd
useradd -m xatier
passwd xatier

grub bootloader

pacman -S grub os-prober
grub-install --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

AUR

Install yay.

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
pacman -Syyu

bye bye chroot

exit

unmount everything

umount /mnt/{home,}

reboot

reboot

well done for base system!


post installation

become God

su -

install some tools

pacman -S openssh sudo screen tmux htop rsync git acpi

add a sudoer

visudo

VirtualBox

X window

sudo pacman -S alsa-utils xorg-server xorg-xinit mesa [xf86-video-intel xf86-video-ati xf86-video-nouveau nvidia xf86-video-vmware] xf86-input-libinput ttf-dejavu ttf-inconsolata

awesome wm

sudo pacman -S awesome

vim ~/.xinitrc
--------------
exec awesome >> ~/.cache/awesome_stdout 2>> ~/.cache/awesome_stderr

ALL done!

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