歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 12.04環境下配置PostgreSQL和phpPgAdmin

Ubuntu 12.04環境下配置PostgreSQL和phpPgAdmin

日期:2017/2/28 14:38:29   编辑:Linux教程

一、系統環境准備

先下載Ubuntu 12.04的安裝包,這裡我用的是64位的系統

http://mirrors.zju.edu.cn/ubuntu-releases//precise/ubuntu-12.04.3-server-amd64.iso

一路Next,默認安裝即可。 只是配置防火牆的時候注意吧 ssh 、postgresql勾勒!

二、系統配置

為了方便後面的安裝配置,先把root賬號啟用

sudo passwd root #給root用戶設置密碼

設置密碼為123456

su root #切換到root賬戶

root賬戶啟用後,用ssh遠程登錄上去配置,這樣方便些。畢竟在服務器上操作不是很方便(我們單位有20多台服務器,接在了一個該死的KVM切換器上,由於VGA線路過長(20M),顯示器跳的厲害。

推薦用 xshell這個軟件進行遠程管理

三、開始安裝軟件包

(1)安裝postgresql

apt-get install postgresql

由於安裝Ubuntu時,勾選了postgresql,所以系統提示已經安裝了

(2)安裝php運行環境

apt-get install apache2

apt-get install php5

apt-get install php5-pgsql

apt-get install php5-gd

(3)安裝phppgadmin

apt-get install phppgadmin

四、配置phppgadmin和apache

phppgadmin安裝完畢後,默認的配置文件位於 /etc/phppgadmin 目錄下


(1)vi /etc/phppgadmin/apache.conf


#allow from 127.0.0.0/255.0.0.0 ::1/128
allow from all 取消這行注釋,運行所有ip訪問

(2)vi /etc/phppgadmin/config.inc.php



// If extra login security is true, then logins via phpPgAdmin with no
// password or certain usernames (pgsql, postgres, root, administrator)
// will be denied. Only set this false once you have read the FAQ and
// understand how to change PostgreSQL's pg_hba.conf to enable
// passworded local connections.
$conf['extra_login_security'] = false;

(3)重新啟動apache2

/etc/init.d/apache2 restart

打開浏覽器輸入phppgadmin的網址就可以看到了


(4)配置postgresql 賬戶,不然phppgadmin是無法正常使用的

postgresql默認安裝後,配置文件在 /etc/postgresql/9.1/main 目錄下


先修改pg_hba.conf 文件

vi pg_hba.conf


加入: hostallall0.0.0.0 0.0.0.0 md5

允許所有IP通過md5密碼驗證方式訪問

修改postgresql.conf

vi postgresql.conf

listen_addresses = '*'

重啟數據庫,讓剛剛修改的配置文件生效

/etc/init.d/postgresql restart


給Postgresql的管理員賬號 postgres配置密碼,以便遠程用戶可以訪問


su - postgres

psql

ALTER USER postgres PASSWORD '190123';

\q

exit

更多詳情見請繼續閱讀下一頁的精彩內容: http://www.linuxidc.com/Linux/2013-11/92933p2.htm

PostgreSQL 的詳細介紹:請點這裡
PostgreSQL 的下載地址:請點這裡

PostgreSQL緩存詳述 http://www.linuxidc.com/Linux/2013-07/87778.htm

Windows平台編譯 PostgreSQL http://www.linuxidc.com/Linux/2013-05/85114.htm

Ubuntu下LAPP(Linux+Apache+PostgreSQL+PHP)環境的配置與安裝 http://www.linuxidc.com/Linux/2013-04/83564.htm

phpPgAdmin 的詳細介紹:請點這裡
phpPgAdmin 的下載地址:請點這裡

Ubuntu上的phppgAdmin安裝及配置 http://www.linuxidc.com/Linux/2011-08/40520.htm

Copyright © Linux教程網 All Rights Reserved