ArchLinux Installation Guide Wiki
ArchLinux Installation Guide Wiki
第1章? 工欲善其事,必先利其器
1.1? 下載鏡像**
https://mirrors.tuna.tsinghua.edu.cn/archlinux/iso/2022.02.01/archlinux-2022.02.01-x86_64.iso
1.2? 啟動U盤制作
1.2.1 “rufus”
https://github.com/pbatard/rufus/releases/download/v3.20/rufus-3.20.exe
1.2.2 “dd”**
#dd if=/aaa.iso of=/dev/sdb bs=2M conv=fsync status=progress?
1.2.3 “ventoy”U盤制作工具,可以安裝多個鏡像
1.3? 驗證引導模式**
# ls? /sys/firmware/efi/efivars
1.4 關閉reflector服務**
#systemctl stop reflector.services
第2章? 安裝
2.1? 連接網(wǎng)絡
2.1.1? iwd
#命令行參數(shù)形式**
#iwctl --passphrase passphrase station device connect SSID
#dhcpcd
#交互提示符形式
#iwctl
#device list (列出可用設備)
#station device scan(掃描網(wǎng)卡可用設備)
#station device get-networks(列取可用無線網(wǎng))
#station device connect SSID(連接)
#station device disconnect(斷開連接)
#dhcpcd
2.1.2? netctl
#pacman -S wpa_supplicant dialog netctl
#wifi-menu
#ls /etc/netctl
#systemctl enable netclt-auto@wls1.service(開機啟動)
#systemctl start netclt-auto@wls1.service
2.1.3? wpa_supplicant
#lspci -k
#lsusb -v
#ip link
#ip link set wls1 up(如果沒有激活,則激活接口)
#iw dev wls1 scan | grep ssid(需要安裝iw工具包)
#wpa_passpshrase wls1 123 > /etc/wpa_passpshrase/wpa_supplicant-wls1.conf
#wpa_supplicant -B -i wls1 -c /etc/wpa_supplicant/wpa_supplicant-wls1.conf
#dhcpcd wls1
2.1.4? 網(wǎng)卡直連
#cp /etc/netctl/examples/ethernet-dhcp /etc/netctl
#vim /etc/netctl/ethernet-dhcp
Description=” ”
Interface=enp7s0
Connection=Ethernet
IP=dhcp
#systemctl start ethernet-dhcp? ?//啟動有線網(wǎng)絡連接
#systemctl enable ethernet-dhcp //需要則開機啟動
2.1.5? PPPOE
2.1.5.1? ppp聯(lián)網(wǎng)
#pacman –S ppp ry-pppoe
#ip link set your_interfce down/up
#pppoe-setup(配置)
#vim /etc/ppp/pppoe.conf(撥號配置文件)
#vim /etc/ppp/pap-secrets(撥號賬號密碼配置文件)
#pppoe-start
#dhcpcd device
#pppoe-stop
#systemctl enable adsl
#systemctl start adsl
2.1.5.2? netctl,pppoe
#cp /etc/netctl/examples/pppoe /etc/netctl/adsl
#vim /etc/netctl/adsl(只需要修改下面兩行,用戶和密碼)
USER=’? ’
PASSWORD=’? ’
#netctl enable adsl(啟用配置文件)
#netctl reenable adsl(創(chuàng)建開機systemd啟動服務)
#systemctl enable netctl@adsl.service (開機啟動撥號服務)
#netctl list(列出可以連接的網(wǎng)絡)
#netctl start adsl
#netctl stop adsl
第3章? 選擇鏡像
3.1? 主倉庫**
#vim /etc/pacman.d/mirrorlist
#Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
#pacman -Syy
3.2? reflector獲取倉庫地址
#reflector --verbose --country ‘China’ -p https -l 30 --sort rate --save /etc/pacman.d/mirrorlist
#pacman -Syy
3.3? 中國社區(qū)倉庫
#vim /etc/pacman.conf
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
#pacman -S archlinuxcn-keyring
#pacman -Syy
第4章? 更新系統(tǒng)時間**
#timedatectl set-ntp true
#timedatectl status
第5章? 硬盤分區(qū),掛載
#linux kernel 5.15后的內核已經(jīng)原生支持ntfs格式了,用帶參數(shù)的#mount -t ntfs3 /dev/sdb2
5.1? LVM(邏輯分卷管理器)**
# fdisk -l
# fdisk /dev/sda
# g (改成gpt分區(qū))
# mkfs.vfat -F 32 /dev/sda1 (efi分區(qū))
# mkfs.ext4 /dev/sda2(根分區(qū))
#pvcreate /dev/sda2(物理卷)
#vgcreate arch /dev/sda2(卷組)
#lvccreate -L +8G arch -n swap(邏輯卷)
#lvcreate -l +100%FREE arch -n root **
#mkfs.ext4 /dev/mapper/arch-root
#mkswap /dev/mapper/arch-swap
#swapon /dev/mapper/arch-swap
#mount /dev/mapper/arch-root /mnt
#mkdir /mnt/boot
#mount /dev/sda1 /mnt/boot
5.2? BIOS(基本輸入輸出系統(tǒng))
#fdisk -l
#fdisk /de/sda
#mkfs.ext4 /dev/sda1 (boot分區(qū))
#mkfs.ext4 /dev/sda3 (/ 分區(qū))
#mkswap /dev/sda2 (swap分區(qū))
#swapon /dev/sda2
#mount /dev/sda3 /mnt
#mkdir /mnt/boot
#mount /dev/sda1 /mnt/boot
5.3? systemd(統(tǒng)一可擴展固件接口,需要改標簽)
# fdisk -l
# fdisk /de/sda
# g (改成gpt分區(qū))
# mkfs.vfat -F 32 /dev/sda1 (efi分區(qū))
# mkfs.ext4 /dev/sda2(/分區(qū))
#mkswap /dev/sda2 (swap分區(qū))
#swapon /dev/sda2
#mount /dev/sda3 /mnt
#mkdir /mnt/boot
#mkdir /mnt/boot/efi
#mount /dev/sda1 /mnt/boot/efi
第6章? 安裝系統(tǒng)基礎包**
#pacstrap -i /mnt base base-devel linux linux-firmware lvm2
第7章? 配置系統(tǒng)**
7.1? Fstab
#genfstab -U /mnt >>/mnt/etc/fstab
#cat /mnt/etc/fstab
7.2? 換到新安裝的系統(tǒng)**
#arch-chroot /mnt
7.3? 時區(qū)**
#ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
7.4? 同步硬件時間**
#hwclock --systohc
7.5? 安裝系統(tǒng)配置軟件包**
#pacman -S vim wpa_supplicant dialog netctl dhcpcd intel-ucode os-prober alsa-utils git pulseaudio ntfs-3g smplayer player aria2 wget curl udftools vlc lvm2 iwd lxterminal lynx w3m links adobe-source-han-sans-otc-fonts adobe-source-han-sans-cn-fonts
7.6? 本地化**
7.6.1? /etc/locale.gen
#vim /etc/locale.gen
en_US.UTF-8 UTF-8
#locale-gen(配置后生效)
7.6.2? /etc/locale.conf**
#echo.UTF-8 > /etc/locale.conf
或
#vim /etc/locale.conf
LANG=en_US.UTF-8
7.7? 主機名**
#vim /etc/hostname? 或? echo localhost >/etc/hostname
7.8? hosts**
#vim /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1? ?localhost.localdomain localhost
127.0.0.1 localhost.localdomain localhost
7.9? 創(chuàng)建引導文件,重新創(chuàng)建一個initramfs
7.9.1 創(chuàng)建引導文件
7.9.1.1 grub**
#vim /etc/mkinitcpio.conf
HOOKS=(base udev ... block lvm2 filesystems)
#mkinitcpio –P
7.9.1.2 systemd
#vim /etc/mkinitcpio.conf
HOOKS=(base systemd ... block lvm2 filesystems)
#mkinitcpio –p linux
7.9.2 安裝引導
7.9.2.1? systemd-boot
1 systemd-boot必須為uefi啟動
2 安裝systemd-root到EFI分區(qū)中
#bootctl --path=/boot$esp install
3 配置/boot/loader/loader.conf
default arch.conf
timeout 4
console-mode auto
editor no
4 配置/boot/loader/entries/arch.conf
title Arch linux(LVM)
linux /vmlinuz-linux
initrd /intel-ucode.img(如果是AMD則改成amd-ucode.img)
initrd /initramfs-linux.img
options root=UUID=4124654364163431641432(計算/dev/mapper/arch-root) rw
# blkid -s UUID -o value /dev/mapper/arch-root
7.9.2.2? UEFI引導程序**
#pacman -S dosfstools grub efibootmgr
#grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
#grub-mkconfig -o /boot/grub/grub.cfg
7.9.2.3 BIOS-GRUB引導程序
#pacman -S grub
#grub-install --target=i386-pc /dev/sda
#grub-mkconfig -o /boot/grub/grub.cfg
7.10? 配置root密碼**
#passwd root
7.11? 用戶管理
#useradd -m username
#passwd username
第8章? 重新引導**
#reboot
第9章? 安裝圖形界面,個性化配置**
#pacman -S xorg xorg-xinit
9.1? i3WM
9.1.1
#pacman -S i3wm lxterminal
#pacman -S lightdm lightdm-gtk-greeter
pacman -S lightdm-gtk-greeter-settings
#systemctl enable lightdm
#systemctl start lightdm
#vim /etc/lightdm/lightdm-gtk-greeter.conf
[greeter]
indicators=
#vim .config/i3/config
#default_border pixel 1
9.1.2 i3status配置目錄
#cp /etc/i3status.conf ~/.config/i3status/config?
9.2? GNOME
#pacman -S gnome gdm gnome-extra
#systemctl enable gdm
#systemctl enable NetworkManager
#systemctl start NetworkManager
#systemctl start gdm
9.3? KDE
#pacman -S sddm sddm-kcm plasma konsole dolphin ark kate packagekit-qt5 konqueror sweeper
#systemctl enable sddm
#systemctl enable NetworkManager
#systemctl start NetworkManager
#systemctl start sddm
9.4? ?DWM(dynamic window manager)、ST(simple terminal)**
#git clone https://git.suckless.org/dwm
#git clone https://git.suckless.org/st
#make clean install(在安裝前先安裝chromium這樣字體設置好了)
#vim .xinitrc
while true;do
xsetroot -name "$(date +"%F %T %B %A")"
sleep 1s
done &
#exec --no-startup-id fcitx5 -d(i3用)
fcitx5 -d
exec dwm
第10章? 安裝軟件包
10.1? 中文輸入法**
#pacman -S fcitx5-im fcitx5-chinese-addons wqy-microhei?
#vim /etc/environment
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
INPUT_METHOD=fcitx
SDL_IM_MODULE=fcitx
#GLFW_IM_MODULE=ibus
#fcitx5-configtool
10.2? 辦公軟件
#pacman -S libreoffice-fresh,libreoffice-fresh-zh-cn
#pacman -S mousepad leafpad
#pacman -S zathura zathura-pdf-poppler
#pacman -S unarchiver,unrar,p7zip
#unar -e GBK *.zip
#unrar -e *.rar
#7z e *.7z
10.3? WEB瀏覽器
#pacman -S firefox firefox-i18n-zh-cn?
#pacman -S chromium**
10.4? 關閉屏幕保護時間**
#vim /etc/X11/xorg.conf.d/xorg.conf
#找到”ServerLayout”字段加入下面4行
?Option "BlankTime" "0"
?Option "StandbyTime" "0"
?Option "SuspendTime" "0"
?Option "OffTime" "0"
10.5 終端復制粘貼
#ctrl+insert? 復制
#shift+insert 粘貼
10.6 ffplay
ffplay -x 800 -y 700 -volume 15 ****.mp3 -autoexit -nodisp -vn
ffplay -x 800 -y 700 -volume 15 ****.mp4 -autoexit -sn
ffplay -x 800 -y 700 -volume 15 ****.mp3 -autoexit -nodisp -loop 0 -an -vn -sn
#pacman --sync --refresh --sysupgrade
10.7 SOX music player
#pacman --sync libmod libid3tag twolame sox
#play a.mp3 repeat 100
10.8 mplay video player
#pacman --sync mplay
#mplay a.mp4
10.9 關閉字符界面屏保時間
#setterm -blank 0 --powersave off --powerdown 0
#setterm -blank 1 --powersave off --powerdown 5
10.10 關閉屏保,重啟失效
#xset s 300
#xset s 0
#xset s 10