我在我的Ubuntu上安装了Postgresql:
brew install postgres
现在我有:
psql --version
psql (PostgreSQL) 9.5.0
如何自动启动服务?
在使用自制软件的Mac上,我可以使用:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
但是如何在Ubuntu上使用Linuxbrew?
我尝试:
brew services start postgresql
但它说:
sh: 1: list: not found
Error: Could not read the plist for `postgresql`!
怎么办?
答案 0 :(得分:9)
不是相当自动,但朝着正确的方向迈出了一步。在我的系统上,我做了以下事情:
$ pg_ctl start -D $HOME/.linuxbrew/var/postgres -l logfile
您可以在.bash_profile
或.bashrc
中简单地创建别名:
alias poston="pg_ctl start -D $HOME/.linuxbrew/var/postgres -l logfile"
alias postoff="pg_ctl stop -D $HOME/.linuxbrew/var/postgres"
要全部测试(假设您的计算机上还没有数据库),您还可以为当前用户创建数据库:
$ poston
$ createdb `whoami`
$ psql
答案 1 :(得分:1)