UbuntuServer18.04にPostgreSQL9.5をインストールする

標準のリポジトリにはないので、公式wikiを参考にインストールする。

リポジトリキーをインポートする。

# curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

リポジトリを追加する。

# echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
# apt update

インストール。

# apt install postgresql-9.5

サービスを起動する。

# systemctl start postgresql@9.5-main

postgresのパスワードを設定する。

# su postgres
$ psql
postgres=# alter user postgres with password 'password';
postgres=# \q