2020-02-14  2024-09-15    414 字  2 分钟

Download ISO file

https://www.archlinux.org/download/

https://mirrors.tuna.tsinghua.edu.cn/archlinux/iso/

Prepare an installation medium

1dd bs=4M if=path/to/archlinux.iso of=/dev/sdb status=progress oflag=sync

Boot the live environment

Connect Network

 1iwctl
 2device list
 3station [device] scan
 4station [device] get-networks
 5station [device] connect SSID
 6
 7# Check
 8ip address
 9
10# Update the system clock
11timedatectl set-ntp true
12timedatectl status

Partition the disks

 1lsblk -l
 2
 3cgdisk /dev/sda
 4
 5# Format
 6# EFI `ef00`
 7# Linux `8300`
 8# SWAP `8200`
 9mkfs.ext4
10mkfs.vfat
11mkswap
12
13# Mount
14mount /dev/sda3 /mnt
15mkdir /mnt/boot
16mount /dev/sda1 /mnt/boot
17swapon /dev/sda2

Edit Mirrorlist

1vim /etc/pacman.d/mirrorlist
1Setver = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
2Setver = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
3Setver = https://mirrors.xjtu.edu.cn/archlinux/$repo/os/$arch
4Setver = https://mirrors.163.com/archlinux/$repo/os/$arch
1pacman -Syy

Install essential packages

1pacstrap /mnt base linux-lts linux-firmware vim

Configure the system

1genfstab -U /mnt >> /mnt/etc/fstab
2arch-chroot /mnt /bin/bash

TimeZone

1ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2hwclock --systohc --utc

Locale

1vim /etc/locale.gen
1en_US.UTF-8 UTF-8
2zh_CN.UTF-8 UTF-8
1locale-gen
2echo LANG=en_US.UTF-8 > /etc/locale.conf
3echo lap > /etc/hostname

Boot Loader

1pacman -S efibootmgr grub
2grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Arch Linux" --recheck
3grub-mkconfig -o /boot/grub/grub.cfg

User

1visudo /etc/sudoers
1%wheel ALL=(ALL) ALL
1# root password
2passwd
3# user
4useradd -m -G wheel -s /bin/zsh akvicor
5passwd akvicor

Network

1vim /etc/systemd/network/20-wired.network

Wired DHCP

1[Match]
2Name=enp1s0
3
4[Network]
5DHCP=yes

Wired Static

1[Match]
2Name=enp1s0
3
4[Network]
5Address=10.1.10.9/24
6Gateway=10.1.10.1
7DNS=10.1.10.1
8DNS=8.8.8.8
1vim /etc/systemd/network/25-wireless.network

Wired DHCP

1[Match]
2Name=wlan0
3
4[Network]
5DHCP=yes
1systemctl enable systemd-networkd
2systemctl start systemd-networkd
3systemctl enable systemd-resolved
4systemctl start systemd-resolved
5systemctl enable iwd
6systemctl start iwd

Extra Package

1pacman -S base-devel iwd zsh
2# Desktop Environment
3pacman -S xf86-video-intel xorg
4pacman -S noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra ttf-font-awesome terminus-font
5pacman -S i3-gaps i3blocks i3status xorg-xinit alsa-utils
6pacman -S rofi dunst libnotify ranger feh xclip

if use xorg-xinit

1cp /etc/X11/xinit/xinitrc ~/.xinitrc

Edit ~/.xinitrc and DELETE

1#twm &
2#xclock -geometry 50x50-1+1 &
3#xterm -geometry 80x50+494+51 &
4#xterm -geometry 80x20+494-0 &
5#exec xterm -geometry 80x66+0+0 -name login

ADD

1exec i3

Auto start

1vim ~/.bash_profile or ~/.zprofile
1if [[ ~ $DISPLAY && $XDG_VTNR -eq 1 ]]; then
2    exec startx
3fi

Files Location

.desktop

1cd ~/.local/share/applications
2cd /usr/share/applications

Systemd

1vim /etc/systemd/system/rc-local.service
 1[Unit]
 2Description="/etc/rc.local Compatibility"
 3
 4[Service]
 5Type=oneshot
 6ExecStart=/etc/rc.local start
 7TimeoutSec=0
 8StandardInput=tty
 9RemainAfterExit=yes
10SysVStartPriority=99
11
12[Install]
13WantedBy=multi-user.target
1vim /etc/rc.local
1#!/bin/sh
2# /etc/rc.local
3if test -d /etc/rc.local.d; then
4    for rcscript in /etc/rc.local.d/*.sh; do
5        test -r "${rcscript}" && sh ${rcscript}
6    done
7    unset rcscript
8fi
1chmod a+x /etc/rc.local
2mkdir /etc/rc.local.d
3systenctl enable rc-local.service

Problems

Multiple Monitor

1xrandr --output eDP1 --primary --auto --output HDMI1 --left-of eDP1 --rotate left --auto

Audio

1pacman -S alsa alsa-utils
2
3amixer sset Master unmute
4
5alsamixer # 'm' to unmute/mute

除另有声明外本博客文章均采用 知识共享 (Creative Commons) 署名 4.0 国际许可协议 进行许可转载请注明原作者与文章出处