How to use archlinux

From 清冽之泉
Revision as of 20:39, 11 May 2025 by Mwroot (talk | contribs) (→‎包管理器)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

联网安装

若用的不是网线,则需要先联 WIFI 再开始 archinstall。

iwctl
device list
station wlan0 scan
station wlan0 get-networks
station wlan0 connect wifiname
exit
ping bilibili.com
archinstall

换源

# /etc/pacman.d/mirrorlist 配置文件开头加上:
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
# /etc/pacman.conf 配置文件末尾加上:
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch

ustc 在开头加,是为了优先用。cn 在末尾加,是因为这是社区而非官方维护的镜像,放末尾避免干扰其他默认配置。

包管理器

# 更新系统 Sync refresh upgrade
sudo pacman -Syu

# 查找 Sync search
pacman -Ss

# 查看 Query
pacman -Qs

# 安装
sudo pacman -S

# 卸载软件 Remove
sudo pacman -R

# 卸载无用依赖
sudo pacman -Rns

# 清除孤立不用的包
sudo pacman -Qqdt | sudo pacman -Rs -

# pacman 支持通配符 ^开头 $结尾
sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si
# paru 作为 aur 专用的包管理器,命令行参数与 pacman 大体一致

paru -S sth 即可安装名为 sth  aur 包,不需要 sudo

系统备份

安装 timeshift 即可。

brtfs 文件系统,支持增量备份,备份在当前盘。

Snapshots are created using the built-in features of the BTRFS filesystem.
快照使用 BTRFS 文件系统的内置功能来创建。

Snapshots are created and restored instantly.
快照可瞬间创建和还原。

Snapshot creation is an atomic transaction at the file system level.
快照的创建在文件系统层面上是一个原子操作。

Snapshots are restored by replacing system subvolumes. Since files are never copied, deleted or overwritten, there is no risk of data loss. The existing system is preserved as a new snapshot after restore.
快照的还原通过替换系统子卷来完成。由于文件从未被复制、删除或覆盖,因此不存在数据丢失风险。还原后,原有系统会被保存为一个新的快照。

Snapshots are perfect, byte-for-byte copies of the system. Nothing is excluded.
快照是系统的逐字节完整拷贝,不会遗漏任何内容。

Snapshots are saved on the same disk from which they are created (system disk). Storage on other disks is not supported. If system disk fails then snapshots stored on it will be lost along with the system.
快照存储在与其创建源相同的磁盘(即系统盘)上,不支持将快照保存到其他磁盘。如果系统盘出现故障,快照也将随之丢失。

Size of BTRFS snapshots are initially zero. As system files gradually change with time, data gets written to new data blocks which take up disk space (copy-on-write). Files in the snapshot continue to point to original data blocks.
BTRFS 快照的初始大小为零。随着系统文件的变化,新的数据会写入新的数据块(写时复制),占用磁盘空间;而快照中的文件仍然指向原始的数据块。

OS must be installed on a BTRFS partition with Ubuntu-type subvolume layout (@ and @home subvolumes). Other layouts are not supported.
操作系统必须安装在具有 Ubuntu 风格子卷布局(包含 @ 和 @home 子卷)的 BTRFS 分区上,其他布局不受支持。

Devices displayed above have BTRFS filesystems
上方列出的设备均使用 BTRFS 文件系统。

BTRFS snapshots are saved on system partition. Other partitions are not supported.
BTRFS 快照仅保存在系统分区,其他分区不受支持。

Snapshots are saved to /timeshift-btrfs on selected partition. Other locations are not supported.
快照会保存在所选分区的 /timeshift-btrfs 目录下,不支持保存到其他位置。

Snapshots are not scheduled at fixed times.
快照并非按固定时间点执行,而是根据需用情况动态触发。
EndeavourOS

A maintenance task runs once every hour and creates snapshots as needed.
每小时运行一次维护任务,根据当前快照保留策略和系统变化情况,决定是否创建新的快照。
EndeavourOS

Boot snapshots are created with a delay of 10 minutes after system startup.
启动快照会在系统启动后延迟 10 分钟创建,以避免影响启动过程。

Scheduled snapshots are enabled. Snapshots will be created automatically for selected levels.
已启用计划快照,将根据所选备份级别(如每小时、每日、每周等)自动创建快照。
Ubuntu Forums
TeejeeTech

System can be rolled back to a previous date by restoring a snapshot.
通过还原快照,系统可以回滚到之前的任意日期。
Linux Mint Installation Guide
TeejeeTech

Restoring a snapshot will replace system subvolumes, and system subvolumes currently in use will be preserved as a new snapshot. If required, this snapshot can be restored later to ‘undo’ the restore.
还原快照时会用快照的子卷替换当前系统子卷,同时将被替换的子卷作为新的快照保留;如有需要,可稍后还原此新快照以“撤销”之前的还原操作。
TeejeeTech
Ubuntu Forums

BTRFS snapshots are saved on the same disk from which it is created. If the system disk fails, snapshots will be lost along with the system. Save snapshots to an external non-system disk in RSYNC mode to guard against disk failures.
BTRFS 快照保存在与其创建源相同的磁盘上;若系统盘故障,快照也会随系统一并丢失。可改用 RSYNC 模式并将快照保存至外部非系统磁盘,以防单点磁盘故障。

ext4 文件系统,只支持全量备份,可以选择备份位置。

.bashrc 强化

export EDITOR=emacs
alias s='ls -hl'
alias pn='sudo pacman -Syu'
alias pi='sudo pacman -S'
alias pr='sudo pacman -Rns'
alias pss='pacman -Ss'
alias eb='emacs ~/.bashrc'
alias sb='source ~/.bashrc'
alias sp='poweroff'
alias sr='reboot'

令中文不显示成方框

sudo pacman -S wqy-microhei noto-fonts-cjk adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts adobe-source-han-sans-tw-fonts adobe-source-han-serif-tw-fonts
sudo nano /etc/locale.gen
去掉 zh_CN.UTF-8 UTF-8 前的 # 号
sudo locale-gen

安装中文输入法

sudo pacman -S ibus-rime
ibus-setup

安装 Office

sudo pacman -S libreoffice-still libreoffice-still-zh-cn

安装微信

paru -S wechat-bin
# : 是用 less 显示输出信息的提示符,按 Enter 可以继续读,按 q 可以直接退出,再按 Y 完全安装

使用 Stardict

ln -s /home/qlzq/Documents/En /usr/share/stardict/dic/own-dict

使用 rslsync

pon # 先开 proxy
paru -S rslsync
mkdir -p ~/.config/rslsync
rslsync --dump-sample-config > ~/.config/rslsync/rslsync.conf # 改掉设备名,保存目录,用户名等
systemctl --user enable --now rslsync.service
# 没有普通 GUI,有 web GUI,打开 http://localhost:8888 访问
# 注册一下,应用一下免费授予的个人 key btskey

xfce4 调试

# 这是针对 xfce4 下 ibus-rime 的调试
# 设置 ibus-rime 依赖的环境变量
# 把以下放入 .xprofile
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
ibus-daemon -drx
取消 Color 前的 # 可以让 pacman -Ss 出的结果有色彩区分
sudo emacs /etc/pacman.conf
Color

kde 调试

在系统设置 Input 里调 ibus-rime。

# 关掉开机等待
sudo nano /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfg