FreeBSD 7.0-RELEASE-i386

# cd /usr/ports/databases/postgresql83-server && make install clean
# echo ‘postgresql_enable=”YES”‘ >> /etc/rc.conf
# /usr/local/etc/rc.d/postgresql initdb
# passwd pgsql
# su – pgsql
$ createuser -P -s -e XXXX (创建一个新的超级用户)

安装phpPgAdmin
# cd /usr/ports/databases/phppgadmin && make install clean
# ee /usr/local/etc/apache22/Includes/phppgadmin.conf

Alias /phppgadmin/ “/usr/local/www/phpPgAdmin/”

<Directory “/usr/local/www/phpPgAdmin/”>
Options none
AllowOverride Limit

Order Deny,Allow
Deny from all
#Allow from 127.0.0.1 .example.com
Allow from 127.0.0.1 192.168
#Allow from all
</Directory>

# ee /usr/local/www/phpPgAdmin/conf/config.inc.php

$conf[‘default_lang’] = ‘chinese-utf8-zh_CN’;

# apachectl restart

http://localhost/phppgadmin/

安装过程错误解决:
如果先安装了KDE3或者其他软件,再安装postgresql83可能会提示冲突终止安装,比如提示postgresql81-client冲突.
# cd /usr/ports/databases/postgresql81-client && make deinstall
卸载postgresql81-client再重新安装
如果有安装PHP5还要重新安装pgsql.so和pdo_pgsql.so
# cd /usr/ports/databases/php5-pgsql && make deinstall
# cd /usr/ports/lang/php5-extensions && make reinstall clean FORCE_PKG_REGISTER=YES

重启PGSQL
$ pg_ctl restart -D /usr/local/pgsql/data/
重载配置文件
$pg_ctl reload -D /usr/local/pgsql/data/

远程登录

postgresql.conf

listen_addresses = ‘*’

pg_hba.conf

hostssl all all 192.168.0.1/24 md5
hostssl all all 12.12.151.15/32 md5


免费在线记账服务,个人理财好帮手,小型企业财务管理工具。
http://www.keepaccounts.com/

One Comment

  • david

    可以使用任意密码登陆phppgadmin,这是很危险的。

    PostgreSQL 默认运行于”信任模式”。意思是对于本地连接不检查密码。

    建议你修改 pg_hba.conf 文件,并将登陆类型改为 ‘md5’。

    注意,一旦你将’local’登陆类型修改为’md5’,你就可能需要在启动 PostgreSQL 的时候输入密码。

    要避开它,可以使用一个 .pgpass 文件,相关说明请参考 PostgreSQL 文档 libpq 部分。

    # “local” is for Unix domain socket connections only
    local all all md5
    # IPv4 local connections:
    host all all 127.0.0.1/32 md5
    # IPv6 local connections:
    host all all ::1/128 md5

    原本是 trust

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *