Home > Articles > Data

  • Print
  • + Share This

Install and Configure PostgeSQL

For detailed instructions on installing and configuring PostgreSQL, see Jeff MacDonald's article, "Installing PostgreSQL."

You'll want to change PostgreSQL's block size from the default 8KB to 16KB in order to take full advantage of the toolkit. Before running the configuration and installation procedures described in the above article, edit config.h.in in the source tree. If you've created a user postgres with a home directory of /home/postgres, the file will be found in the directory /home/postgres/pgsql/src/include.

Change this line

#define BLCKSZ  8192

to this line:

#define BLCKSZ  16384

Then configure, build, and start PostgreSQL as usual.

With Postgres running, you should next create a database and a PostgreSQL user for OpenACS. If you've done a standard PostgreSQL installation, you'll need to do the following when you are logged in as postgres:

[postgres@goshawk postgres]$ createuser acs
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER

Next, create the OpenACS database:

[postgres@goshawk postgres]$ createdb acs
CREATE DATABASE

Finally, install the PL/pgPSQL language in the acs database:

[postgres@goshawk postgres]$ createlang plpgsql acs

You are now ready to load the OpenACS datamodel (the CREATE TABLE and other SQL statements needed for OpenACS to run) and initial data. Log in as the acs user and then execute the following commands:

[acs@goshawk acs]$ cd /home/acs/acspg/www/install
[acs@goshawk acs]$ ./load-geo-tables >& data.log
[acs@goshawk acs]$ grep ERROR data.log

I used grep to make sure that no errors occurred when I execute the script.

[acs@goshawk acs]$ cd ../doc/sql
[acs@goshawk acs]$ psql -f load-data-model.sql >& model.log

The second command, which creates hundreds of tables, sequences, and other PostgreSQL objects, may take several minutes to complete. The current script attempts to install PL/pgSQL; ignore the two errors that result because you already installed it earlier:

[acs@goshawk acs]$ grep ERROR *.log
psql:postgres.sql:14: ERROR:  Only users with Postgres superuser privilege are permitted to create a
  function in the 'C' language.  Others may use the 'sql' language or the created procedural
  languages.
psql:postgres.sql:18: ERROR:  Only users with Postgres superuser privilege are permitted to create
  procedural languages
[acs@goshawk acs]$

The datamodel and initial data should now be loaded. The following query will check that the system and anonymous users have correctly been created:

[acs@gyrfalcon sql]$ psql
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

acs=> select first_names from users;
 first_names 
-------------
 system
 anonymous
(2 rows)

acs=> 
  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.