[英]Linuxbrew, install postgres and start service automatically
I install Postgresql on my Ubuntu with:我在我的 Ubuntu 上安装了 Postgresql:
brew install postgres
now I have:我现在有:
psql --version
psql (PostgreSQL) 9.5.0
How can I start the service automatically?如何自动启动服务?
On my Mac with homebrew I can do it with:在我的带有自制软件的 Mac 上,我可以这样做:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
but how on Ubuntu with Linuxbrew?但是如何在 Ubuntu 上使用 Linuxbrew?
I try with:我尝试:
brew services start postgresql
but it says:但它说:
sh: 1: list: not found
Error: Could not read the plist for `postgresql`!
What to do?该怎么办?
Not quite automatic but a step in the right direction. 不是很自动,而是朝着正确的方向迈出了一步。 On my system I did the following:
在我的系统上,我做了以下事情:
$ pg_ctl start -D $HOME/.linuxbrew/var/postgres -l logfile
You could simple create an alias in your .bash_profile
or .bashrc
something like: 您可以在
.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"
To test it all out (assuming you do not yet have a database on your machine) you can also create a database for your current user: 要全部测试(假设您的计算机上还没有数据库),您还可以为当前用户创建一个数据库:
$ poston
$ createdb `whoami`
$ psql
brew services dose not support Linux... brew服务不支持Linux ...
Here it is: https://github.com/Homebrew/homebrew-services/issues/46 这是: https : //github.com/Homebrew/homebrew-services/issues/46
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.