在 Ubuntu 14.04 安装Postgresql 时报错
Failed to issue method call: Unit postgresql@10-main.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql@10-main.service' for details.
解决方法:
修改/usr/share/postgresql-common/init.d-functions文件
sudo vi /usr/share/postgresql-common/init.d-functions
源内容:
if [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
ERRMSG=$(pg_ctlcluster --force "$2" "$name" $1 2>&1)
else
ERRMSG=$(pg_ctlcluster "$2" "$name" $1 2>&1)
fi
添加: --skip-systemctl-redirect
if [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
ERRMSG=$(pg_ctlcluster --skip-systemctl-redirect --force "$2" "$name" $1 2>&1)
else
ERRMSG=$(pg_ctlcluster --skip-systemctl-redirect "$2" "$name" $1 2>&1)
fi
启动postgres:
sudo /etc/init.d/postgresql start
参考:https://askubuntu.com/questions/1000631/unable-to-install-postgresql-10-on-ubuntu