换源

一键换源

1
sudo pacman-mirrors -c China

AUR package 安装

yay 工具

  • 使用 yay 工具
  • 安装

    1
    
    sudo pacman -Syu yay
  • 调用

    • 接口类似 pacman
    • 搜索

      1
      
      yay -Ss emacs
  • 注意

    • 不要使用 sudo 或者 root 用户调用 yay
    • 当前调用就可以

自动 sudo

  • –sudoloop

make 命令传参

  • 使用 MAKEFLAGS 环境变量

    1
    
    MAKEFLAGS="-j8" yay -Syu mypckage

yay 生成包

  • 包名

    • ~/.cache/yay/package/package_name-version-architecture.pkg.tar.zst
  • 手动安装

    1
    
    sudo pacman -U package_name-version-architecture.pkg.tar.zst

更改 PKGBUILD

参考:

1
2
3
yay -G <package_name>
edit the PKGBUILD
makepkg -si

手动安装 AUR

  1. clone 对应包的 repo

  2. cd repo dir
  3. 设置并行,安装

    • PKGDEST=~/opt/aur-packages MAKEFLAGS="-j8" makepkg -si
    • PKGDEST 是安装目录

      • 可以通过 /etc/makepkg.conf 修改

wsl arch 初始化

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
# 1. 修改 /etc/pacman.d/mirrors 换成 aliyun
# 2. 更新 keyring
su root
pacman-key --init
pacman-key --populate
pacman-key --refresh-keys
pacman -Sy archlinux-keyring

# 3. 全局更新
pacman -Syyuu --noconfirm

# 4. 安装 git, ssh
pacman -Syu git openssh zsh python lsb-release vim emacs-nativecomp

# not remove fakeroot-tcp
pacman -S --needed git base-devel

# 5. 修改 ~/.ssh 权限
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
#  ----- 注意删除老文件
rm ~/.ssh/known_hosts

# 6. dotfiles 配置
# 参见: https://gitee.com/kongmingxuan/dotfiles
git clone --recursive git@gitee.com:kongmingxuan/dotfiles.git
mv ~/.config ~/.config.bak
mv dotfiles ~/.config

# 7. 安装依赖
~/.config/zsh/deps/install.sh


# 8. 配置 zsh
sudo tee -a /etc/zsh/zshenv > /dev/null << 'EOF'
if [[ -z "$XDG_CONFIG_HOME" ]]
then
        export XDG_CONFIG_HOME="$HOME/.config/"
fi

if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
then
        export ZDOTDIR="$XDG_CONFIG_HOME/zsh/"
fi
EOF

# 9. 切换 shell
chsh -s /usr/bin/zsh

# 10. emacs
[ -f ~/.emacs ] && mv ~/.emacs ~/.emacs.bak
[ -d ~/.emacs.d ] && mv ~/.emacs.d ~/.emacs.default
git clone https://github.com/plexus/chemacs2.git ~/.emacs.d

tee ~/.emacs-profiles.el  > /dev/null << EOF

(


 ("default"  .  ((user-emacs-directory . "~/.emacs.d.default")))
 ("emacs"  .  ((user-emacs-directory . "~/.emacs.d.default")))
 ("lazycat" . ((user-emacs-directory . "~/.emacs.d.lazycat")))

 ("spacemacs" . ((user-emacs-directory . "~/.emacs.d.spacemacs")
                 (env . (("SPACEMACSDIR" . "~/.emacs.d.spacemacs")))
                 ))



 ("doom" . ((user-emacs-directory . "~/.emacs.d.doom")
            (server-name . "doom")
            (env . (("DOOMDIR" . "~/.doom.d")))
            ))

 ("vanila" . ((user-emacs-directory . "~/.emacs.d.vanila")
              (server-name . "doom")
              (env . (("DOOMDIR" . "~/.vanila")))
              ))
 ("evil" . ((user-emacs-directory . "~/.emacs.d.evil")
            (server-name . "doom")
            (env . (("DOOMDIR" . "~/.evil.d")))
            ))
 ("clean" . ((user-emacs-directory . "~/.emacs.d.clean")
	     ))
 )

EOF

mkdir -p ~/.emacs.d.clean
tee ~/.emacs.d.clean/init.el > /dev/null << EOF
(load-file "~/.conf.d/init-clean.el")
EOF
# start install
emacs --with-profile clean

# 11. eaf
# start bash
[ ! -f ~/miniconda3/envs/eaf/bin/python ]  && conda create -n eaf python=3.10 -y
conda activate eaf

mkdir -p ~/programs
cd ~/programs
git clone --depth=1 -b master https://github.com/emacs-eaf/emacs-application-framework.git eaf
# start install
cd eaf && python ./install-eaf.py --use-gitee --install-all-apps --force --app-drop-local-edit

注意:

  1. 设置好 proxy, 避免 git 卡住

    1
    2
    
    export https_proxy="http://localhost:port"
    export http_proxy=$https_proxy

如何设置 emoji 字体

参考:

方法:修改 ~/.config/fontconfig/fonts.conf 文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <alias>
   <family>sans-serif</family>
   <prefer>
     <family>Noto Sans</family>
     <family>Twemoji</family>
     <family>Noto Color Emoji</family>
     <family>Noto Emoji</family>
   </prefer> 
 </alias>

 <alias>
   <family>serif</family>
   <prefer>
     <family>Noto Serif</family>
     <family>Twemoji</family>
     <family>Noto Color Emoji</family>
     <family>Noto Emoji</family>
   </prefer>
 </alias>

 <alias>
  <family>monospace</family>
  <prefer>
    <family>Noto Mono</family>
    <family>Twemoji</family>
    <family>Noto Color Emoji</family>
    <family>Noto Emoji</family>
   </prefer>
 </alias>
</fontconfig>

wechat 微信安装

可用安装方法:

  1. 2023.12.30

    • wechat-uos
    • yay -S wechat-uos electron19-bin --sudoloop

cad

  1. gstarcad 浩辰 CAD 2024 linux 试用版

禁用睡眠 disable auto suspend

参考:

方法:

  1. 修改配置 /etc/systemd/sleep.conf.d/disable-suspend.conf 或者 /etc/systemd/sleep.conf

    • 禁用睡眠
    1
    2
    3
    4
    5
    
    [Sleep]
    AllowSuspend=no
    AllowHibernation=no
    AllowSuspendThenHibernate=no
    AllowHybridSleep=no
    • 启用睡眠

      1
      2
      3
      4
      5
      6
      7
      8
      9
      
      [Sleep]
      AllowSuspend=yes
      AllowHibernation=yes
      AllowSuspendThenHibernate=yes
      AllowHybridSleep=yes
      SuspendState=mem standby freeze
      HibernateMode=platform shutdown
      HibernateDelaySec=
      SuspendEstimationSec=60min

防火墙 firewall

工具:

  • firewalld

    • 命令行: firewall-cmd
    • GUI: firewall-config
1
2
sudo firewall-cmd --permanent --add-port=3389/tcp
sudo firewall-cmd --reload