postgresql83をインストール。
$ sudo port install postgresql83 Password: ---> Fetching bison ---> Attempting to fetch bison-2.3.tar.bz2 from http://ftp.gnu.org/gnu/bison ---> Verifying checksum(s) for bison ---> Extracting bison ---> Configuring bison ---> Building bison with target all ---> Staging bison into destroot ---> Installing bison 2.3_2 ---> Activating bison 2.3_2 ---> Cleaning bison ---> Fetching libxslt ---> Attempting to fetch libxslt-1.1.23.tar.gz from ftp://xmlsoft.org/libxslt/ ---> Verifying checksum(s) for libxslt ---> Extracting libxslt ---> Configuring libxslt ---> Building libxslt with target all ---> Staging libxslt into destroot ---> Installing libxslt 1.1.23_0 ---> Activating libxslt 1.1.23_0 ---> Cleaning libxslt ---> Fetching ossp-uuid ---> Attempting to fetch uuid-1.6.1.tar.gz from ftp://ftp.ossp.org/pkg/lib/uuid/ ---> Verifying checksum(s) for ossp-uuid ---> Extracting ossp-uuid ---> Applying patches to ossp-uuid ---> Configuring ossp-uuid ---> Building ossp-uuid with target all ---> Staging ossp-uuid into destroot ---> Installing ossp-uuid 1.6.1_0 ---> Activating ossp-uuid 1.6.1_0 ---> Cleaning ossp-uuid ---> Fetching postgresql83 ---> Attempting to fetch postgresql-8.3.3.tar.bz2 from http://ftp8.de.postgresql.org/pub/misc/pgsql//source/v8.3.3/ ---> Verifying checksum(s) for postgresql83 ---> Extracting postgresql83 ---> Configuring postgresql83 ---> Building postgresql83 ---> Staging postgresql83 into destroot ---> Installing postgresql83 8.3.3_0 To use the postgresql server, install the postgresql83-server port ---> Activating postgresql83 8.3.3_0 ---> Cleaning postgresql83
メッセージにある通り、postgresql83-serverをインストール。
$ sudo port install postgresql83-server Password: ---> Fetching postgresql83-server ---> Verifying checksum(s) for postgresql83-server ---> Extracting postgresql83-server ---> Configuring postgresql83-server ---> Building postgresql83-server with target all ---> Staging postgresql83-server into destroot ---> Creating launchd control script ########################################################### # A startup item has been generated that will aid in # starting postgresql83-server with launchd. It is disabled # by default. Execute the following command to start it, # and to cause it to launch at startup: # # sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist ########################################################### ---> Installing postgresql83-server 8.3.3_0 To create a database instance, after install do sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb' To tweak your DBMS, consider increasing kern.sysv.shmmax by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf ---> Activating postgresql83-server 8.3.3_0 ---> Cleaning postgresql83-server
メッセージにある通り、自動起動を設定して、データベースを作成。
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist $ sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb $ sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb $ sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb' The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale ja_JP.UTF-8. The default database encoding has accordingly been set to UTF8. initdb: could not find suitable text search configuration for locale ja_JP.UTF-8 The default text search configuration will be set to "simple". fixing permissions on existing directory /opt/local/var/db/postgresql83/defaultdb ... ok creating subdirectories ... ok selecting default max_connections ... 20 selecting default shared_buffers/max_fsm_pages ... 2400kB/20000 creating configuration files ... ok creating template1 database in /opt/local/var/db/postgresql83/defaultdb/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the -A option the next time you run initdb. Success. You can now start the database server using: /opt/local/lib/postgresql83/bin/postgres -D /opt/local/var/db/postgresql83/defaultdb or /opt/local/lib/postgresql83/bin/pg_ctl -D /opt/local/var/db/postgresql83/defaultdb -l logfile start