欢迎光临
我们一直在努力

Ubuntu 12.04环境下配置Postgresql和phppgadmin

一、系统环境准备

先下载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账户

Ubuntu 12.04环境下配置Postgresql和phppgadmin

root账户启用后,用ssh远程登录上去配置,这样方便些。毕竟在服务器上操作不是很方便(我们单位有20多台服务器,接在了一个该死的KVM切换器上,由于VGA线路过长(20M),显示器跳的厉害。

Ubuntu 12.04环境下配置Postgresql和phppgadmin

推荐用 xshell这个软件进行远程管理

三、开始安装软件包

(1)安装postgresql

apt-get install postgresql

由于安装Ubuntu时,勾选了postgresql,所以系统提示已经安装了

Ubuntu 12.04环境下配置Postgresql和phppgadmin

(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 目录下

Ubuntu 12.04环境下配置Postgresql和phppgadmin

vi /etc/phppgadmin/apache.conf

Ubuntu 12.04环境下配置Postgresql和phppgadmin

#allow from 127.0.0.0/255.0.0.0 ::1/128
allow from all     取消这行注释,运行所有ip访问
vi /etc/phppgadmin/config.inc.php

Ubuntu 12.04环境下配置Postgresql和phppgadmin

// 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的网址就可以看到了

Ubuntu 12.04环境下配置Postgresql和phppgadmin

(4)配置postgresql 账户,不然phppgadmin是无法正常使用的

postgresql默认安装后,配置文件在 /etc/postgresql/9.1/main 目录下

Ubuntu 12.04环境下配置Postgresql和phppgadmin

先修改pg_hba.conf 文件

vi pg_hba.conf

Ubuntu 12.04环境下配置Postgresql和phppgadmin

加入: hostallall0.0.0.0 0.0.0.0 md5

允许所有IP通过md5密码验证方式访问

修改postgresql.conf

vi postgresql.conf

Ubuntu 12.04环境下配置Postgresql和phppgadmin

listen_addresses = '*'

重启数据库,让刚刚修改的配置文件生效

/etc/init.d/postgresql restart

Ubuntu 12.04环境下配置Postgresql和phppgadmin

给Postgresql的管理员账号 postgres配置密码,以便远程用户可以访问

Ubuntu 12.04环境下配置Postgresql和phppgadmin

su - postgres

psql

ALTER USER postgres PASSWORD '190123';

q

exit

五、测试phppgadmin

Ubuntu 12.04环境下配置Postgresql和phppgadmin

Ubuntu 12.04环境下配置Postgresql和phppgadmin

Ubuntu 12.04环境下配置Postgresql和phppgadmin

输入刚刚修改的密码,例如postgres   、190123

Ubuntu 12.04环境下配置Postgresql和phppgadmin

至此,phpPgadmin安装配置成功了。

六、顺便推荐一个windows下的客户端

Windows 7 下面的PostgreSQL客户端管理工具安装

下载地址:

http://www.postgresql.org/ftp/pgadmin3/release/v1.18.1/win32/

Ubuntu 12.04环境下配置Postgresql和phppgadmin

下载完毕后,一路 Next就可以安装完毕了

Ubuntu 12.04环境下配置Postgresql和phppgadmin

软件装好了,打开如下界面

Ubuntu 12.04环境下配置Postgresql和phppgadmin

Ubuntu 12.04环境下配置Postgresql和phppgadmin

Ubuntu 12.04环境下配置Postgresql和phppgadmin

参考文献:

http://wiki.ubuntu.org.cn/index.php?title=UbuntuHelp:PhpPgAdmin&redirect=no

本文出自: http://blog.csdn.net/zjianbo/article/details/16623879

窗外天空
关注公众号『窗外天空』

获取更多建站运营运维新知!
互联网创业、前沿技术......

赞(0) 打赏
文章名称:《Ubuntu 12.04环境下配置Postgresql和phppgadmin》
文章链接:https://www.nixonli.com/8500.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏