Linux ·

Ubuntu 16.04 下安装 PostgreSQL 和 phpPgAdmin

PostgreSQL 是一款强大的高性能的对象关系型数据库管理系统(ORDBMS),采用与BSD一样的授权方式。PostgreSQL是非常适合大型数据库,有许多先进的功能。PostgreSQL支持许多操作系统,包括Linux,FreeBSD,Solaris和Microsoft Windows。

phpPgAdmin 是管理PostgreSQL数据库基于PHP的Web应用程序。使用phpPgAdmin很容易创建一个数据库,创建一个角色,并在Postgres里创建表。下面说说在Ubuntu 16.04 下安装 PostgreSQL 和 phpPgAdmin的过程。

第一步:安装 PostgreSQL, phpPgAdmin 和 Apache2

sudo apt-get -y install postgresql postgresql-contrib phppgadmin

第二步:配置 PostgreSQL 用户

PostgreSQL使用的用户认证和授权类似UNIX权限角色。默认情况下,PostgreSQL创建了一个名为“Postgres”基本身份验证新用户。要使用PostgreSQL,您需要登录到“Postgres”账户,你可以通过键入:

sudo su
su - postgres

现在,您可以用命令访问PostgreSQL提示:

psql

然后更改Postgres角色的密码:

password postgres

ENTER YOUR PASSWORD

然后输入q退出psql命令行。

Ubuntu 16.04 下安装 PostgreSQL 和 phpPgAdmin

运行命令“exit”再次离开Postgres的用户,并成为root。

exit

第三步:配置Apache2

cd /etc/apache2/conf-available/
nano phppgadmin.conf

注释掉#Require local,添加allow from all,这样才可以从你的浏览器访问。

Ubuntu 16.04 下安装 PostgreSQL 和 phpPgAdmin

第四步:配置 phpPgAdmin

编辑文件 /etc/phppgadmin/config.inc.php :

cd /etc/phppgadmin/
nano config.inc.php

找到 $conf[‘extra_login_security’] = true; 修改为false。

你就可以使用 postgres 用户邓丽 phpPgAdmin。

phppgadmin_security_settings

第五步:重启 PostgreSQL 和 Apache2

systemctl restart postgresql
systemctl restart apache2

第六步:测试登录

浏览器输入:http://替换成你的IP地址/phppgadmin/

phppgadmin_start

phppgadmin_login

phppgadmin_dashboard

OK,好好享受成功的喜悦吧!

------------------------------------华丽丽的分割线------------------------------------

CentOS 6.5上编译安装PostgreSQL 9.3数据库 http://www.linuxidc.com/Linux/2016-06/132272.htm

CentOS 6.3环境下yum安装PostgreSQL 9.3 http://www.linuxidc.com/Linux/2014-05/101787.htm

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

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

CentOS平台下安装PostgreSQL9.3 http://www.linuxidc.com/Linux/2014-05/101723.htm

PostgreSQL配置Streaming Replication集群 http://www.linuxidc.com/Linux/2014-05/101724.htm

------------------------------------华丽丽的分割线------------------------------------

参与评论