好东西,VMware滚出我电脑
大体上我们需要4个东西
powershell
wsl
Debian
Windows terminal
分别来介绍他们
1. powershell
总之就是一个终端,跟iterm2一样,比cmd更好用
唤起方法
2. windows terminal
一个比powershell更更好用的终端
以后就用这个了,但是在安装的过程中仍然需要powershell的出场
理由是我们需要管理员权限来安装wsl
3. Debian
Linux的主体啦,Ubuntu centos什么都行
4. wsl
shell到Debian的桥梁,实际是在windows上开了个虚拟机
开始安装
1
搜索wsl
2.
下载完成后,打开Debian会看到报错
安装不了
去提示的网站看解决办法
照着操作就行了,简化版我不行,手动操作
2.1 适用于 Linux 的 Windows 子系统
管理员身份运行powershell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
2.2 启用虚拟机功能
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
2.3 重启
对,就是重启windows
2.4 下载 Linux 内核更新包
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
运行安装,安装完成后
2.5 将 WSL 2 设置为默认版本
wsl --set-default-version 2
至此就安装完了,powershell也没用了
打开terminal
wsl
cd ~
explorer.exe .
进入新世界
不过现在Debian上啥都没有
没有wget,没有vim
sudo apt-get update
sudo apt-get install wget
打开Windows上的vscode
安装插件Remote - WSL
在terminal上执行
code .
安装一些其他的重要东西
sudo apt install vim
sudo apt-get install git
sudo apt install gcc
sudo apt install g++
sudo apt-get install zsh
cat /etc/shells
ls -l /usr/bin/zsh
chsh -s /usr/bin/zsh
cd
git clone git@github.com:ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
export ZSH_CUSTOM=/home/knoe/.oh-my-zsh/custom
echo $ZSH_CUSTOM
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
or
git clone git@github.com:zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
or
git clone git@github.com:zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
在centos上的按照参考如下命令
yum -y install git
yum -y install g++
yum -y install zsh
修改zshrc文件
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#dfff00,bg=cyan,bold,underline"
# ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=202"
plugins=(
git
pip
zsh-autosuggestions
zsh-syntax-highlighting
)
alias ll='ls -l'
alias grep="grep --color=auto"
最后再执行一遍zsh
装差不多了,c++也能跑了
[note] 如果是mac的partial 自动补全不好用的话,参考
https://stackoverflow.com/questions/6205157/how-to-set-keyboard-shortcuts-to-jump-to-beginning-end-of-line
再美化一点
在terminal内部,按CTRL+,
唤起设置,进入json
修改
"profiles":
{
"defaults":
{
"useAcrylic": true,
"opacity": 0.6,
"bellStyle": "none"
},