#navi(../)
* Ubuntu16.04にPostgreSQLをインストール [#h16b5161]
Ubuntu16.04にPostgreSQLをインストールした時の備忘録です。~
PostgreSQLはUbuntuリポジトリのパッケージを使用しました。
#contents
#htmlinsertpcsp(db-top.html,db-sp.html)
* PostgreSQLのパッケージ検索 [#xfd4c2f5]
以下のコマンドでPostgreSQLパッケージを検索しました。
apt-cache search postgresql | grep -i ^postgresql
実行した出力結果は以下の通りです。
sakura@stream:~$ apt-cache search postgresql | grep -i ^postgresql
postgresql - オブジェクトリレーショナル SQL データベース (サポート版)
postgresql-9.5-dbg - debug symbols for postgresql-9.5
postgresql-client - PostgreSQL 用フロントエンドプログラム (サポート版)
postgresql-client-9.5 - front-end programs for PostgreSQL 9.5
postgresql-client-common - manager for multiple PostgreSQL client versions
postgresql-common - PostgreSQL データベースクラスタマネージャ
postgresql-contrib - additional facilities for PostgreSQL (supported version)
postgresql-contrib-9.5 - additional facilities for PostgreSQL
postgresql-doc - documentation for the PostgreSQL database management system
postgresql-doc-9.5 - documentation for the PostgreSQL database management system
postgresql-9.5 - object-relational SQL database, version 9.5 server
postgresql-9.5-pgrouting-doc - basic routing functionality support for PostgreSQL 9.5 (Documentation)
postgresql-9.5-plsh - PL/sh procedural language for PostgreSQL 9.5
postgresql-9.5-postgis-2.2 - Geographic objects support for PostgreSQL 9.5
postgresql-9.5-postgis-scripts - Geographic objects support for PostgreSQL 9.5 -- scripts
postgresql-9.5-slony1-2 - replication system for PostgreSQL: PostgreSQL 9.5 server plug-in
postgresql-autodoc - PostgreSQL データベーススキーマの概略を HTML、DOT および XML 形式で作成するユーティリティ
postgresql-filedump - PostgreSQL ファイル整形用ユーティリティ
postgresql-mysql-fdw-doc - documentation for mysql-fdw
postgresql-plperl-9.5 - PL/Perl procedural language for PostgreSQL 9.5
postgresql-plpython-9.5 - PL/Python procedural language for PostgreSQL 9.5
postgresql-plpython3-9.5 - PL/Python 3 procedural language for PostgreSQL 9.5
postgresql-pltcl-9.5 - PL/Tcl procedural language for PostgreSQL 9.5
postgresql-server-dev-9.5 - development files for PostgreSQL 9.5 server-side programming
postgresql-9.5-asn1oid - ASN.1 OID data type for PostgreSQL
postgresql-9.5-debversion - Debian version number type for PostgreSQL
postgresql-9.5-ip4r - IPv4 and IPv6 types for PostgreSQL 9.5
postgresql-9.5-mimeo - specialized, per-table replication between PostgreSQL instances
postgresql-9.5-mysql-fdw - Postgres 9.5 Foreign Data Wrapper for MySQL
postgresql-9.5-orafce - Oracle support functions for PostgreSQL 9.5
postgresql-9.5-partman - PostgreSQL Partition Manager
postgresql-9.5-pgespresso - extension for Barman, Backup and Recovery Manager for PostgreSQL
postgresql-9.5-pgextwlist - PostgreSQL Extension Whitelisting
postgresql-9.5-pgfincore - set of PostgreSQL functions to manage blocks in memory
postgresql-9.5-pgmemcache - PostgreSQL interface to memcached
postgresql-9.5-pgmp - arbitrary precision integers and rationals for PostgreSQL 9.5
postgresql-9.5-pgpool2 - connection pool server and replication proxy for PostgreSQL - modules
postgresql-9.5-pgq3 - Skype tools for PostgreSQL replication, londiste and PGQ
postgresql-9.5-pgrouting - basic routing functionality support for PostgreSQL 9.5
postgresql-9.5-pgtap - Unit testing framework extension for PostgreSQL 9.5
postgresql-9.5-pllua - Lua procedural language for PostgreSQL 9.5
postgresql-9.5-plproxy - database partitioning system for PostgreSQL 9.5
postgresql-9.5-plr - Procedural language interface between PostgreSQL and R
postgresql-9.5-plv8 - Procedural language interface between PostgreSQL and JavaScript
postgresql-9.5-powa - PostgreSQL Workload Analyzer -- PostgreSQL 9.5 extension
postgresql-9.5-prefix - Prefix Range module for PostgreSQL
postgresql-9.5-preprepare - pre prepare your PostgreSQL statements server side
postgresql-9.5-prioritize - Get and set the nice priorities of PostgreSQL backends
postgresql-9.5-python-multicorn - multicorn extension for Postgres 9.5 to write FDWs with python2
postgresql-9.5-python3-multicorn - multicorn extension for Postgres 9.5 to write FDWs with python3
postgresql-9.5-repmgr - replication manager for PostgreSQL 9.5
postgresql-9.5-repmgr-dbg - debug symbols for repmgr for PostgreSQL 9.5
postgresql-comparator - efficient PostgreSQL table content comparison and synchronization
postgresql-hll - HyperLogLog extension for PostgreSQL
postgresql-server-dev-all - extension build tool for multiple PostgreSQL versions
* PostgreSQLパッケージのインストール [#j8d3d0d0]
上記のパッケージ検索にて、以下のパッケージがサポート版なのが確認できたのでインストールします。~
''postgresql - オブジェクトリレーショナル SQL データベース (サポート版)''~
以下のコマンドでPostgreSQLをインストールします。
sudo apt install postgresql
以下、上記コマンドを実行したときの出力です。~
yを入力しEnterキーを押せばインストールが開始されます。
sakura@stream:~$ sudo apt install postgresql
[sudo] sakura のパスワード:
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
libpq5 postgresql-9.5 postgresql-client-9.5 postgresql-client-common postgresql-common
postgresql-contrib-9.5 sysstat
提案パッケージ:
postgresql-doc locales-all postgresql-doc-9.5 libdbd-pg-perl isag
以下のパッケージが新たにインストールされます:
libpq5 postgresql postgresql-9.5 postgresql-client-9.5 postgresql-client-common
postgresql-common postgresql-contrib-9.5 sysstat
アップグレード: 0 個、新規インストール: 8 個、削除: 0 個、保留: 0 個。
4,794 kB のアーカイブを取得する必要があります。
この操作後に追加で 19.4 MB のディスク容量が消費されます。
続行しますか? [Y/n]
** PostgreSQLのバージョンを確認してみる [#zbcc32ca]
PostgreSQLのターミナルであるpsqlのバージョンを確認したときの出力です。
sakura@stream:~$ psql --version
psql (PostgreSQL) 9.5.4
** postgresqlの動作確認 [#qdbef48a]
systemctl status postgresqlコマンドで動作確認をした時の出力です。
sakura@stream:~$ systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since 日 2016-10-16 11:45:41 JST; 7min ago
Main PID: 4044 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/postgresql.service
10月 16 11:45:41 stream systemd[1]: Starting PostgreSQL RDBMS...
10月 16 11:45:41 stream systemd[1]: Started PostgreSQL RDBMS.
10月 16 11:45:55 stream systemd[1]: Started PostgreSQL RDBMS.
** PostgreSQLのバージョンを確認してみ [#q825a15f]
PostgreSQlのversion()関数でバージョンを確認してみます。
sakura@stream:~$ sudo -i -u postgres
postgres@stream:~$ psql
psql (9.5.4)
Type "help" for help.
postgres=# select version();
-----------------------------------------------------------------------------------------------------------------
PostgreSQL 9.5.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609, 64-bit
(1 row)
postgres=# \q
postgres@stream:~$ exit
ログアウト
以上、Ubuntu16.04(xubuntu16.04)にPostgreSQLパッケージをインストールした時の資料でした。
#htmlinsertpcsp(db-btm.html,db-sp.html)