文章目录
Arch Linux 官方安装教程
镜像下载中国清华大学源
本文参考了官方教程或者星兮这位同志的博客
制作 U 盘启动盘
使用 rufus 软件
- 选择镜像
- 选择 gpt 模式
- 选择 fat32
- 写入选择 dd 模式
- 开始制作 等待完成
准备工作
- 关闭 bios secure 模式
- 关闭 Windows 快速启动 等等 这些工作可以参考其他博文或者官方文档
U 盘启动开始安装
- 使用 wifi-menu 连接无线网
- 分区(重点 双系统的关键)
- 使用 cfdisk 分区工具将自己想要装 ArchLinux 的分区分为两个分区一个作为 swap 一个作为 / 的挂载点.
- 格式化
mk.ext4 /dev/sdb3 // 设备名写自己的 mkswap /dev/sdb4
- 挂载
mount /dev/sdb3 /mnt swapon /dev/sdb4 mkdir -p /mnt/boot/efi mount /dev/sda1 /mnt/boot/efi // 注意 /dev/sda1 为 Windows efi 引导所在分区(重点)
chroot 进入系统后 wifi_menu 不可用
这个部分单独拿出来说是因为现在新版本的 ArchLinux 安装包没有将 netctl 打包进安装包了,就导致 arch-chroot /mnt 进入安装好的系统之后 wifi-menu 不可用,所以切记在 chroot 之前, 先安装 netctl 工具包
pacman -S netctl
// 其他需要的联网工具
pacman -S rp-pppoe dialog iw wpa_supplicant networkmanager dhcp
systemctl enable NetworkManager
安装 grub 引导
pacman -S grub efibootmgr os-prober ntfs-3g
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ArchLinux --recheck
grub-mkconfig -o /boot/grub/grub.cfg
配置国内源
编辑 /etc/pacman.d/mirrorlist ,在文件的最顶端添加
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
在 /etc/pacman.conf 文件末尾添加两行:
[archlinuxcn]
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
然后请安装 archlinuxcn-keyring 包以导入 GPG key。
sudo pacman -Sy
安装 yay
sudo pacman -S yay
安装中文输入法
sudo pacman -S fcitx-im fcitx-configtool fcitx-googlepinyin
在 ~/.xprofile 文件中, 加入以下内容(如果没有就新建)
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
fcitx
然后在命令行运行 fcitx-configtool 添加 googlepinyin 输入法, 不行的话记得重启.
ficitx-sougoupinyin 不建议使用 不稳定
更新:
sudo pacman -S fcitx5 fcitx5-chinese-addons fcitx5-gtk fcitx5-qt kcm-fcitx5 fcitx5-material-color
在 /etc/profile 添加:
export INPUT_METHOD=“fcitx5”
export XMODIFIERS="@im=fcitx5"
export GTK_IM_MODULE=“fcitx5”
export QT_IM_MODULE=“fcitx5”
图标字体网站
https://www.nerdfonts.com/cheat-sheet
WPS 安装
sudo pacman -S wps-office
sudo pacman -S ttf-wps-fonts
自动挂载 Windows10 下的 NTFS 分区
记得关掉 Windows10 的快速启动
- 安装 ntfs-3g
// 支持 读写 ntfs 分区
sudo pacman -S ntfs-3g
- 创建挂载点
mkdir -p /windows/c
mkdir -p /windows/d
mkdir -p /windows/e
- 编辑 /etc/fstab
/dev/sda3 /windows/c ntfs defaults 0 0
/dev/sdb1 /windows/d ntfs defaults 0 0
/dev/sdb2 /windows/e ntfs defaults 0 0
注: 可以使用 fdisk -l 或者 df 或者 lsblk 查看你的 windows 分区设备名
安装 python3 和 pip3
sudo pacman -S python3
sudo pacman -S python-pip
安装 cpplint
sudo pip install cpplint
在 Arch Linux 中默认安装的 cpplint 在
/usr/bin/cpplint
目录中
安装 vscode
sudo pacman -S visual-studio-code-bin
启动命令为 code
更改 i3wm 桌面颜色主题
安装 npm
sudo pacman -S npm
安装 i3-style
sudo npm install -g i3-style
i3-style 用法
应用默认主题
i3-style solarized -o ~/.config/i3/config --reload
应用 themes 下的其他主题
将 themes 下的主题文件复制到自己的指定目录,并修改为 .yaml 扩展, 然后执行
i3-style ~/.config/i3/solarized.yaml -o ~/.config/i3/config
默认 npm 安装的 i3-style themes 目录为 /usr/lib/node_modules/i3-style/themes 下
安装 oh-my-zsh
查看当前用的 shell
echo $SHELL
安装 zsh
sudo pacman -S zsh
配置 zsh
zsh
切换 zsh
修改 /etc/passwd 用户名后面的 shell 为
/bin/zsh
安装 oh-my-zsh
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
重启安装完成
参考 oh-my-zsh 配置
自己感觉好用的主题:
xiong-chiamiov
frontcube
安装 Nvidia 驱动
sudo pacman -S nvidia nvidia-utils nvidia-settings
解决画面撕裂问题
$ nano /etc/mkinitcpio.conf
----------------------------------------------------------------------
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
----------------------------------------------------------------------
$ nano /etc/default/grub # 此处必须是grub引导,其他引导自行百度
----------------------------------------------------------------------
GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia-drm.modeset=1" #此处加nvidia-drm.modeset=1参数
----------------------------------------------------------------------
$ grub-mkconfig -o /boot/grub/grub.cfg # 就算grub引导,配置文件也可能不在一个地方,请查看清楚
配置 nvidia
运行: sudo Xorg -configure
cp /root/xorg.conf.new /etc/X11/xorg.conf
修改 xorg.conf:
Section "Device"
Identifier "Card0"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
禁用 nouveau
编辑 sudo vim /etc/modprobe.d/nouveau_blacklist.conf
添加:
blacklist nouveau
options nouveau modeset=0
重启
安装配置 dwm
需要安装的软件: acpi, rofi
配置教程:配置 dwm
安装 bspwm
安装依赖
sudo pacman -S libxcb xcb-util xcb-util-wm xcb-util-keysyms
编译安装
git clone https://github.com/baskerville/bspwm.git
git clone https://github.com/baskerville/sxhkd.git
cd bspwm && make && sudo make install
cd ../sxhkd && make && sudo make install
卸载
cd bspwm && sudo make uninstall
cd ../sxhkd && sudo make uninstall
运行 bspwm
mkdir -p ~/.config/{bspwm,sxhkd}
cp /usr/local/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/
cp /usr/local/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/
chmod u+x ~/.config/bspwm/bspwmrc
将 exec bspwm 添加到 ~/.xinitrc or ~/.xprofile 最后一行 (depending on how your launch your X/Display manager). bspwmrc 会帮你启动 sxhkd.
安装 polybar
sudo pacman -S polybar
拷贝 /usr/share/doc/polybar/config 到 $XDG_CONFIG_HOME/polybar/config.
XDG_CONFIG_HOME 一般是 ~/.config
修改配置文件
[bar/mybar]
modules-right = date
[module/date]
type = internal/date
date = %Y-%m-%d%
注意:这里的 mybar 和下面的脚本中的是同一个名字
Create an executable file containing the startup logic, for example $HOME/.config/polybar/launch.sh:
#!/usr/bin/env bash
# Terminate already running bar instances
killall -q polybar
# If all your bars have ipc enabled, you can also use
# polybar-msg cmd quit
# Launch bar1 and bar2
echo "---" | tee -a /tmp/polybar1.log /tmp/polybar2.log
polybar bar1 2>&1 | tee -a /tmp/polybar1.log & disown
polybar bar2 2>&1 | tee -a /tmp/polybar2.log & disown
echo "Bars launched..."
Make sure you use the name(s) of the bar(s) from your config.
Make it executable:
$ chmod +x $HOME/.config/polybar/launch.sh
If you are using bspwm, add the following line to bspwmrc:
$HOME/.config/polybar/launch.sh
配置 polybar 主题
安装依赖
sudo pacman -S rofi python-pywal calc
yay -S networkmanager-dmenu-git
安装
git clone --depth=1 https://github.com/adi1090x/polybar-themes.git
cd polybar-themes
chmod +x setup.sh
运行 setup.sh 按照提示操作
./setup.sh
[*] Installing Polybar Themes...
[*] Choose Style -
[1] Simple
[2] Bitmap
[?] Select Option : 1
[*] Installing fonts...
[*] Creating a backup of your polybar configs...
[*] Successfully Installed.
运行
$ bash ~/.config/polybar/launch.sh
Usage : launch.sh --theme
Available Themes :
--blocks --colorblocks --cuts --docky
--forest --grayblocks --hack --material
--panels --pwidgets --shades --shapes
修改 ~/.config/bspwm/bspwmrc 在 $HOME/.config/polybar/launch.sh 后添加 主题名
例如
$HOME/.config/polybar/launch.sh --cuts