Loading... # 基础环境配置: ## WSL内普通用户sudo免密 注意:这一行为在生产力环境中请慎重考虑 这一项仅在个人实验环境中增加便捷性而设置,请千万慎重使用。 首先切换到root权限下: ```Bash su - ``` 这一行的命令是把当前用户切换到root下面,并且,请着重注意后面的` - `,它会把root的环境变量也传递进来,如果没有,那就只是切换到root账户,使用的环境变量还是普通用户的。 ### 编辑`/etc/sudoers`文件 编辑`/etc/sudoers`文件把我们想取消掉`sudo`输入密码的账户添加进去,来达成目的 ```Bash vi /etc/sudoers # 文末添加 hulk ALL=(ALL)NOPASSWD: ALL # 前面的hulk是用户名,你需要替换成你的用户名,或者更加简单粗暴,直接设置为全体用户 sudo免密 ALL ALL=(ALL)NOPASSWD: ALL ``` ## WSL改源 ```bash # 修改/etc/apt/source.list文件 # 修改为阿里镜像源 # 内容替换为如下内容 deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse ``` Last modification:March 1, 2022 © Allow specification reprint Like 0 If you think my article is useful to you, please feel free to appreciate