Mac port 安装postgres92 + postgres92-server

1. 首先确保 mac 已经安装好了 macports

2. sudo port install postgresql92-server

3. 安装完成后,仔细看安装后的那些shell 信息,按照步骤来进行初始化postgres数据库

4. 如果没有仔细阅读shell信息,就卸载了 sudo port uninstall postgresql92-server 或者 看下面我写的,哈哈

5. 

sudo mkdir -p /opt/local/var/db/postgresql92/defaultdb
 sudo chown postgres:postgres /opt/local/var/db/postgresql92/defaultdb
 sudo su postgres -c '/opt/local/lib/postgresql92/bin/initdb -D /opt/local/var/db/postgresql92/defaultdb' 

sudo mkdir -p /opt/local/var/log/postgresql92/

cd /opt/local/var/log/postgresql92/

sudo touch logfile

cd ../

sudo chown -R postgres:postgres postgresql92

sudo /opt/local/lib/postgresql92/bin/pg_ctl -D /opt/local/var/db/postgresql92/defaultdb -l /opt/local/var/log/postgresql92/logfile start


6. portgres 启动完毕. 


补充:

只安装 postgres92

// 卸载postgresql92-server 

// sudo port -v uninstall -f postgresql92-server 

sudo port -v install postgresql92

sudo mkdir -p /opt/local/var/db/postgresql92/defaultdb

sudo chown postgres:postgres /opt/local/var/db/postgresql92/defaultdb

 sudo su postgres -c '/opt/local/lib/postgresql92/bin/initdb -D /opt/local/var/db/postgresql92/defaultdb' 


sudo mkdir -p /opt/local/var/log/postgresql92/

cd /opt/local/var/log/postgresql92/

sudo touch logfile

cd ../

sudo chown -R postgres:postgres postgresql92

sudo /opt/local/lib/postgresql92/bin/pg_ctl -D /opt/local/var/db/postgresql92/defaultdb -l /opt/local/var/log/postgresql92/logfile start/stop

or

/opt/local/lib/postgresql92/bin/postgres -D /opt/local/var/db/postgresql92/defaultdb > /opt/local/var/log/postgresql92/logfile 2>&1 &






你可能感兴趣的:(Mac port 安装postgres92 + postgres92-server)