WSL ubuntu PHP 开发环境搭建 (1367 views)

gHOST

2020-05-24 14:15:05

启动 ssh

~$ sudo service ssh start

提示:

 * Starting OpenBSD Secure Shell server sshd                                                                            
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key

生成所缺少的 key 文件

~$ sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
~$ sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
~$ sudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key

重新启动 ssh

~$ sudo service ssh start
 * Starting OpenBSD Secure Shell server sshd                              [ OK ]

启动成功,用 ssh 连接报错

~$ ssh user@127.0.0.1
user@127.0.0.1: Permission denied (publickey).

因为 wsl 的 ubuntu 默认关闭了密码登陆,需要打开密码登陆,打开 /etc/ssh/sshd_config,找到 PasswordAuthentication 那一行 可以看到

PasswordAuthentication no

no 改为 yes,重启 ssh 服务

~$ sudo service ssh restart
 * Restarting OpenBSD Secure Shell server sshd                           [ OK ]

再就可以用 ssh 登陆 wsl 了

将 apt 的软件源改为阿里云

编辑 /etc/apt/sources.list

~$ sudo vi /etc/apt/sources.list

archive.ubuntu.com 替换成 mirrors.aliyun.com

:%s/archive.ubuntu.com/mirrors.aliyun.com/g

保存退出,更新系统

~$ sudo apt update
~$ sudo apt upgrade

安装 oneinstack

~$ wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz
~$ tar xzvf oneinstack-full.tar.gz
~$ cd oneinstack
~$ sudo ./install.sh

根据 oneinstack 的说明,安装环境