WSL目前发行版包含了 Ubuntu,Kali但是安装Centos需要购买。好在外国大神发布了开源项目,可以顺利在windows10中安装Centos.
安装步骤:
1.下载安装包。
详见后面链接地址。
2.解压缩安装包。
3.点击程序进行安装。
4.启动Centos。
5.更新系统。
运行 yum update 更新系统。
6.安装ssh服务。
yum install openssh-server openssh
7.修改sshd-config
vim /etc/ssh/sshd_config
修改如下图所示:
#port --代表端口号
#permitRootLogin --允许root用户登录
8.winscp 链接登录
9.上传文件。
链接地址:
https://github.com/wsldl-pg/CentWSL/releasesgithub.com/wsldl-pg/CentWSL/releases
常见问题:
一、CentOS 那如果不能运行 service systemctl 那不是等于是残了嘛.
在Windows下能安装linux子系统 CentOS 7 感觉挺好的, 心里暗爽, 然就开始折腾了.
安装 PostgreSQL 配置完了以后就准备 service postgresql start 的时候就提示了错误:
Failed to get D-Bus connection Operation not permitted
查了一下,意思就是 wsl 并不支持。不过 github 上有人解决了这个问题, 这里
大概就是这样:使用Python脚本替换了systemctl 传送门
mv /usr/bin/systemctl /usr/bin/systemctl.old
curl https://github.com/gdraheim/docker-systemctl-replacement/blob/master/files/docker/systemctl.py > /usr/bin/systemctl
chmod +x /usr/bin/systemctl