Wsl 开发环境配置

Apt换源

切换清华源

sudo sed -i "s@http://.*archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
sudo sed -i "s@http://.*security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
sudo apt update -y
sudo apt upgrade -y

Git

sudo apt install git
git config --global user.name "zhangsan"
git config --global user.email "[email protected]"
ssh-keygen -t rsa -C "[email protected]"

zsh

sudo apt install zsh

oh my zsh!

安装

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 输入y
# 输入密码

安装插件

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

修改主题

编辑 ~/.zshrc

# 分别找到这两行代码
ZSH_THEME="robbyrussell"
plugins=(git)

# 分别替换成下面的
## 自定义随机主题
THEMES=(darkblood bira duellj fino-time fox gnzh xiong-chiamiov-plus jonathan random)
## zsh中读取数组是从一开始算
ZSH_THEME=${THEMES[$((1 + ($RANDOM % ${#THEMES[*]})))]}

plugins=(git z zsh-syntax-highlighting zsh-autosuggestions)

wq保存后

source .zshrc

Pyenv

安装

curl https://pyenv.run | bash

git可能访问失败,可以配置代理

export ALL_PROXY="socks5://127.0.0.1:1080"
export all_proxy="socks5://127.0.0.1:1080"

系统代理设置

unset ALL_PROXY
unset all_proxy

系统代理取消

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

git代理设置

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

git代理取消

git config --global --unset http.proxy
git config --global --unset https.proxy

配置环境

编辑~/.zprofile~/.zshrc,添加

export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

eval "$(pyenv virtualenv-init -)"

安装编译环境

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils liblzma-dev tk-dev

安装指定版本python

pyenv install 3.8.16

设置默认python环境

pyenv global 3.8.16

删除python环境

pyenv uninstall 3.8.16

创建虚拟环境

pyenv virtualenv 3.8.16 my_env

查看虚拟环境

pyenv virtualenvs

激活虚拟环境

pyenv activate my_env

Node

通过nvm安装node

# 下载安装nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# 安装node
nvm install v16.17.0
# 设置默认
nvm alias default v16.17.0

你可能感兴趣的:(Linux,git,github,linux)