Linux 指南

整理 Arch Linux 安装、镜像源配置和常用命令。

镜像

Arch Linux

安装

# 连接网络
iwctl
station wlan0 get-networks
station wlan0 connect [WIFI]

# 一键安装
archinstall

配置源

编辑 /etc/pacman.d/mirrorlist, 在文件的最顶端添加:

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

更新软件包缓存:

sudo pacman -Syy

yay

sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si

yay 是基于 Go 语言开发的,会自动安装 Go 依赖

curl -fsSL https://fnm.vercel.app/install | bash
echo 'eval "$(fnm env --use-on-cd)"'
>> ~/.zshrc
source ~/.zshrc

Go

# ~/.zshrc
export GO111MODULE=on
export GOPROXY=https://goproxy.cn,direct

# GOPATH 添加的系统环境变量
export GOPATH=/home/dev/go
export PATH=$PATH:$GOPATH/bin

clash

clash 是基于 Go 语言开发的代理工具,可以在终端启动代理:

go install github.com/Dreamacro/clash@latest
mkdir -p ~/.config/clash

# 下载配置文件
wget -c https://neofeed.org/files/kiwvGoTPt9/clash.yml -O ~/.config/clash/config.yaml
clash
# clash 自动启动
cp clash /usr/local/bin
cp config.yaml /etc/clash/
cp Country.mmdb /etc/clash/

新建 /etc/systemd/system/clash.service

# 新建 service
[Unit]
Description=Clash daemon, A rule-based proxy in Go.
After=network.target
  
[Service]
Type=simple
Restart=always
ExecStart=/usr/local/bin/clash -d /etc/clash

[Install]
WantedBy=multi-user.target
systemctl [status|stop|start] clash

zsh

# 切换默认 shell
chsh -s /usr/bin/zsh

# 安装 ohmyzsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

常用软件

sudo pacman -S \
jq \
curl \
httpie \
adobe-source-han-serif-cn-fonts \
adobe-source-han-sans-cn-fonts \
exa \
flameshot \
kit ty \
btop \
neovim \
l
lsd

yay -S --noconfirm
visual-studio-code-bin \
notion-app-enhanced \
utools \
zsh-syntax-highlighting \
zsh-autosuggestions \
zsh-you-should-use \
fnm-bin \
dotdrop

git clone https://github.com/agkozak/zsh-z $ZSH_CUSTOM/plugins/zsh-z

git clone https://github.com/paulirish/git-open.git $ZSH_CUSTOM/plugins/git-open

echo 'eval "$(fnm env --use-on-cd)"'
>> ~/.zshrc

echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme\nsource /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh\nsource /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh\nsource /usr/share/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh'
>> ~/.zshrc

Docker

sudo pacman -S docker

上面这种安装方式需要使用 sudo 权限来运行 docker 命令,因此需要把用户加入 docker 用户组:

# root 用户
usermod -aG docker [username]

Fcitx5 中文输入法

# 卸载 fcitx4
sudo pacman -Rs $(pacman -Qsq fcitx)

# 安装 fcitx5
sudo pacman -S fcitx5-chinese-addons fcitx5 fcitx5-gtk fcitx5-qt fcitx5-config-qt
# 配置 Group
# vim ~/.config/fcitx5/profile
[Groups/0]

# Group Name
Name=Default

# Layout
Default Layout=us

# Default Input Method
DefaultIM=pinyin

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=pinyin
# Layout
Layout=

[GroupOrder]
0=Default
# 配置环境变量
# vim ~/.pam_environment
GTK_IM_MODULE=fcitx5
QT_IM_MODULE=fcitx5

XMODIFIERS="@im=fcitx5"

使用 echo ${XDG_SESSION_TYPE} 命令查看,如果是 X11 用户,还需要将 fcitx5 & 写入 ~/.profile 文件

主题皮肤:

sudo pacman -S fcitx5-material-color

商业转载请联系站长获得授权,非商业转载请注明本文出处及文章链接,您可以自由地在任何媒体以任何形式复制和分发作品,也可以修改和创作,但是分发衍生作品时必须采用相同的许可协议。

本文采用 CC BY-NC-SA 4.0 - 非商业性使用 - 相同方式共享 4.0 国际进行许可。