PostgreSQL自制安装缺少配置文件


21

因此,我在MacOSX Lion上成功安装了PostgreSQL 9.1。与人们所说的不同,我不必更改PATH,并且系统上没有安装其他版本的PostgreSQL($ psql --version 显示psql (PostgreSQL) 9.1.4)。

但是,当我尝试使用pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start它运行服务器时不起作用。首先,它说不存在目录/usr/local/var/postgres/。很好,创建了一个。然后说权限是错误的-很好,更改了它们。然后,它要求postgresql.conf文件位于此目录中。

现在,我在中找到了示例配置/usr/local/Cellar/postgresql/9.1.4/share/postgresql,但是我不确定这是应该的样子。我在网上看到的所有手册都没有提到从示例中创建配置文件。自制软件不应该立即提供此功能,这样我就可以立即启动服务器吗?


如果您认为应该这样做,请提交一个新的问题 -我个人从未安装过该产品,所以我不能说这是否是有意的。
slhck 2012年

Answers:


21

这是您的第一次安装吗?你试过跑步initdb /usr/local/var/postgres吗?这就解决了同样的问题,在清除了旧的系统范围的PostgreSQL安装并使用Homebrew重新安装后,这才发生在我身上。

运行brew info postgres总是可以提醒您安装软件包后可用的命令。

postgresql 9.1.4
http://www.postgresql.org/
Depends on: readline, ossp-uuid
/usr/local/Cellar/postgresql/9.1.4 (2751 files, 36M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/postgresql.rb

==> Caveats
# Build Notes

If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
  https://github.com/mxcl/homebrew/issues/issue/2510

To build plpython against a specific Python, set PYTHON prior to brewing:
  PYTHON=/usr/local/bin/python  brew install postgresql
See:
  http://www.postgresql.org/docs/9.1/static/install-procedure.html

# Create/Upgrade a Database

If this is your first install, create a database with:
  initdb /usr/local/var/postgres

To migrate existing data from a previous major version (pre-9.1) of PostgreSQL, see:
  http://www.postgresql.org/docs/9.1/static/upgrading.html

# Start/Stop PostgreSQL

If this is your first install, automatically load on login with:
  mkdir -p ~/Library/LaunchAgents
  cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
  launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

If this is an upgrade and you already have the homebrew.mxcl.postgresql.plist loaded:
  launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
  launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Or start manually with:
  pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

And stop with:
  pg_ctl -D /usr/local/var/postgres stop -s -m fast

# Loading Extensions

By default, Homebrew builds all available Contrib extensions.  To see a list of all
available extensions, from the psql command line, run:
  SELECT * FROM pg_available_extensions;

To load any of the extension names, navigate to the desired database and run:
  CREATE EXTENSION [extension name];

For instance, to load the tablefunc extension in the current database, run:
  CREATE EXTENSION tablefunc;

For more information on the CREATE EXTENSION command, see:
  http://www.postgresql.org/docs/9.1/static/sql-createextension.html
For more information on extensions, see:
  http://www.postgresql.org/docs/9.1/static/contrib.html

# Other

Some machines may require provisioning of shared memory:
  http://www.postgresql.org/docs/current/static/kernel-resources.html#SYSVIPC

To install postgresql (and ossp-uuid) in 32-bit mode:
   brew install postgresql --32-bit

If you want to install the postgres gem, including ARCHFLAGS is recommended:
    env ARCHFLAGS="-arch x86_64" gem install pg

To install gems without sudo, see the Homebrew wiki.

我猜这确实存在,但我不知道。brew info blah。这是太棒了!谢谢。:)
chandsie 2013年

自2014年6月起,brew info postgres不再提供有关的有用信息CREATE EXTENSION-因此对我来说,在此处查看有帮助。
user12345 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.