PostgreSQLインスト
UbuntuにPostgreSQL9.1をインストールしてみた。
#apt-get install postgresql
インストールする際にユーザー(postgres)も作成されたようなので、パスワードを設定する
#passwd postgres
データ保存場所を作成
#mkdir /home/postgres/datum #chown postgres:postgres /home/postgres/datum
データベース初期化
$su - postgres postgres@hoge:/usr/lib/postgresql/9.1/bin$ ./initdb -D /home/postgres/datum/ 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 /home/postgres/datum ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 24MB creating configuration files ... ok creating template1 database in /home/postgres/datum/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... 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: ./postgres -D /home/postgres/datum or ./pg_ctl -D /home/postgres/datum -l logfile start
データベース接続の確認
postgres@hoge:createdb fuga postgres@hoge:psql -l
fugaがあることを確認。