即然是 CentOS 那如果不能运行 service systemctl 那不是等于是残了嘛.

用的是 yuk7/CentWSL 这个 CentOS 7 装完感觉挺好的, 心里暗爽, 然后就开始折腾了.

安装 PostgreSQL 配置完了以后就准备 service postgresql start 的时候就提示了错误:

Failed to get D-Bus connection Operation not permitted

查了一下,意思就是 wsl 并不支持。

不过 github 上有人解决了, 这里

大概就是这样:

mv /usr/bin/systemctl /usr/bin/systemctl.old
curl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py > /usr/bin/systemctl
chmod +x /usr/bin/systemctl

有一个介绍 wsl 的写的很详细,推友 塔Q 分享的 Dev on Windows with WSL,值得一读.

另一个设置自动运行一文章: WSL Tips: Starting Linux Background Services on Windows Login

还有一个 repo: troytse/wsl-autostart

Like this post? Share on:


doobom Avatar doobom is write a bug.
Comments

So what do you think? Did I miss something? Is any part unclear? Leave your comments below.

comments powered by Disqus

Keep Reading


Published

Category

Windows

Tags

Stay in Touch

Get New Release Alert