neofetch

准备工作

  1. windows 上使用的分区上分出空闲硬盘空间给 archlinux
  2. 下载archlinux镜像
  3. 启动u盘 ventoy
  4. 关闭windows 快速启动,BIOS 安全启动

安装配置网络

  iwctl # 进入交互式命令行

  device list # 列出无线网卡设备名

  # 查看你的网卡名字,这里假设是wlan0,输入

  station wlan0 scan
  # 检查扫描网络,输入

  station wlan0 get-networks
  #查看网络名字,假设名字叫CMCC-D39U,输入

  station wlan0 connect BUPT-D39u
  # 接着输入密码(如果有密码的话),输入
  # 连接成功后退出
  exit

测试网络

  ping www.bilibili.com
  # 有数据返回就说明链接上网络 

更新系统时间

 timedatectl set-ntp true # 将系统时间与网络时间进行同步
 timedatectl status # 检查服务状态

更换国内源

  vim /etc/pacman.d/mirrorlist
  # 中国科学技术大学开源镜像站 插入文件最前面
  Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch 

分区

 lsblk # 检查硬盘
 cfdisk /dev/nvme0n1 #建立分区
 # cfdisk /dev/ 硬盘空间名
 # 找到 Free space 选择 New
 # 输入内存大小
 # 选择Write
 lsblk # 检查是否写入
 # 格式化 
 mkfs.ext4 /dev/nvme0n1p5 # nvme0n1p5是分区号
 # 挂载分区
 mount /dev/nvme0n1p5 /mnt
 mkdir /mnt/boot
 lsblk #查看windows的EFI分区号
 # 挂载EFI分区 nvme0n1p2是分区号
 mount /dev/nvme0n1p2 /mnt/boot

安装系统

pacman -Sy archlinux-keyring
pacstrap /mnt base base-devel linux linux-firmware btrfs-progs

生成fastb文件

 genfstab -U /mnt >> /mnt/etc/fstab
 # 查看是否生成
 cat /mnt/etc/fstab

切换装好的系统

 arch-chroot /mnt

创建swapfile

  # 这里分了2G作为swapfile
  dd if=/dev/zero of=/swapfile bs=2048 count=1048576 status=progress
  # 更改权限
  chmod 600 /swapfile 
  # 建立激活swap
  mkswap /swapfile
  swapon /swapfile
  # 修改fstab文件
  vim /etc/fstab
  # 写入 /swapfile none swap defaults 0 0

时区和硬件时钟

  timedatectl set-timezone Asia/Shanghai
  hwclock --systohc

Locale

Locale 决定了软件使用的语言、书写习惯和字符集。

  vim /etc/locale.gen
  # 去掉 en_US.UTF-8 UTF-8 以及 zh_CN.UTF-8 UTF-8 行前的注释符号
  locale-gen #生成
  echo 'LANG=en_US.UTF-8'  > /etc/locale.conf # 写入

host

# 创建并写入hostname
vim /etc/hostname
# 写入 arch, 可随便起
# 修改host
# 写入下面的内容
127.0.0.1    localhost
::1          localhost
127.0.1.1    arch.localdomain  arch
# arch是上面的hostname 空白是 tab

设置root用户密码

 passwd root

驱动器 grub

 # 安装基本包
 pacman -S grub efibootmgr networkmanager network-manager-applet dialog wireless_tools wpa_supplicant os-prober mtools dosfstools ntfs-3g base-devel linux-headers reflector git sudo
 # interl解码
 pacman -S intel-ucode

启用os-prober识别Windows

vim /etc/default/grub
# 写入 GRUB_DISABLE_OS_PROBER=false
# 安装 GRUB 到 EFI 分区
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch

生成 grub.cfg

grub-mkconfig -o /boot/grub/grub.cfg

完成安装

exit # 退回安装环境
umount -a # 卸载分区
reboot # 重启拔u盘

设置网络

进去输入root加密码
启动网络服务

systemctl enable --now NetworkManager
nmtui

新建用户

  # 用户
  useradd -m -G wheel fantasy
  # 密码
  passwd mir
  #授权
  EDITOR=vim visudo
  # 去掉 #%wheel ALL=(ALL) ALL 的注释

添加archlinuxcn源

vim /etc/pacman.conf
# 去掉multilib源的注释
# 最下面加入
[archlinuxcn]
Server = https://mirrors.bfsu.edu.cn/archlinuxcn/$arch
# 更新一下
pacman -Syu && pacman -S archlinuxcn-keyring
# 安装yay
sudo pacman -S yay

中文字体

pacman -S ttf-sarasa-gothic noto-fonts-cjk
## 其他好看的字体
yay -S nerd-fonts-jetbrains-mono
yay -S ttf-material-design-icons
yay -S ttf-joypixels
yay -S ttf-dejavu

驱动

# Intel 核芯显卡 
sudo pacman -S mesa lib32-mesa vulkan-intel lib32-vulkan-intel

音频和蓝牙

sudo pacman -S pipewire-pulse
sudo pacman -S pavucontrol
sudo pacman -S bluez bluez-utils bluedevil # bluedevil 为gui蓝牙管理
pactl load-module module-bluetooth-discover

sudo vim /etc/bluetooth/main.conf
FastConnectable=true
AutoEnable=true

修复本机小新pro14,内置键盘和声音

  #声音
  pacman -S sof-firmware  alsa-ucm-conf
  # 键盘
  vim /etc/default/grub
  # GRUB_CMDLINE_LINUX_DEFAULT 加入 i8042.dumbkbd

屏幕亮度

 yay -S light 
 sudo usermod -a -G video "用户名"

安装dwm和基本软件

  yay -S xorg picom neovim feh redshift-gtk rofi thunar flameshot xautolock i3lock-color wmname
 # 克隆fork-b站大佬配置的dwm
 git clone https://gitee.com/fantasy06/dotfiles.git
 cd ~/dotfiles
 # 配置文件创建软连接
ln -s ~/dotfiles/dwm ~/.config/
ln -s ~/dotfiles/st ~/.config/
ln -s ~/dotfiles/nvim ~/.config/
ln -s ~/dotfiles/wallpaper ~/Pictures/
ln -s ~/dotfiles/scripts ~/
ln -s ~/dotfiles/.xinitrc ~/
ln -s ~/dotfiles/.Xresources ~/
ln -s ~/dotfiles/.profile ~/
cd ~/.config/st && sudo make install clean
cd ~/.config/dwm && sudo make install clean
startx # 进入系统

zsh 安装配置

sudo pacman -Sy zsh
# 主题和插件
sudo pacman -S zsh-autosuggestions zsh-syntax-highlighting zsh-theme-powerlevel10k zsh-completions
chsh -s /usr/bin/zsh #改默认
# 软连接配置文件
ln -s ~/dotfiles/.zshrc ~/
ln -s ~/dotfiles/.p10k.zsh ~/

中文输入法

sudo pacman -S fcitx5 fcitx5-qt fcitx5-gtk fcitx5-config-qt fcitx5-material-color fcitx5-im fcitx5-rime
sudo echo '
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
SDL_IM_MODULE=fcitx
GLFW_IM_MODULE=ibus' >> /etc/environment

触控板

yay -S xf86-input-synaptics      # 触控板
sudo pacman -S wmctrl xdotool libinput-gestures # 手势
sudo gpasswd -a $USER input  # 权限

sudo vim /etc/X11/xorg.conf.d/30-touchpad.conf
# 写入
Section "InputClass"
    Identifier "touchpad"
    Driver "libinput"
    MatchIsTouchpad "on"
    Option "Tapping" "on"
    Option "TappingButtonMap" "lrm"
EndSection

# 手势
cp /etc/libinput-gestures.conf ~/.config/libinput-gestures.conf
# 写入
vim ~/.config/libinput-gestures.conf

gesture swipe left  4 xdotool key  Super+Shift+Tab
gesture swipe right 4 xdotool key  Super+Tab
gesture swipe up    4 xdotool key  Super+f
gesture swipe down  4 xdotool key  Super+a
gesture swipe left  3 xdotool key  Super+Left
gesture swipe right 3 xdotool key  Super+Right
gesture swipe up    3 xdotool key  Super+Up
gesture swipe down  3 xdotool key  Super+h

自动锁屏

sudo vim /etc/X11/xorg.conf.d/10-monitor.conf
# 写入
Section "ServerLayout"
    Identifier "ServerLayout0"
    Option "BlankTime"  "10"    # 自动锁屏
    Option "StandbyTime" "20"   # 关闭屏幕
    Option "SuspendTime" "30"   # 挂起
    Option "OffTime" "60"       # 关机
EndSection

日常软件

yay -S lxappearance              # gui设置
yay -S paper-gtk-theme-git       # gtk主题
yay -S pavucontrol               # 音频设置
yay -S breeze-icons              # 图标
yay -S rofi                      # 菜单
yay -S flameshot                 # 截图软件
yay -S google-chrome wyeb-git    # 浏览器             
yay -S byzanz                    # gif截图依赖
yay -S libnotify dunst           # 通知
yay -S xorg-xsetroot             # dwm设置状态栏
yay -S xf86-input-synaptics      # 触控板
yay -S network-manager-applet    # 网络托盘
yay -S mpc mpd ncmpcpp           # tui music player
yay -S picgo-appimage            # picgo 图床
yay -S xmind                     # xmind 思维导图
yay -S deepin-wine-wechat        # 微信
yay -S dingtalk-bin              # 钉钉
yay -S wps-office-cn wps-office-mui-zh-cn ttf-wps-fonts # wps
# deepin-wine 环境设置
/opt/apps/com.qq.weixin.deepin/files/run.sh -d
# 在切换到deepin-wine环境后,在terminal输入下面的指令:
env WINEPREFIX="$HOME/.deepinwine/Deepin-WeChat" /usr/bin/deepin-wine winecfg
# =========
yay -S linuxqq                  #linuxqq
yay -S yesplaymusic             # 第三方网易云
yay -S qqmusic-bin              # qq音乐
yay -S baidunetdisk-bin         # 百度云盘
yay -S clash clash-for-windows-bin
yay -S copyq                    # 剪切板管理
yay -S atril                    # pdf阅读
yay -S gimp                     # 修图软件

编程开发

sudo pacman -S nodejs      # 安装node.js和npm
sudo pacman -S npm
sudo pacman -S php         # php
yay -S jdk                 # jdk

sudo pacman -S mysql       # mysql
#初始化mysql,输出最后一行是默认密码 .cPq!bUt.5g%
sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
# 启动
sudo systemctl start mysqld.service
# 进去
mysql -uroot -p
# 修改登录密码
alter  user 'root'@'localhost' identified  by '123456';
# 打开mysql数据
use mysql;
# 给用户加权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
#开机启动
sudo systemctl enable mysqld.service

yay -S navicat16-premium-cs           # navicat16
yay -S visual-studio-code-bin         # vscode
yay -S wechat-devtools-bin            # 微信开发者工具
yay -S intellij-idea-ultimate-edition # idea

修复键盘f区问题

在Linux上,Keychon K2不会将任何F1-F12功能键映射为实际的F键
而是默认将它们视为多媒体键。 Fn+F1-12的组合也不会起作用

  1. 键盘切换到window模式
  2. 长按Fn + X + L将F1-F12优先映射到功能键而不是媒体键
    写入
echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode
echo "options hid_apple fnmode=0" | sudo tee -a /etc/modprobe.d/hid_apple.conf
mkinitcpio -p

参考来源连接
安装
安装
dwm
键盘