通用环境配置
通用环境配置
安装软件
- 更换 apt 源 后执行
sudo apt update && sudo apt upgrade -y
- 安装 Miniconda 后执行
conda init
相关操作并重启终端 - 更换 conda 源
- 执行
conda config --set show_channel_urls yes
- 编辑
~/.condarc
- 执行
conda clean -i
- 执行
- 更换 pip 源
安装和配置 zsh
安装 zsh
安装 zsh
1
sudo apt install zsh
验证安装
1
zsh --version
将 zsh 设置为默认 shell
1
sudo chsh -s $(which zsh)
- 重新登陆终端
验证配置结果
1
echo $SHELL
配置 zsh
安装 oh-my-zsh
1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
配置
~/.zshrc
1 2 3 4 5 6 7 8 9
alias ll="ls -al" alias tozshplugins="cd ${ZSH_CUSTOM}/plugins" host_ip=$(ifconfig | grep "inet " | grep -v "127.0.0.1" | grep -v "inet.*-->" | awk "{print $2}") echo "Host IP: ${host_ip}" export http_proxy="http://${host_ip}:10808" export https_proxy="http://${host_ip}:10808" git config --global http.proxy ${http_proxy} git config --global https.proxy ${https_proxy}
- 安装 zsh-autosuggestions
- 安装 zsh-syntax-highlighting
配置 Git
1
2
3
4
5
git config --global user.name "<Name>"
git config --global user.email "<Email>"
git config --global core.editor "vim"
git config --global credential.helper store
git config --global init.defaultBranch main
对于通过 VSCode 连接的服务器,配置:git config --global core.editor "code --wait"
配置代理
WSL2
在 ~/.bashrc
中添加:
1
2
3
4
5
6
7
8
# System proxy
export host_ip=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
export http_proxy="http://${host_ip}:10811"
export https_proxy="http://${host_ip}:10811"
# Git proxy
git config --global http.proxy ${http_proxy}
git config --global https.proxy ${https_proxy}
This post is licensed under CC BY 4.0 by the author.