arch + i3
u 盘准备
从 下载页面 选择下好 iso 文件, 插入 u 盘
使用 dd 命令刻录
dd if=boot.img of=/dev/sdx bs=4M
进入 live 环境
联网
dhcpcd
判断网络连接是否正常:
ping www.baidu.com
分区
建两个分区, 一个 300 M 大小的 EFI 分区,格式是 Fat32, 用于挂载 /boot, 一个 格式 ext4 ,用于挂载根目录
fdisk -l
fdisk -l /dev/sdb
d
d
n
+300M
t
1
n
格式化
mkfs.fat -F32 /dev/sdb1
mkfs.ext4 /dev/sdb2
挂载
mount /dev/sdb2 /mnt
mkdir /mnt/boot
mount /dev/sdb1 /mnt/boot
设置镜像源
vim /etc/pacman.d/mirrorlist
# 在 china 下
Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch
sudo vim /etc/pacman.conf
[archlinuxcn]
SigLevel = Optional TrustedOnly
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
密钥
# 下载密钥链
sudo pacman -S archlinuxcn-keyring
# 更新密钥
sudo pacman-key --refresh-keys
# 重新加载相应的签名密钥
sudo pacman-key --init
sudo pacman-key --populate
# 清除pacman 的缓冲文件
sudo pacman -Scc
# 更新系统
sudo pacman -Syu
安装基本包
pacstrap /mnt base base-devel linux linux-firmware dhcpcd
生成挂载表
genfstab -L /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
切换系统
arch-chroot /mnt
设置时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
提前安装必须软件包
pacman -S vim dialog wpa_supplicant ntfs-3g networkmanager
本地化
vim /etc/locale.gen
zh_CN.UTF-8 UTF-8
zh_HK.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8
en_US.UTF-8 UTF-8
locale-gen
vim /etc/locale.conf
LANG=en_US.UTF-8
设置系统为中文
vim $HOME/.xinitrc
# 在 exrc i3 前
export LC_ALL=zh_CN.UTF-8
设置主机名
vim /etc/hostname
ENIAC
配置 hosts
vim /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 ENIAC.localdomain ENIAC
设置 Root 密码
passwd
启用微码更新
pacman -S intel-ucode
sudo grub-mkconfig -o /boot/grub/grub.cfg
安装Bootloader
pacman -S os-prober ntfs-3g
pacman -S grub efibootmgr
grub-install --efi-directory=/boot --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg
重启
exit
umount /mnt/boot
umount /mnt
reboot
连接网络
dhcpcd
更新系统
sudo pacman -Syu
更新系统时间
timedatectl set-ntp true
timedatectl status
新建用户
useradd -m -G wheel edte
passwd edte
设置用户权限
pacman -S sudo
vim /etc/sudoers
%wheel ALL=(ALL)ALL
安装显卡驱动
pacman -S nvidia
安装显示服务
sudo pacman -S xorg xorg-xinit xorg-server xorg-apps
安装窗口管理器
pacman -S i3-gaps
启动窗口管理器
echo exec i3 >> ~/.xinitrc
# 自动登录
vim ~/.bash_profile
if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fi
# 手动登录
startx
# 注意,这里有个坑,不要使用 root 用户登录,sudo startx 也不行
# 否则进入之后一些软件是不支持使用的
i3 配置
# 键 - 意义
# $mod - win
# $alt - alt
# $ctrl - Ctrl
# Escape - ESC
# Return - return
# Space - space
# Shift - Shift
#
#
# 程序启动时加载
# exec or exec_always
# 主键
set $mod Mod4
set $alt Mod1
set $ctrl Control
# 关闭焦点所在程序
bindsym $alt+Escape kill
# 移动程序
bindsym $mod+h move left
bindsym $mod+j move down
bindsym $mod+k move up
bindsym $mod+l move right
# 改变浮动状态
bindsym $mod+space floating toggle
# 去除i3的标题栏
new_window none
new_float normal
hide_edge_borders both
# 重启 i3
bindsym $mod+Shift+e exit
# 终端
bindsym $mod+Return exec i3-sensible-terminal
# 浏览器
bindsym $mod+p exec chromium
# rofi 配置
# rofi 是一款程序启动器
# 可以启动程序和更换程序
bindsym $mod+i exec rofi -show window
bindsym $mod+o exec rofi -show run
# 壁纸设置
# --bg-fill 是设置大小,自动填充满屏幕
# --randomize 是随机,下面表示随机播放壁纸
exec feh --randomize --bg-fill ~/pictures
# 设置一张壁纸
#exec feh --bg-fill /home/edte/Downloads/b65735e8ba5f0dd3f89aaf3cd8cd6be9_720w.jpg
# 设置透明化
exec_always compton -b
# 设置文件管理器
bindsym $mod+e exec thunar
# markdown 编辑器
bindsym $mod+u exec typora
# 全屏/取消全屏
bindsym $mod+Escape fullscreen toggle
# 配置工作区
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# 切换工作区
bindsym $alt+Tab workspace next
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# 将焦点所在程序移动到对应工作区
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
安装中文字体
pacman -S wqy-microhei wqy-zenhei ttf-dejavu
终端模拟器
pacman -S konsole
vim $HOME/.config/i3/config
# 终端
bindsym $mod+Return exec i3-sensible-terminal
程序启动器
pacman -S rofi
# 生成配置列表
# rofi 配置
# rofi 是一款程序启动器
# 可以启动程序和更换程序
vim $HOME/.config/i3/config
bindsym $mod+z exec rofi -show window
bindsym $mod+d exec rofi -show drun
窗口透明工具
pacman -S compton
vim $HOME/.config/i3/config
exec_always compton -b
安装状态栏
# polybar 是一个状态栏工具
# polybar 的配置文件在 $HOME/.config/polybar
# 此目录下有两个文件,一个 launch.sh 用于启动 polybar
# 一个 config 文件是配置文件
# 安装 polybar
yay -S polybar-git
# 配置
install -Dm644 /usr/share/doc/polybar/config $HOME/.config/polybar/config
# 配置安装脚本
vim ~/.config/polybar/launch.sh
# 输入
killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
polybar example
# 给权限
chmod + ~/.config/polybar/launch.sh
# 配置状态栏
vim vim ~/.config/polybar/config
输入
https://github.com/Kuari/i3-wm-config/blob/master/.config/polybar/config
# 开机自动启动
vim $HOME/.config/i3/config
exec . ~/.config/polybar/launch.sh
联网管理
systemctl enable dhcpcd
壁纸设置
pacman -S feh
vim $HOME/.config/i3/config
# 壁纸设置
# --bg-fill 是设置大小,自动填充满屏幕
# --randomize 是随机,下面表示随机播放壁纸
exec feh --randomize --bg-fill ~/picture
# 设置一张壁纸
exec feh --bg-fill ~/image.file
输入法
# 安装
sudo pacman -S fcitx fcitx-qt5 kcm-fcitx fcitx-cloudpinyin fcitx-libpinyin fcitx-configtool
# 配置文件
sudo vim $HOME/.xinitrc
# 在 exrc i3 上方输入
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
fcitx
# 重启
reboot
# 配置
输入法,云拼音,壁纸,字典,剪切班,快捷键
安装浏览器
pacman -S chromium
vim $HOME/.config/i3/config
bindsym $mod+q exec chromium
shell 配置
pacman -S zsh
# 安装 oh-my-zsh
sudo git clone https://github.com/ohmyzsh/ohmyzsh.git
cd /ohmyzsh/tools
./install.sh
# 安装插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/skywind3000/z.lua.git ~/.oh-my-zsh/plugins/z.lua
git clone https://github.com/paulirish/git-open.git $ZSH_CUSTOM/plugins/git-open
sudo pacman -S lua
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
sudo pacman -S thefuck
# 配置
sudo vim ~/.zshrc
# 输入
export ZSH="/home/edte/.oh-my-zsh"
ZSH_THEME="ys"
# plugins
plugins=(
zsh-history-substring-search
# 双击 ESC 使用 sudo 命令执行上一命令
sudo
git
web-search
# 使用 x 解压
extract
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
eval "$(lua /home/edte/.oh-my-zsh/plugins/z.lua/z.lua --init zsh)"
eval $(thefuck --alias)
# 生效
source ~/.zshrc
# 登录时自动启动 x 窗口
sudo vim ~/.zprofile
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fi
文件管理器
pacman -S thunar
vim $HOME/.config/i3/config
bindsym $mod+e exec thunar
git
sudo pacman -S git
# 配置 github
git config --global user.name "edte"
git config --global user.email "zzzzip6@gmail.com"
# 安装 keygen
sudo pacman -S openssh
ssh-keygen -t rsa -C "zzzzip6@gmail.com"
cat $HOME/.ssh/id_rsa.pub
go 语言开发环境
sudo pacman -S go jdk goland
c 语言开发环境
sudo pacman -S cmake clion
简洁的帮助文档
sudo pacman -S tldr
markdown 编辑器
sudo pacman -S typora
vim $HOME/.config/i3/config
bindsym $mod+1 exec typora
vim
sudo pacman -S vim
git clone https://github.com/spf13/spf13-vim.git
cd spf13-vim
./bootstrap.sh