0. 环境介绍

  • 主系统:Windows 10
  • 子系统:Ubuntu
  • 进入子系统:wsl –install -d Ubuntu

1. 配置代理

前置条件:主系统代理支持 http 模式

配置步骤:

1.windows 运行输入:\wsl$,打开ubuntu文件夹,找到.bashrc文件。

2.用记事本打开.bashrc文件,并在随后添加:export ALL_PROXY=”http://[宿主ip]:[代理端口号]”

3.ubuntu终端输入:source ~/.bashrc

测试验证:curl https://google.com.hk

2. 配置 Jekyll 开发环境支持

前置条件:正确安装 Ruby 环境,参考Install Ruby On Rails on Windows 10

利用 asdf 配置开发环境

1
2
3
4
5
6
7
git clone https://github.com/excid3/asdf.git ~/.asdf
cd ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
echo 'export EDITOR="code --wait"' >> ~/.bashrc
exec $SHELL

安装 ruby 与 nodejs

1
2
asdf plugin add ruby
asdf plugin add nodejs
1
2
3
4
5
asdf install ruby 3.2.2
asdf global ruby 3.2.2

# Update to the latest Rubygems version
gem update --system
1
2
3
4
5
6
7
8
9
10
asdf install nodejs 18.15.0
asdf global nodejs 18.15.0

which node
#=> /home/username/.asdf/shims/node
node -v
#=> 18.15.0

# Install yarn for Rails jsbundling/cssbundling or webpacker
npm install -g yarn