-
Notifications
You must be signed in to change notification settings - Fork 104
PostgreSQL
See the bottom of the page for the contents to create the files plpgsql.sql and CreateDatabase.sql. Place those files in your home directory or any working directory
First, you'll need to run as the postgres user:
su postgres
if you don't already have the plpgsql language installed, install it:
psql -d template1 -f plpgsql.sql
Run
psql -d template1 -f CreateDatabase.sql
Create a mojoportal user:
createuser --pwprompt --no-adduser --no-createdb mojo
Ensure that mojo can connect through TCP/IP
If your database server and webserver are on the same machine, add these 2 lines to the the top of /var/lib/pgsql/data/pg_hba.conf to create the least privileged settings for mojo to connect from the local machine.
host mojoportal mojo ::1/128 password
host mojoportal mojo 127.0.0.1 255.255.255.255 password
If your database server and webserver are on different machines, make sure the firewall on the database server machine is open to tcp traffic on port 5432 from the webserver and see the PostgreSQL documentation for details on setting listen_addresses in postgresql.conf and setting up pg_hba.conf to allow access from remote hosts.
If you want to make the postgresql server listen on all its ip addresses, in /var/lib/pgsql/data/postgresql.conf:
listen_addresses = '*'
By default it is only listening on the loopback address 127.0.0.1 you can also specify an IP address range if you don't want it to listen on all its addresses, but often there is only 1 address anyway.
As root, restart posgresql.
/etc/init.d/postgresql restart
Make sure that you change the password in the web.config or user.config to the password you specified when you created the mojo user.
Navigate to yoursiteroot/Setup/Default.aspx
Create the above script files as follows:
plpgsql.sql:
SET search_path = public, pg_catalog;
CREATE FUNCTION plpgsql_call_handler () RETURNS language_handler
AS '$libdir/plpgsql', 'plpgsql_call_handler'
LANGUAGE c;
CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
CreateDatabase.sql:
CREATE DATABASE mojoportal WITH TEMPLATE = template1 ENCODING = 'UNICODE';