CentOS 6.6下編譯安裝PostgreSQL9.4.1及phpPgAdmin配置
安裝前準備
# yum install readline-devel zlib-devel
下載源碼並解壓、編譯安裝
# wget https://ftp.postgresql.org/pub/source/v9.4.1/postgresql-9.4.1.tar.bz2
# tar -xjvf postgresql-9.4.1.tar.bz2
# cd postgresql-9.4.1
# ./configure
# make
# make install
--------------------------------------
添加使用者 (因為下面建立database cluster時不能用root帳號)
# useradd postgres
# passwd postgres
建立好database cluster目標檔案夾
# mkdir -p /mnt/data/pgsql
# chown -R postgres /mnt/data/pgsql
環境變數設定
# su - postgres
$ vi .bash_profile
# postgres
PGDATA=/mnt/data/pgsql
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH
讓環境變數生效
$ source .bash_profile
--------------------------------------
建立database cluster
$ pg_ctl initdb
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/local/pgsql/bin/postgres -D /mnt/data/pgsql
or
/usr/local/pgsql/bin/pg_ctl -D /mnt/data/pgsql -l logfile start
啟動資料庫執行個體
設定好PGDATA環境變數後,可以不帶-D選項
$ pg_ctl start -l /mnt/data/pgsql/pgsql.log
關閉資料庫執行個體
$ pg_ctl stop
開啟遠端連線
$ cd /mnt/data/pgsql/
$ vi pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 trust
$ vi postgresql.conf
listen_addresses = '*'
配置防火牆
$ su - root
# vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT# service iptables restart
配置phppgadmin
到http://phppgadmin.sourceforge.net/doku.php下載5.1版本
解壓到網站目錄下,並重新命名為pgadmin
# cd pgadmin
# vim conf/config.inc.php
$conf['servers'][0]['host'] = '127.0.0.1';
$conf['servers'][0]['port'] = 5432;
$conf['servers'][0]['pg_dump_path'] = '/usr/local/pgsql/bin/pg_dump';
$conf['servers'][0]['pg_dumpall_path'] = '/usr/local/pgsql/bin/pg_dumpall';
$conf['extra_login_security'] = false
儲存後,訪問該路徑,輸入使用者名稱和密碼即可訪問。
------------------------------------華麗麗的分割線------------------------------------
如何在CentOS 7/6.5/6.4 下安裝PostgreSQL 9.3 與 phpPgAdmin
CentOS 6.3環境下yum安裝PostgreSQL 9.3
PostgreSQL緩衝詳述
Windows平台編譯 PostgreSQL
Ubuntu下LAPP(Linux+Apache+PostgreSQL+PHP)環境的配置與安裝
Ubuntu上的phppgAdmin安裝及配置
CentOS平台下安裝PostgreSQL9.3
PostgreSQL配置Streaming Replication叢集
------------------------------------華麗麗的分割線------------------------------------
PostgreSQL 的詳細介紹:請點這裡
PostgreSQL 的:請點這裡
本文永久更新連結地址: