Skip to content

Archlinux Installation

Before Start

BIOS

  • Disable Secure Boot
  • Boot Mode UEFI Only

Basic Install

Disable reflector

1
systemctl stop reflector.service

Check UEFI Mode

Outputs after command below:

1
ls /sys/firmware/efi/efivars

Connect Network

1
2
3
4
5
iwctl
device list
station wlan0 scan
station wlan0 get-networks
station wlan0 connect ${WIFI}

Update Clock

1
2
timedatectl set-ntp true
timedatectl status

Partition

1
2
3
4
lsblk
parted /dev/nvme0n1
New disk lable type? gpt
quit

Divide hard disk to three parts with cfdisk /dev/nvme0n1:

  • /efi: EFI System, 800M
  • /: Linux filesystem, 100G
  • /home: Linux filesystem, other

Check with fdisk -l

Format

1
2
3
mkfs.vfat /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2
mkfs.ext4 /dev/nvme0n1p3

Mount

1
2
3
4
5
6
7
mount /dev/nvme0n1p2 /mnt

mkdir /mnt/efi
mount /dev/nvme0n1p1 /mnt/efi

mkdir /mnt/home
mount /dev/nvme0n1p3 /mnt/home

Select Server

1
vim /etc/pacman.d/mirrorlist

Add following lines at begining:

1
2
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch

Install System

1
pacstrap /mnt base base-devel linux linux-headers linux-firmware
1
pacstrap /mnt dhcpcd iwd vim bash-completion

Generate fstab file

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

Check with:

1
cat /mnt/etc/fstab

Change Root

1
arch-chroot /mnt

Set Timezone

1
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Hardware sync:

1
hwclock --systohc

Set Locale

Uncomment:

  • en_US.UTF-8
  • zh_CN.UTF-8

in /etc/locale.gen, and generate with:

1
2
locale-gen
echo 'LANG=en_US.UTF-8' > /etc/locale.conf

Set Host

1
echo 'arch' > /etc/hostname

Add following to /etc/hosts:

1
2
3
127.0.0.1 localhost
::1       localhost
127.0.1.1 arch

Change Root Password

1
passwd root

Install Micro-Code

1
2
pacman -S intel-ucode  ## for intel
pacman -S amd-ucode    ## for amd

Install Grub

1
2
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB

Change the line in /etc/default/grub to:

1
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=5 nowatchdog"

And generate with

1
grub-mkconfig -o /boot/grub/grub.cfg

Finish

1
2
3
exit
umount -R /mnt
reboot

And after restarting, start the service systemctl start dhcpcd to connect to the internet.

Desktop Install

Update System

1
pacman -Syyu

Add Non-root User

1
2
useradd -m -G wheel -s /bin/bash wyc
passwd wyc

Add sudo priority:

1
EDITOR=vim visudo

and umcomment following line:

1
#%wheel ALL=(ALL:ALL) ALL

Support 32-bit Library

1
vim /etc/pacman.conf

and uncomment:

1
2
[multilib]
Include = /etc/pacman.d/mirrorlist

Install Software

  • xterm
  • openssh
  • translate-shell
  • feh
  • rofi
  • ranger
  • neofetch
  • htop
  • gdb
  • flameshot
  • vlc
  • arandr
  • yay: git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si
  • google-chrome
  • ttf-hack
  • wqy-microhei

ctags

1
2
3
4
5
6
git clone https://github.com/universal-ctags/ctags.git
cd ctags
./autogen.sh
./configure # --prefix=/where/you/want # defaults to /usr/local
make
make install # may require extra privileges depending on where to install

fzf

1
2
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf &&
~/.fzf/install

Install i3

1
2
3
pacman -S i3-wm xorg-xinit xorg-server
cp /etc/X11/xinit/xinitrc ~/.xinitrc
echo startx >> ~/.bashrc

and change the tail of ~/.xinitrc to:

1
exec i3

and add following lines to ~/.bash_profile

1
2
3
if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
  exec startx
fi

Setup git

1
2
3
4
5
6
7
sudo apt install git
# config
git config --global user.name "YongcongWang"
git config --global user.email "yongcong.wang@outlook.com"
git config --global core.editor vim
# generate key
ssh-keygen -t rsa -C "yongcong.wang@outlook.com"

Config:

  1. Open github and sign in;
  2. In Settings/SSH and GPG keys click New SSH Key;
  3. Paste id_rsa.PUB(in /home/.ssh/id_rsa.pub);
  4. Test: ssh -T git@github.com.
1
git clone git@github.com:yongcongwang/dotfiles.git ~/.dotfiles && cd ~/.dotfiles && bash deploy.sh git

Install Chinese Input

1
sudo pacman -S fcitx5 fcitx5-qt fcitx5-config-qt fcitxt-rime rime-luna-pinyin

add following lines to /etc/environment:

1
2
3
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx

Keyboard

Set caps to control

1
setxkbmap -layout us -option ctrl:nocaps