簡體   English   中英

Linuxbrew,安裝 postgres 並自動啟動服務

[英]Linuxbrew, install postgres and start service automatically

我在我的 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`!

該怎么辦?

不是自動,而是朝着正確的方向邁出了一步。 在我的系統上,我做了以下事情:

$ 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

brew服務不支持Linux ...
這是: https//github.com/Homebrew/homebrew-services/issues/46

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM