Install Apache2 PHP5 Postgresql and phppgadmin on Debian Linux

Valic —  November 11, 2012 — 2 Comments

Hello, In this tutorial I will show you how to install theese tools in Debian Squeeze.

Step1. Install Apache2 PHP5 Postgresql and phppgadmin

apt-get update && apt-get install apache2 libapache2-mod-php5 php5 postgresql-8.4 phppgadmin

This command will update the repositories and install all the dependencies.

The following extra packages will be installed:
apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common file libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
libcap2 libdb4.7 libexpat1 libmagic1 libonig2 libpcre3 libpq5 libqdbm14 libxml2 lsb-release mime-support openssl perl perl-modules
php5-cli php5-common php5-pgsql php5-suhosin postgresql-client-8.4 postgresql-client-common postgresql-common postgresql-doc
postgresql-doc-8.4 python python-minimal python-support python2.6 python2.6-minimal sgml-base ssl-cert ucf xml-core
Suggested packages:
www-browser apache2-doc apache2-suexec apache2-suexec-custom php-pear lsb ca-certificates perl-doc libterm-readline-gnu-perl
libterm-readline-perl-perl make postgresql slony1-bin oidentd ident-server python-doc python-tk python-profiler python2.6-doc
python2.6-profiler binutils binfmt-support sgml-base-doc openssl-blacklist debhelper
The following NEW packages will be installed:
apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common file libapache2-mod-php5 libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 libdb4.7 libexpat1 libmagic1 libonig2 libpcre3 libpq5 libqdbm14 libxml2
lsb-release mime-support openssl perl perl-modules php5 php5-cli php5-common php5-pgsql php5-suhosin phppgadmin postgresql-8.4
postgresql-client-8.4 postgresql-client-common postgresql-common postgresql-doc postgresql-doc-8.4 python python-minimal
python-support python2.6 python2.6-minimal sgml-base ssl-cert ucf xml-core
0 upgraded, 46 newly installed, 0 to remove and 0 not upgraded.

 

Step2. Configure  PostgresSQL.


When you install PostgreSQL the default user is postgres and it has no password. You need to run the following commands to create a password for postgres user

root@srv:/# su postgres
postgres@srv:/$ psql
psql (8.4.13)
Type “help” for help.
postgres=# alter user postgres with password ‘yourpassword’;
ALTER ROLE
\q

Step3. Restart Postgres

/etc/init.d/postgresql restart

Step4. Now you can try to connect to postgresql using the new password.

su postgres
psql -U postgres -W
Password for user postgres:
psql (8.4.13)
Type “help” for help.
postgres=#

And it works!

Step5. Grand accces to phppgadmin for everyone:
First we need to edit the following line from file /etc/phppgadmin/config.inc.php
Change this line :

$conf['extra_login_security'] = true;

to this:

$conf['extra_login_security'] = false;

If this line is set to the vallue true we will not be able to authenticate on phppgadmin with admin users (pgsql, postgres, root, administrator).We will get this message:

Login disallowed for security reasons.

Then edit the following file /etc/apache2/conf.d/phppgadmin if you want to have access on phppgadmin from any location.
Change the file to look like this:

Directory /usr/share/phppgadmin/>

DirectoryIndex index.php

Options +FollowSymLinks
AllowOverride None

order deny,allow
deny from all
#allow from 127.0.0.0/255.0.0.0 ::1/128
allow from all

Step6. Restart apache2.

/etc/init.d/apache2 restart

Now you can login to phppgadmin and create and use databases.

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

2 responses to Install Apache2 PHP5 Postgresql and phppgadmin on Debian Linux

  1. Thank you for your great tutorials.

  2. thank you weeeerryyyyyyyyyy much

Leave a Reply

*

Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>