Ubuntu 16.04 怎样安装 PostgreSQL 和 phpPgAdmin

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

phpPgAdmin 是管理PostgreSQL数据库基于PHP的Web应用程序。使用phpPgAdmin很容易创建一个数据库,创建一个角色,并在Postgres里创建表。

第一步:安装 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命令行。

psql_command_line

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

exit

第三步:配置Apache2

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

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

allow_from_all

第四步:配置 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,好好享受成功的喜悦吧!

投稿作者 作者网站

评论

 
 

发表评论

 
你的昵称*
电子邮件*
网址(选填)
我的评论*
  • 发表评论
  • 为您推荐


    请支持IMCN发展!

    谁在捐赠

    微信捐赠 支付宝捐赠
    微信捐赠 支付宝捐赠
    ta的个人站点

    发表文章4156篇

    关注我的头条 不要放弃,百折不挠,坚强、自信。





    微信公众号二维码

    归档