Tuesday, May 19, 2009

PostgreSQL 8.1 + phppgadmin on Debian mini-HOWTO

Install required packages

apt­get update
apt­get install postgresql­8.1 postgresql­client­8.1 postgresql­doc­8.1 phppgadmin php5­pgsql
libapache2­mod­php5



First test with PostgreSQL
Login pgsql console as user "postgres":

localhost:~# su
localhost:~# su ­ postgres
postgres@localhost:~$ psql template1
Welcome to psql 8.1.9, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
template1=#


Update pgsql user "postgres" password (required by phppgadmin):


template1=# ALTER USER postgres PASSWORD 'passwd';
ALTER ROLE
template1=# \q
postgres@localhost:~$


Create pgsql user "root" with database "AL32UTF8", with basic login:
Welcome to psql 8.1.9, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
template1=# ALTER USER root PASSWORD 'passwd';
ALTER ROLE
template1=# \q
postgres@localhost:~$ psql AL32UTF8
Welcome to psql 8.1.9, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
AL32UTF8=# \q
postgres@localhost:~$ exit
logout
localhost:~# psql AL32UTF8
Password:
Welcome to psql 8.1.9, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
AL32UTF8=> \q
localhost:~#
localhost:~# su
localhost:~# su ­ postgres
postgres@localhost:~$ createuser ­DRS root
CREATE ROLE
postgres@localhost:~$ createdb ­O root AL32UTF8
CREATE DATABASE
postgres@localhost:~$ psql template1


Configure and working with phppgadmin
Edit /etc/phppgadmin/config.inc.php, change the following line from:
$conf['extra_login_security'] = true;

into:
$conf['extra_login_security'] = false;

in order to allow root/postgres user login from phppgadmin.
Create symbolic link for phppgadmin web access:
localhost:~# ln ­s /usr/share/phppgadmin/var/www/

Access http://localhost/phppgadmin, login as root or postgres, enjoy your newly installed
PostgreSQL server :)

No comments:

Post a Comment