Ubuntu 16.04 LAPP Setup

From myWiki

Using Ubuntu 16.04 as a host

Install Apache

sudo apt-get install apache2
sudo apt install libapache2-mod-php

Install Postgresql

sudo apt-get install postgresql postgresql-contrib

The contrib is used with PGadmin III. The install creates a system user account: postgres

Change O/S user to postgres and open a Postgres session

sudo -i -u postgres
psql

In the pg_hba.conf, change the host to 'trust' to get operational

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

In the postgresql.conf, change 'listen_addresses' to get operational

listen_addresses = '*'

After creating tables and accounts, login using:

$ psql -h localhost -U test -d test

Install PHP 7.0

sudo apt-get install php
sudo apt-get install php-pgsql php-cgi

Restart apache2

sudo service apache2 restart