记录第一次安装Archlinux

my device

1
2
3
Host: RedmiBook Pro 15
CPU: 11th Gen Intel i5-11300H (8) @ 4.400GHz
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics]

USB drive install ventory

copy archlinux image to ventory push USB driver in target computer # Enter BIOS(UEFI) reboot from USB driver, then choose archlinux grub2

Here CLI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# if font small
setfont ter-132n

systemctl stop reflector.service

iwctl
device list
station wlan0 scan
station wlan0 get-networks
station wlan0 connect WIFI
exit

ping www.bilibili.com
timedatectl set-ntp true

lsblk
parted /dev/nvme0n1
(parted)mktable
New disk label type? gpt
quit

cfdisk /dev/nvme0n1
# then set partition and its type
# set 1G EFI system
# set 4G swap
# set [the rest space] linux root x86-64
# quit
fdisk -l

# linux root x86-64
mkfs.ext4 /dev/nvme0n1p3
# swap
mkswap /dev/nvme0n1p2
# EFI system
mkfs.fat -F 32 /dev/nvme0n1p1

# keep linux root x86-64 first
mount /dev/nvme0n1p3 /mnt
mkdir /mnt/efi
mount /dev/nvme0n1p1 /mnt/efi
swapon /dev/nvme0n1p2

vim /etc/pacman.d/mirrorlist
# Put in the first line
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch

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

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

arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc

vim /etc/locale.gen
# uncomment en_US.UTF-8 an zh_CN.UTF-8

locale-gen
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
vim /etc/hostname
ark233
vim /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 ark233

passwd root
pacman -S intel-ucode
# or pacman -S amd-ucode
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
vim /etc/default/grub
# set GRUB_CMDLINE_LINUX_DEFAULT loglevel=5
# i missed this command in the first installation xD
grub-mkconfig -o /boot/grub/grub.cfg

exit
umount -R /mnt
# pull out USB driver
reboot

# accomplished

after installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
setfont -d

vim ~/.bash_profile
export EDITOR='vim'

useradd -m -G wheel -s /bin/bash arch
passwd arch
# still in CLI
EDITOR=vim visudo
# uncomment %wheel ALL=(ALL:ALL) ALL

vim /etc/pacman.conf
# unmount [multilib] section
# add these
[archlinuxcn]
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
Server = https://mirrors.hit.edu.cn/archlinuxcn/$arch
Server = https://repo.huaweicloud.com/archlinuxcn/$arch

sudo pacman-key --lsign-key "farseerfc@archlinux.org"
sudo pacman -S archlinuxcn-keyring
sudo pacman -S paru

pacman -Syyu


# learn from https://medium.com/@mynameised/using-keyd-in-hyprland-to-rebind-your-right-alt-key-to-escape-linux-782086c81c75
sudo paru -S keyd
sudo vim /etc/keyd/default.conf
[ids]

*

[main]
# hold is control, tap is esc
capslock = overload(control, esc)

vim ~/.config/hypr/hyprland.conf
# add these
exec-once = sudo keyd

paru -S fcitx5-im fcitx5-chinese-addons fcitx5-pinyin-zhwiki
# add pinyin
# ctrl+space switch

vim /etc/environment
GTK_IM_MODULE=fcitx
# or choose setting as https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland#GTK_IM_MODULE
QT_IM_MODULE=fcitx5
XMODIFIERS=@im=fcitx

# from https://www.bilibili.com/read/cv24998287/
paru -S xorg-xrdb
vim ~/.config/hyprland.conf
monitor = ,highres,auto,2
# exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
# exec-once = echo 'Xft.dpi:192' | xrdb -merge
env = GDK_SCALE,2
env = XCURSOR_SIZE,32

# Chrome
# Go to chrome://flags and search for Preferred Ozone platform. From the drop-down menu, select Wayland and restart Chrome.
# enable Wayland text-input-v3

paru -S sof-firmware linux-firmware

dotfiles

myDotfiles