Modified: 12 July 2005
インストールの確認
CentOS(RedHat Enterprise Server)のPostgreSQLは、"rh-postgresql"となっています。
RPMを確認してみます。
# rpm -q rh-postgresql
rh-postgresql-7.3.10-1
#
インストール
インストールされていない場合、以下の手順で行います。
# rpm -ivh rh-postgresql-libs-7.3.9-2.i386.rpm Preparing... ########################################### [100%] 1:rh-postgresql-libs ########################################### [100%] # rpm -ivh rh-postgresql-7.3.9-2.i386.rpm Preparing... ########################################### [100%] 1:rh-postgresql ########################################### [100%] # rpm -ivh rh-postgresql-server-7.3.9-2.i386.rpm Preparing... ########################################### [100%] 1:rh-postgresql-server ########################################### [100%] # su - postgres $ initdb --encoding=EUC_JP --no-locale 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 C. Fixing permissions on existing directory /var/lib/pgsql/data... ok creating directory /var/lib/pgsql/data/base... ok creating directory /var/lib/pgsql/data/global... ok creating directory /var/lib/pgsql/data/pg_xlog... ok creating directory /var/lib/pgsql/data/pg_clog... ok creating template1 database in /var/lib/pgsql/data/base/1... ok creating configuration files... ok initializing pg_shadow... ok enabling unlimited row size for system tables... ok initializing pg_depend... ok creating system views... ok loading pg_description... ok creating conversions... ok setting privileges on built-in objects... ok vacuuming database template1... ok copying template1 to template0... ok Success. You can now start the database server using: /usr/bin/postmaster -D /var/lib/pgsql/data or /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start $ exit logout # service rhdb start Starting PostgreSQL - Red Hat Edition service: [ OK ] # chkconfig rhdb on #
サービスの起動
起動は、"rhdb"で行います。
# service rhdb start Starting PostgreSQL - Red Hat Edition service: [ OK ] #自動起動の設定もしておきます。
# chkconfig rhdb on
最初の設定
デフォルトでは、インストールしたPCからしか使えません、ネットワーク経由でも使えるように設定しておきます。
"/var/lib/pgsql/data/postgresql.conf"を以下のように変更します。
: # # Connection Parameters # tcpip_socket = true #ssl = false #max_connections = 32 #superuser_reserved_connections = 2 #port = 5432 #hostname_lookup = false #show_source_port = false :どのPCからどのDBに接続できるかを設定します。
: # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD local all all trust host all all 127.0.0.1 255.255.255.255 trust host all all 192.168.0.0 255.255.255.0 trust # Using sockets credentials for improved security. Not available everywhere, # but works on Linux, *BSD (and probably some others) #local all all ident sameuser