首页 > 其他 > 详细

wsl相关总结

时间:2019-06-26 14:13:35      阅读:370      评论:0      收藏:0      [点我收藏+]
  • 启用WSL
    VirtualMachinePlatform是WSL2依赖功能,需要系统支持(build 18917+),硬件支持VM功能并开启,安装完成后要重启计算机。
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
  • 升级WSL到WSL2
wsl --set-version ubuntu 2 #设置为1则降级
wsl --set-default-version 2 #设置默认版本
wsl -l -v #显示已安装的列表
  • 文件读写权限配置
sudo vim /etc/wsl.conf

添加如下内容

[automount]
enabled=true
root="/mnt/"
options="metadata,uid=1000,gid=1000,umask=22,fmask=111"
mountFsTab=true
[network]
generateHosts=true
generateResolvConf=true
  • 修改源为阿里云镜像
sudo vim /etc/apt/sources.list
#替换成阿里云镜像
:%s/security.ubuntu/mirrors.aliyun/g
:%s/archive.ubuntu/mirrors.aliyun/g

sudo apt update && sudo apt upgrade -y
  • 关闭git文件模式,解决wsl与windows上一边操作后,另一边git提示有文件修改问题。
git config core.filemode false
git config core.autocrlf true #如果windows上也配置了这个选项,则不建议关闭。

wsl相关总结

原文:https://www.cnblogs.com/flying_bat/p/11089167.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!