您的位置:首页 > 编程语言 > PHP开发

Ubuntu 12.04环境下配置Postgresql和phppgadmin

2013-11-17 22:50 381 查看
Ubuntu 12.04环境下配置Postgresql 9.1 和phppgadmin

本系列文章由ex_net(张建波)编写,转载请注明出处。


http://blog.csdn.net/zjianbo/article/details/16623879


作者:张建波 邮箱: 281451020@qq.com 电话:13577062679 欢迎来电交流!

一、系统环境准备
         先下载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 



加入: host all all 0.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
五、测试phppgadmin






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


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

六、顺便推荐一个windows下的客户端        Windows 7 下面的PostgreSQL客户端管理工具安装
           下载地址:
                         http://www.postgresql.org/ftp/pgadmin3/release/v1.18.1/win32/



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



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







参考文献:        http://wiki.ubuntu.org.cn/index.php?title=UbuntuHelp:PhpPgAdmin&redirect=no
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: