WSL
1、开启WSL 首先需要使用管理员权限打开 PowerShell 执行如下命令 Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 或者在程序和功能选打开 适用于 Linux 的 Windows 子系统 出现提示时,重启计算机。 在Microsoft Storerosoft Store安装Ubuntu
2、配置apt国内源 sed -i ‘s/archive.ubuntu.com/mirrors.aliyun.com/g’ /etc/apt/sources.list 更新源 apt-get update apt-gre upgrade
3、设置系统语言为中文 安装中文支持 apt-get install -y language-pack-zh-hans 设置默认语言 update-locale LANG=zh_CN.UTF-8
4、配置服务自启动 编辑 vim /etc/init.wsl 文件添加如下内容 #! /bin/sh #Filename: /etc/init.wsl #Usage: /etc/init.wsl [start|stop|restart] service dbus start 添加执行权限: sudo chmod +x /etc/init.wsl
按win+R 输入shell:startup 在启动内新建一个文本输入 Set ws = WScript.CreateObject(“WScript.Shell”) ws.run “wsl -d ubuntu -u root /etc/init.wsl”,vbhide 将文本名改为startservice.vbs(后缀为.vbs的就行) 以后就可以向 /etc/init.wsl 追加服务,实现开启自启动了
5、安装 nginx + php 环境 安装 apt-get install -y nginx php-fpm 启动 fpm service php7.4-fpm start 启动 nginx service nginx start 编辑 nginx 配置 vim /etc/nginx/sites-available/default
6、关闭dash(默认是未关闭状态执行sh脚本会报错) sudo dpkg-reconfigure dash 选择NO