Debian Wheezyにpostgresインストールした
$ sudo apt-get install postgresql ... supported_versions: WARNING: Unknown Debian release: 7.1 Building PostgreSQL dictionaries from installed myspell/hunspell packages... Setting up postgresql-9.1 (9.1.9-1) ... Error: The locale requested by the environment is invalid. Error: could not create default cluster. Please create it manually with pg_createcluster 9.1 main --start or a similar command (see 'man pg_createcluster'). ....
エラーになってインストール失敗してる。
sudoつけたら成功してpostgresが起動しているっぽい。
deployer@www144[/]$ sudo pg_createcluster 9.1 main --start Creating new cluster (configuration: /etc/postgresql/9.1/main, data: /var/lib/postgresql/9.1/main)... locale: Cannot set LC_MESSAGES to default locale: No such file or directory Moving configuration file /var/lib/postgresql/9.1/main/postgresql.conf to /etc/postgresql/9.1/main... Moving configuration file /var/lib/postgresql/9.1/main/pg_hba.conf to /etc/postgresql/9.1/main... Moving configuration file /var/lib/postgresql/9.1/main/pg_ident.conf to /etc/postgresql/9.1/main... Configuring postgresql.conf to use port 5432...
psqlを実行すると警告が出たり、roleないと出た.
deployer@www144[~]$ psql perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "ja_JP.UTF-8"
この警告を消すにはぐぐると値を設定すればよいっぽい。
$ export LANGUAGE="en_US.UTF-8" $ export LC_ALL="en_US.UTF-8"
http://serverfault.com/questions/308295/postgresql-didnt-install-on-ubuntu-11-04
作業ユーザでpostgresqlにログインする
$ sudo -u postgres psql postgres psql (9.1.9) Type "help" for help. postgres=# CREATE ROLE jiikko LOGIN password 'password'; CREATE ROLE postgres=# \q
たぶんこれでrailsのdatabase.ymlにこのユーザを指定すればそのユーザで接続してくれる。