Prerequisites:

1. A working PostgreSQL installation. Superuser access is required. STuNT has been tested with versions 7.3.x and 7.4.x.

2. A working web server.

Overview: 

STuNT is just a bunch of perl scripts. Some of them are used as CGI programs, others are called from cron to perform day-to-day jobs.
The application is designed to run on a dedicated server, with PostgreSQL and web server running on the same system. There are NOT any security measures for users with local shell access to the system.
It is necessary to disable all 'trust' access to the database. All access to the specific database should be done with the 'password' method, and only from the host running the webserver (usually localhost). Here is a sample pg_hba.conf file:

local   all         all                                             password
host    all         all         127.0.0.1         255.255.255.255   password
host    all         all         0.0.0.0           0.0.0.0           reject


Step 1: 

Create the PostgreSQL user groups needed by the application. The groups are created with specific SYSIDs (100-104), because SYSIDs are used to control how the menus are created for each used depending on the group the user belongs. You can use other SYSIDs if the defaults are already used in your installation, but then you will have to reflect the changes in the contents of the table zs_menus (vfg column).

To create the groups, run the PostgresDesign/Grants/0_groups SQL script:

psql -U postgres template1 < 0_groups

Step 2:

Create the database and load the default schema and data. The default schema and data are in the PostgresDesign/Dumps/clean_dump.sql script. The database name can be anything, but for the rest of this document we will use the name 'stunt':

createdb -U postgres stunt
psql -U postgres stunt < clean_dump.sql

Step 3: 

Install the required perl modules if not present. You can use CPAN or install them manually. The required modules are: 

Crypt::PasswdMD5
AppConfig
DBI
DBD::Pg
CGI
Mail::Sender
MIME::QuotedPrint
GD::Graph::pie
GD::Graph::bars
Unicode::String
Unicode::Map
Unicode::Map8
Unicode::MapUTF8

Step 4:

Install the .pm files found in the /PerlCode/Libs directory. The files should be installed somewhere in @INC (for example /usr/lib/perl5/site_perl/5.8.0).

Step 5: 

Install the CGI perl scripts found in the /PerlCode/CGI directory. The files should be installed in the cgi-bin directory of your web server or to a similar directory. chmod +x them.

Step 6: 

Copy the stunt.conf file found in /Conf to /etc/stunt.conf. This is the main configuration file of STuNT. Review this file, paying notice to each directive. Create or define all the necessary paths. See the configuration guide for details.

Step 7: 

Copy the cron scripts (.sh and .pl, found in /Scripts) somewhere in the system (i use /usr/local/scripts). The files should be readable *only* by the user that will run them, because you need to have the superuser postgres password in the .sh files. Check also the pgdbf.pl file and if needed, update the $datadir, $dbname, $maxkeep and $pidfile variables.

Step 8: 

You need to create a company and a company location for the postgres user to be
able to login in STuNT. The user record is already there, and we assume that there is a postgresql user with userid postgres. The user record is already assigned to the company location with id 1, so you need to do the following:

Create a company record:

INSERT INTO st_companies(name) VALUES('Your Company Name');

Check the id of the new company:

SELECT id FROM st_companies;

Create a company location using the id returned from the above command as a value for the company_id field:

INSERT INTO st_companieslocations(name, description, company_id) VALUES ('Your location name', 'A description', <company id>);

(the rest of the location fields can be updated later).

Check the id of the new location:

SELECT id FROM st_companieslocations;

Update the postgres record in st_users table by setting companylocation_id to the value returned above:

UPDATE st_users SET companylocation_id=<company location id> WHERE username = 'postgres';

If the /etc/stunt.conf file is correct, you should be able to login as 'postgres' now. But before trying ...

Step 9:

...read the README.configuration file.


