记录一下今天的安装过程
1.安装WSL
WSL(Windows Subsystem for Linux) 是Win10下面的linux子系统,与Win10共享端口,网络,文件和进程列表。现在已经到第二版,wsl2版本基于虚拟机的。目前win10系统默认的还是wsl1。
打开 控制面板->程序与功能->启用或关闭Windows功能。
选择 适用于Linux的Windows子系统
打开win10应用商店 搜索linux
选择 Ubuntu 18.04LTS 进行安装
安装完成后启动程序,输入账号密码,密码输入两遍。
等待wsl安装完毕
2. 安装nmp(nginx、php、mysql)
1 .原文件备份sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2. 编辑源列表文件sudo vim /etc/apt/sources.list
3. 替换原来的内容为下面的
Ubuntu 20.04 国内源(清华)
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
22.04.2阿里源
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
保存,执行命令sudo apt-get update && sudo apt-get upgrade
等待升级完成后,开始安装nginxsudo apt install nginx -y
安装完成后测试运行sudo service nginx start
在浏览器中输入http://127.0.0.1
没有问题的话,会出现
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
- 安装mysql8
sudo apt install mysql-server -y
sudo usermod -d /var/lib/mysql/ mysql
sudo service mysql start
sudo mysql_secure_inst