WSL 防火墙规则 1 New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
基础环境配置 更换源 使用中科大的源: https://mirrors.ustc.edu.cn/help/ubuntu.html
1 2 3 4 sudo sed -i 's@//.*.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list
安装常用的包 1 2 sudo apt update && sudo apt upgrade -y sudo apt install -y libmysqlclient-dev build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev lrzsz
当前用户免 sudo 密码 1 2 3 4 sudo tee /etc/sudoers.d/iuxt <<-EOF %sudo ALL=(ALL:ALL) NOPASSWD:ALL $USER ALL=(ALL:ALL) NOPASSWD:ALL EOF
WSL 开启 systemd 支持 (仅支持 WSL2) 1 2 3 4 5 6 7 sudo touch /etc/startup.sh sudo chmod +x /etc/startup.sh sudo tee /etc/wsl.conf <<-'EOF' [boot] systemd=true command =/etc/startup.shEOF
git 配置 1 sudo apt install -y git git-lfs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 tee ~/.gitconfig <<-'EOF' [user] name = zhanglikun email = x@zahui.fan signingkey = zhanglikun [credential] helper = store [core] autocrlf = input quotepath = false [init] defaultBranch = master [pull] rebase = false [commit] gpgsign = false EOF
zsh 配置 安装 zsh
安装 oh my zsh https://ohmyz.sh/#install
1 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) "
安装主题 https://github.com/romkatv/powerlevel10k
1 2 3 4 git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME /.oh-my-zsh/custom} /themes/powerlevel10k sed -i 's#^ZSH_THEME=.*#ZSH_THEME="powerlevel10k/powerlevel10k"#g' ~/.zshrc
安装一些插件 https://github.com/zsh-users/zsh-autosuggestions
1 2 3 4 sudo apt install -y fzf 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 omz plugin enable z git sudo zsh-autosuggestions zsh-syntax-highlighting fzf
vim 修改默认编辑器 1 2 3 4 5 sudo ln -sf /usr/bin/vim.basic /etc/alternatives/editor echo 'SELECTED_EDITOR="/usr/bin/vim.basic"' > ~/.selected_editor
安装 vim plug 插件管理工具 1 2 curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 tee ~/.vimrc <<-'EOF' call plug " On-demand loading Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' call plug#end() set paste " set number" nerdtree let NERDTreeWinPos=" left" noremap <F8> :NERDTreeToggle<CR> let g:NERDTreeDirArrowExpandable = '▸' let g:NERDTreeDirArrowCollapsible = '▾' " airlineset laststatus=2 "永远显示状态栏 let g:airline_powerline_fonts = 1 " 支持 powerline 字体let g:airlinelet g:airline_theme='molokai' if !exists('g:airline_symbols' )let g:airline_symbols = {}endif let g:airline_left_sep = '▶' let g:airline_left_alt_sep = '❯' let g:airline_right_sep = '◀' let g:airline_right_alt_sep = '❮' let g:airline_symbols.linenr = '¶' let g:airline_symbols.branch = '⎇' EOF
进入 vim 命令界面, 输入 :PlugInstall
安装插件
常用环境安装 安装 golang python nodejs 查看 快速搭建环境记录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 curl -fsSL get.docker.com | bash sudo mkdir -p /etc/docker && sudo tee /etc/docker/daemon.json <<-'EOF' { "exec-opts" : ["native.cgroupdriver=systemd" ], "log-driver" : "json-file" , "log-opts" : { "max-size" : "100m" }, "storage-driver" : "overlay2" , "iptables" : false } EOF sudo usermod -aG docker $USER
安装 zssh, 查看 改造windows-terminal支持lrzsz
常用 alias 1 2 # 模仿macOS打开访达,使用 open . 在此处打开文件管理器。 alias open ='explorer.exe'
常用软链接 1 2 3 4 ln -sf /mnt/c/Users/iuxt/Desktop ~ln -sf /mnt/c/Users/iuxt/Documents ~ln -sf /mnt/c/Users/iuxt/Downloads ~ln -sf /mnt/c/Users/iuxt/OneDrive ~