安装WSL Ubuntu18.04 Linux
- 开启linux子系统 -> 重启
- 在应用商店 安装Ubuntu18.04
- 打开Ubuntu命令行 等待安装
- 输入用户名/密码
切换登陆用户名位root
- 打开powershell 输入
ubuntu1804.exe config --default-user root
换成清华源 vim /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
升级配置系统
apt update
apt upgrade -y
# 安装zsh html tidy
apt install tmux python3-pip ruby tidy zsh -y
pip3 install pynvim neovim
pip3 install pycodestyle pyflakes flake8 vim-vint proselint yamllint
安装配置SSH-SERVER
# 安装ssh-server
apt install -y openssh-server
# 配置WSL sshd
# 修改配置文件 vim /etc/ssh/sshd_config
# 开启密码认证
PasswordAuthentication yes
# 开启密钥认证
PubkeyAuthentication yes
# 允许root登陆
PermitRootLogin yes
# 启动ssh
service ssh start
# 开启激动ssh
systemctl enable ssh
# 如果报以下异常,执行下面命令
# * Restarting OpenBSD Secure Shell server sshd
# Could not load host key: /etc/ssh/ssh_host_rsa_key
# Could not load host key: /etc/ssh/ssh_host_ecdsa_key
# Could not load host key: /etc/ssh/ssh_host_ed25519_key
# 配置 openssh-server
dpkg-reconfigure openssh-server
安装依赖
# 使用代理 连接github脚本,可以使用代理加快速度
# export https_proxy=127.0.0.1:1080
# 安装omyzsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 安装fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
# 安装go
cd /opt
wget https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz
tar zxf go1.13.5.linux-amd64.tar.gz
# 创建软连接
ln -sf /opt/go/bin/go /usr/bin/go
ln -sf /opt/go/bin/gofmt /usr/bin/gofmt
# https://github.com/neovim/neovim/releases
cd /opt/
wget https://github.com/neovim/neovim/releases/download/v0.4.3/nvim-linux64.tar.gz
# 解压
tar zxf nvim-linux64.tar.gz
# 创建软连接
ln -sf /opt/nvim-linux64/bin/nvim /usr/bin/nvim
可选安装
go get -u golang.org/x/tools/cmd/goimports
go get -u golang.org/x/tools/cmd/gorename
go get -u golang.org/x/tools/cmd/guru
go get -u github.com/sqs/goreturns
go get -u github.com/alecthomas/gometalinter
go get -u github.com/mgechev/revive
go get -u github.com/zmb3/gogetdoc
go get -u github.com/zmb3/goaddimport
go get -u github.com/rogpeppe/godef
go get -u github.com/fatih/gomodifytags
go get -u github.com/tpng/gopkgs
go get -u github.com/ramya-rao-a/go-outline
go get -u github.com/stamblerre/gocode
go get -u golang.org/x/lint/golint
go get -u github.com/golang/lint/golint
go get -u github.com/kisielk/errcheck
go get -u github.com/jstemmer/gotags
go get -u github.com/klauspost/asmfmt/cmd/asmfmt
go get -u github.com/fatih/motion
go get -u github.com/josharian/impl
go get -u github.com/dominikh/go-tools/cmd/keyify
go get -u github.com/Go-zh/tools/cmd/gopls
# 安装 https://github.com/golangci/golangci-lint
# 方式一:
# go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
# 方式二(二进制安装推荐):
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.21.0
安装配置NeoVim
# https://github.com/PegasusWang/vim-config
# mkdir ~/.config
git clone git://github.com/rafi/vim-config.git ~/.config/nvim
cd ~/.config/nvim
make test
make
nvim -c checkhealth
# 软连接python3
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/vim/venv/neovim3/bin"
ln -sf /usr/bin/python3 "${XDG_CACHE_HOME:-$HOME/.cache}/vim/venv/neovim3/bin/python"
配置tmux ~/.tmux.conf
set-option -sg escape-time 10
set-option -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',screen-256color:RGB'
set-option -ga terminal-overrides ',screen-256color:Tc'
set -g history-limit 10000
set -g message-style "bg=#00346e, fg=#ffffd7" # tomorrow night sblue, base3
set -g status-style "bg=#00346e, fg=#ffffd7" # tomorrow night blue, base3
set -g status-left "#[bg=#0087ff] ❐ #S " # blue
set -g status-left-length 400
set -g status-right "#{?client_prefix, ~ , } #[bg=#0087ff] #h #[bg=red] %Y-%m-%d %H:%M "
set -g status-right-length 600
在Windows安装字体
# 安装字体配置
apt install fontconfig -y
# 下载字体
cd /usr/share/fonts/
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/Hack.zip
unzip Hack.zip -d hack
#配置MobaXterm
#[Font]
#Font2=Hack Nerd Font
#FontHeight2=12
#配置Sublime Text
# "font_face": "Hack Nerd Font",
# "font_size": 12,
# "line_padding_bottom": 2,