doco on creating database manually
[freeside.git] / httemplate / docs / install.html
1 <head>
2   <title>Installation</title>
3 </head>
4 <body>
5 <h1>Installation</h1>
6 Before installing, you need:
7 <ul>
8   <li>A web server, such as <a href="http://www.apache-ssl.org">Apache-SSL</a> or <a href="http://www.apache.org">Apache</a>
9   <li><a href="http://perl.apache.org/">mod_perl</a>
10   <li><a href="http://www.openssh.com//">SSH</a> (<a href="http://www.openssh.com//">OpenSSH</a> is recommended.  SSH Communications Security <a href="http://www.ssh.com/products/ssh/download.cfm">commercial SSH version 3</a> has been reported incompatible with Freeside.)
11   <li><a href="http://www.perl.com/">Perl</a>  Don't enable experimental features like threads or the PerlIO abstraction layer.
12   <li>A <b>transactional</b> database engine supported by Perl's <a href="http://www.hermetica.com/technologia/DBI/">DBI</a>.
13     <ul>
14       <li><a href="http://www.postgresql.org/">PostgreSQL</a> (v7 or higher) is recommended.
15       <li>MySQL has been reported to work.  <b>MySQL's default <a href="http://www.mysql.com/doc/M/y/MyISAM.html">MyISAM</a> and <a href="http://www.mysql.com/doc/I/S/ISAM.html">ISAM</a> table types are not supported</b>.  If you really want to use MySQL, you need to use one of the new <a href="http://www.mysql.com/doc/T/a/Table_types.html">transaction-safe table types</a> such as <a href="http://www.mysql.com/doc/B/D/BDB.html">BDB</a>, and set it as the default table type using the <code>--default-table-type=BDB</code> <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Command-line_options">mysqld command-line option</a> or by setting <code>default-table-type=BDB</code> in the <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Option_files">my.cnf option file</a>.
16     </ul>
17   <li>Perl modules (<a href="http://theoryx5.uwinnipeg.ca/CPAN/perl/CPAN.html">CPAN</a> will query, download and build perl modules automatically)
18     <ul>
19       <li><a href="http://search.cpan.org/search?dist=Array-PrintCols">Array-PrintCols</a>
20       <li><a href="http://search.cpan.org/search?dist=Term-Query">Term-Query</a> (make test broken; install manually)
21       <li><a href="http://search.cpan.org/search?dist=MIME-Base64">MIME-Base64</a>
22       <li><a href="http://search.cpan.org/search?dist=Digest-MD5">Digest-MD5</a>
23       <li><a href="http://search.cpan.org/search?dist=URI">URI</a>
24       <li><a href="http://search.cpan.org/search?dist=HTML-Tagset">HTML-Tagset</a>
25       <li><a href="http://search.cpan.org/search?dist=HTML-Parser">HTML-Parser</a>
26       <li><a href="http://search.cpan.org/search?dist=libnet">libnet</a>
27       <li><a href="http://search.cpan.org/search?dist=Locale-Codes">Locale-Codes</a>
28       <li><a href="http://search.cpan.org/search?dist=Net-Whois">Net-Whois</a>
29       <li><a href="http://search.cpan.org/search?dist=libwww-perl">libwww-perl</a>
30       <li><a href="http://search.cpan.org/search?dist=Business-CreditCard">Business-CreditCard</a>
31       <li><a href="http://search.cpan.org/search?dist=Data-ShowTable">Data-ShowTable</a>
32       <li><a href="http://search.cpan.org/search?dist=MailTools">MailTools</a>
33       <li><a href="http://search.cpan.org/search?dist=TimeDate">TimeDate</a>
34       <li><a href="http://search.cpan.org/search?dist=DateManip">DateManip</a>
35       <li><a href="http://search.cpan.org/search?dist=File-CounterFile">File-CounterFile</a>
36       <li><a href="http://search.cpan.org/search?dist=FreezeThaw">FreezeThaw</a>
37       <li><a href="http://search.cpan.org/search?dist=String-Approx">String-Approx</a>
38       <li><a href="http://search.cpan.org/search?dist=Text-Template">Text-Template</a>
39       <li><a href="http://search.cpan.org/search?dist=Archive-Tar">Archive-Tar</a>
40       <li><a href="http://search.cpan.org/search?dist=DBI">DBI</a>
41       <li><a href="http://search.cpan.org/search?mode=module&query=DBD">DBD for your database engine</a>
42       <li><a href="http://search.cpan.org/search?dist=DBIx-DataSource">DBIx-DataSource</a>
43       <li><a href="http://search.cpan.org/search?dist=DBIx-DBSchema">DBIx-DBSchema</a>
44       <li><a href="http://search.cpan.org/search?dist=Net-SSH">Net-SSH</a>
45       <li><a href="http://search.cpan.org/search?dist=String-ShellQuote">String-ShellQuote</a>
46       <li><a href="http://search.cpan.org/search?dist=Net-SCP">Net-SCP</a>
47       <li><a href="http://www.apache-asp.org/">Apache::ASP</a> or <a href="http://www.masonhq.com/">HTML::Mason</a>
48     </ul>
49 </ul>
50 Install the Freeside distribution:
51 <ul>
52   <li>Add the user `freeside' to your system.
53   <li>Allow the freeside user full access to the freeside database.
54     <ul>
55       <li> with <a href="http://www.postgresql.org/users-lounge/docs/7.1/postgres/user-manag.html#DATABASE-USERS">PostgreSQL</a>:
56         <pre>
57 $ su postgres
58 $ createuser -P freeside</pre>
59       <li> with <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#User_Account_Management">MySQL</a>:
60         <pre>
61 $ mysqladmin -u root password '<i>set_a_root_database_password</i>'
62 $ mysql -u root -p
63 mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* TO freeside@localhost IDENTIFIED BY '<i>set_a_freeside_database_password</i>';</pre>
64     </ul>
65   <li>Unpack the tarball: <pre>gunzip -c fs-x.y.z.tar.gz | tar xvf -</pre>
66   <li>Edit the top-level Makefile:
67     <ul>
68       <li>Set <tt>DATASOURCE</tt> to your <a href="http://search.cpan.org/doc/TIMB/DBI-1.20/DBI.pm">DBI data source</a>, for example, <tt>DBI:Pg:host=localhost;dbname=freeside</tt> for PostgresSQL or <tt>DBI:mysql:freeside</tt> for MySQL.  See the <a href="http://search.cpan.org/doc/TIMB/DBI-1.20/DBI.pm">DBI manpage</a> and the <a href="http://search.cpan.org/search?mode=module&query=DBD">manpage for your DBD</a> for the exact syntax of a DBI data source.
69       <li>Set <tt>DB_ADMIN_PASSWORD</tt> to the freeside database user's password.
70     </ul>
71   <li>Add the freeside database to your database engine:
72     <pre>
73 $ su
74 # make create-database</pre>
75     (or manually, with Postgres:)
76     <pre>
77 $ su freeside
78 $ createdb freeside</pre>
79     (with MySQL:)
80     <pre>
81 $ mysqladmin -u freeside -p create freeside </pre>
82   <li>Build and install the Perl modules:
83     <pre>
84 $ make perl-modules
85 $ su
86 # make install-perl-modules</pre>
87     <li>Create the necessary configuration files:<pre>
88 $ su
89 # make create-config
90 </pre>
91     <li>You should run a separate iteration of Apache[-SSL] with mod_perl enabled as the freeside user.
92 </ul>
93 <table>
94   <tr>
95     <th>Apache::ASP</th><th>Mason</th>
96   </tr>
97   <tr>
98     <td><ul>
99       <li>Run <tt>make aspdocs</tt>
100       <li>Copy <tt>aspdocs/</tt> to your web server's document space.
101       <li>Create a <a href="http://www.apache-asp.org/config.html#Global">Global</a> directory, such as <tt>/usr/local/etc/freeside/asp-global/</tt>
102       <li>Copy <tt>htetc/global.asa</tt> to the Global directory.
103       <li>Configure Apache for the Global directory and to execute .cgi files using Apache::ASP.  For example:
104 <font size="-1"><pre>
105 &lt;Directory /usr/local/apache/htdocs/freeside-asp&gt;
106 &lt;Files ~ (\.cgi)&gt;
107 AddHandler perl-script .cgi
108 PerlHandler Apache::ASP
109 &lt;/Files&gt;
110 &lt;Perl&gt;
111 $MLDBM::RemoveTaint = 1;
112 &lt;/Perl&gt;
113 PerlSetVar Global /usr/local/etc/freeside/asp-global/
114 &lt;/Directory&gt;
115 </pre></font>
116     </ul></td>
117     <td><ul>
118       <li>NOTE: Mason support is still a bit buggy in the 1.4.0 prereleases.  This will be fixed before 1.4.0.  You have been warned.
119       <li>Run <tt>make masondocs</tt>
120       <li>Copy <tt>masondocs/</tt> to your web server's document space.
121       <li>Copy <tt>htetc/handler.pl</tt> to your web server's configuration directory.
122       <li>Edit <tt>handler.pl</tt> and set an appropriate <tt>data_dir</tt>, such as <tt>/usr/local/etc/freeside/mason-data</tt>
123       <li>Configure Apache to use the <tt>handler.pl</tt> file and to execute .cgi files using HTML::Mason.  For example:
124 <font size="-1"><pre>
125 &lt;Directory /usr/local/apache/htdocs/freeside-mason&gt;
126 &lt;Files ~ (\.cgi)&gt;
127 AddHandler perl-script .cgi
128 PerlHandler HTML::Mason
129 &lt;/Files&gt;
130 &lt;Perl&gt;
131 require "/usr/local/apache/conf/handler.pl";
132 &lt;/Perl&gt;
133 &lt;/Directory&gt;
134 </pre></font>
135     </ul></td>
136   </tr>
137 </table>
138 <ul>
139 <li>Restrict access to this web interface - see the <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache documentation on user authentication</a>.    For example, to configure user authentication with <a href="http://httpd.apache.org/docs/mod/mod_auth.html">mod_auth</a> (flat files):
140 <pre>
141 &lt;Directory /usr/local/apache/htdocs/freeside-asp&gt;
142 PerlSetVar Global /usr/local/etc/freeside/asp-global/
143 AuthName Freeside
144 AuthType Basic
145 AuthUserFile /usr/local/etc/freeside/htpasswd
146 require valid-user
147 &lt;/Directory&gt;
148 </pre>
149   <li>Create one or more Freeside users (your internal sales/tech folks, not customer accounts).  These users are setup using using Apache authentication, not UNIX user accounts.  For example, using <a href="http://httpd.apache.org/docs/mod/mod_auth.html">mod_auth</a> (flat files):
150     <ul>
151       <li>First user:<font size="-1">
152 <pre>$ su
153 $ freeside-adduser -c -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
154       <li>Additional users:<font size="-1">
155 <pre>$ su
156 $ freeside-adduser -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
157     </ul>
158   <i>(using other auth types, add each user to your <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache authentication</a> and then run: <tt>freeside-adduser <b>username</b></tt></i>
159   <li>As the freeside UNIX user, run <tt>bin/fs-setup <b>username</b></tt> to create the database tables, passing the username of a Freeside user you created above:
160 <pre>
161 $ su freeside
162 $ bin/fs-setup <b>username</b>
163 </pre>
164   <li><tt>freeside-queued</tt> was installed with the Perl modules.  Start it now and ensure that is run upon system startup.
165   <li>Now proceed to the initial <a href="admin.html">administration</a> of your installation.
166 </ul>
167 </body>