安装软件包
sudo apt-get install postgresql postgresql-contrib
配置apache2
sudo vim /etc/apache2/conf-available/phppgadmin.conf
内容如下
<Directory /usr/share/phppgadmin>
DirectoryIndex index.php
AllowOverride None
Allow from all
# Only allow connections from localhost:
#Require local
<IfModule mod_php5.c>
查看页面
http://192.168.1.125/phppgadmin/
设置postgresql账号和密码
账号为test,密码为password
sudo -u postgres psql template1
template1=# create user test with password 'password' createdb createuser;
成功登陆数据库
温馨提示:数据库一般不要让其他客户端直接连接,你可以提供http的接口或者其他方式,所以我这里也没有配置其他客户端连接。