配置Linux

  1. 在配置好环境前, 务必使用ssh登入系统, 而不要直接使用桌面环境. 桌面环境无法复制粘贴很抓狂

  2. 打开一个tmux的session, 专门用于在服务器上开启clash.

    1
    2
    3
    
    tn clash-server && ta
    ssh user@server
    ./clash-path -f config-file-path
    
  3. 通过sh进入服务器, 并设置代理

    1
    
    export "http_proxy=http://127.0.0.1:7890"; export "https_proxy=http://127.0.0.1:7890"; export "all_proxy=socks5://127.0.0.1:7891"
    
  4. 编辑~/.zshenv

    1
    2
    3
    4
    5
    6
    
    export XDG_CONFIG_HOME="$HOME/.config"
    export XDG_CACHE_HOME="$HOME/.cache"
    export XDG_DATA_HOME="$HOME/.local/share"
    export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
    export HTTP_PORT=7890
    export SOCKS_PORT=7891
    
  5. 拷贝 zshrc

    1
    2
    3
    
    ZDOTDIR="$HOME/.config/zsh"
    git clone https://www.github.com/baohengtao/zshrc.git $ZDOTDIR/main
    echo 'source  "$ZDOTDIR/main/init.zsh" ' >> $ZDOTDIR/.zshrc
    
  6. 安装Node

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    
    # zshenv
    export NODE_MIRROR=https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/
    export N_PREFIX="$HOME/.local/n"
    export MYPATH="$MYPATH:$HOME/.local/n/bin"
    export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
    export MYPATH="$MYPATH:$HOME/.local/yarn/bin"
    
    # install
    curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
    bash n stable
    npm install --global yarn
    yarn config set global-folder ~/.local/yarn
    yarn config set dir ~/.local/yarn
    yarn config set prefix ~/.local/yarn
    yarn global add neovim # 添加对 neovim 的支持
    
  7. 安装neovim

    1
    2
    3
    4
    5
    6
    7
    8
    
    pip3 install pynvim
    
    gh repo clone baohengtao/vim.d $XDG_CONFIG_HOME/nvim
    sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
           https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
    curl -fLo $XDG_CONFIG_HOME/nvim/autoload/plug.vim --create-dirs \
        https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    cd && ln $XDG_CONFIG_HOME/nvim/init.vim .vimrc
    
  8. 安装tmux

    1
    2
    3
    4
    
    git clone [email protected]:baohengtao/tmux $XDG_CONFIG_HOME/tmux
    git clone https://github.com/tmux-plugins/tpm $XDG_CONFIG_HOME/tmux/plugins/tpm
    # if XDG based config not supported
    ln -f ~/.config/tmux/tmux.conf .tmux.conf
    
  9. 配置 SSH

    1
    2
    3
    
     ssh-keygen ...
     ...set server on ~/.ssh/config...
     cat ~/.ssh/id_rsa_arch.pub | ssh $SERVER "cat >> ./.ssh/authorized_keys"
    
updatedupdated2023-06-052023-06-05
Update https-ca.md