Difference between revisions of "Freeside:2.1:Documentation:Installation"

From Freeside
Jump to: navigation, search
(Database Access)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== 1. Install the base system ==
+
== Introduction ==
- Only select the OpenSSH Package
 
 
== 2. Configure the network ==
 
  
Change the server to static IP
+
Install Freeside on a firewalled, private server, not a public (web, RADIUS, etc.) server.
<pre>
+
 
nano /etc/network/interfaces
+
== Prerequisites ==
</pre>
+
 
Replace the below settings with you own ip addresses etc
+
=== Packages ===
<pre>
+
 
# This file describes the network interfaces available on your system
+
* [http://www.perl.org/ Perl], minimum version 5.8.4
# and how to activate them. For more information, see interfaces(5).
+
* [http://httpd.apache.org/ Apache], SSL highly recommended)
 +
* [http://perl.apache.org/ mod_perl]
 +
** If compiling your own mod_perl, make sure you set the EVERYTHING=1 compile-time option
 +
* A '''transactional''' database engine [http://search.cpan.org/search?mode=module&query=DBD%3A%3A supported] by Perl's [http://dbi.perl.org/ DBI].
 +
** [http://www.postgresql.org PostgreSQL] is recommended (v7.2 or later, v8.1 or later recommended).
 +
** [http://www.mysql.com MySQL] (v4.1 or later, v5 recommended) is supported.  DBIx::DBSchema 0.35 or later is required.
 +
 
 +
''Note: the above only applies to the database used by the Freeside software itself. Freeside can integrate with RADIUS and other servers running a different database than the backend.''
 +
 
 +
* TeX (teTeX / TeX Live) and Ghostscript (included with most distributions) (Optional, enables typeset invoices)
 +
 
 +
=== Perl modules ===
  
# The loopback network interface
+
==== Popular modules ====
auto lo
 
iface lo inet loopback
 
  
# The primary network interface
+
These modules are included in most distributions.
auto eth0
+
<!-- reference: CentOS/RHEL 5, i.e. http://linux.mirrors.es.net/centos/5/os/x86_64/CentOS/
iface eth0 inet static
+
if its there, its everywhere... right? -->
        address 192.168.0.100
 
        netmask 255.255.255.0
 
        network 192.168.0.0
 
        broadcast 192.168.0.255
 
        gateway 192.168.0.1
 
</pre>
 
  
Set the hostname correctly
+
* [http://search.cpan.org/dist/libwww-perl libwww-perl] (CPAN: "install Bundle::LWP")
<pre>
+
** [http://search.cpan.org/dist/URI URI]
nano /etc/hosts
+
** [http://search.cpan.org/dist/HTML-Tagset HTML::Tagset]
</pre>
+
** [http://search.cpan.org/dist/HTML-Parser HTML::Parser]
 +
* [http://search.cpan.org/dist/DBI DBI]
 +
** [http://search.cpan.org/search?mode=module&query=DBD%3A%3A DBD] for your database engine ([http://search.cpan.org/dist/DBD-Pg DBD::Pg] for PostgreSQL or [http://search.cpan.org/dist/DBD-mysql DBD::mysql] for MySQL)
 +
* [http://search.cpan.org/dist/TimeDate TimeDate] (CPAN: "install Date::Format")
 +
* [http://search.cpan.org/dist/DateManip Date::Manip]
  
<pre>
+
==== Common modules ====
127.0.0.1      localhost.localdomain  localhost
 
192.168.0.100  server1.example.com    server1
 
  
# The following lines are desirable for IPv6 capable hosts
+
These modules are included in many distributions.
::1    localhost ip6-localhost ip6-loopback
+
<!-- more nebulous criteria, but should be included in at least Debian, FreeBSD ports, have sigificant Perl mindshare -->
fe00::0 ip6-localnet
 
ff00::0 ip6-mcastprefix
 
ff02::1 ip6-allnodes
 
ff02::2 ip6-allrouters
 
</pre>
 
  
<pre>
+
* [http://search.cpan.org/dist/Chart Chart] (CPAN: "install Chart::Base")
echo server1.example.com > /etc/hostname
+
* [http://search.cpan.org/dist/Cache-Cache Cache::Cache]
/etc/init.d/hostname restart
+
* [http://search.cpan.org/dist/DateTime DateTime]
</pre>
+
* [http://search.cpan.org/dist/DateTime-Format-Strptime DateTime::Format::Strptime]
 +
* [http://search.cpan.org/dist/DateTime-Format-Natural DateTime-Format-Natural]
 +
* [http://search.cpan.org/dist/Email-Sender Email::Sender]
 +
* [http://search.cpan.org/dist/Email-Sender-Transport-SMTP-TLS Email::Sender::Transport::SMTP::TLS]
 +
* [http://search.cpan.org/dist/HTML-Mason HTML::Mason]
 +
* [http://search.cpan.org/dist/Locale-Codes Locale-Codes] (CPAN: "install Locale::Country")
 +
* [http://search.cpan.org/dist/Locale-SubCountry Locale::SubCountry]
 +
* [http://search.cpan.org/dist/MailTools MailTools] (CPAN: "install Mail::Internet")
 +
* [http://search.cpan.org/dist/MIME-tools MIME::Tools] (Note: do not use version 5.423)
 +
* [http://search.cpan.org/dist/NetAddr-IP NetAddr::IP]
 +
* [http://search.cpan.org/dist/Net-Ping Net::Ping]
 +
* [http://search.cpan.org/dist/Net-Ping-External Net::Ping::External]
 +
* [http://search.cpan.org/dist/Number-Format Number::Format]
 +
* [http://search.cpan.org/dist/Spreadsheet-WriteExcel Spreadsheet::WriteExcel]
 +
* [http://search.cpan.org/dist/String-Approx String::Approx]
 +
* [http://search.cpan.org/dist/Text-CSV_XS Text::CSV_XS]
 +
* [http://search.cpan.org/dist/Term-ReadKey Term::ReadKey]
 +
* [http://search.cpan.org/dist/Text-Template Text::Template]
  
==3. Update the system==
+
==== Additional modules ====
  
<pre>
+
<!-- our modules (DBIx::DBSchema, Net::SSH, H:W:SelectLayers, etc.) and other modules with questionable mindshare and distro pickup. -->
apt-get update
 
apt-get upgrade
 
</pre>
 
  
==4. Install core packages==
+
* [http://search.cpan.org/dist/Authen-Passphrase Authen::Passphrase]
Keep the system time correct
+
* [http://search.cpan.org/dist/Business-CreditCard Business::CreditCard]
<pre>
+
* [http://search.cpan.org/dist/Business-US-USPS-WebTools Business::US::USPS::WebTools]
apt-get install ntp ntpdate
+
* [http://search.cpan.org/dist/CAM-PDF CAM::PDF]
</pre>
+
* [http://search.cpan.org/dist/Color-Scheme Color::Scheme]
 +
* [http://search.cpan.org/dist/Crypt::PasswdMD5 Crypt::PasswdMD5]
 +
* [http://search.cpan.org/dist/DBIx-DBSchema DBIx::DBSchema]
 +
* [http://search.cpan.org/dist/File-CounterFile File::CounterFile]
 +
* [http://search.cpan.org/dist/File-Slurp File::Slurp]
 +
* [http://search.cpan.org/dist/Frontier-RPC Frontier::RPC2]
 +
* [http://search.cpan.org/dist/HTML-Defang HTML::Defang]
 +
* [http://search.cpan.org/dist/HTML-Widgets-SelectLayers HTML::Widgets::SelectLayers]
 +
* [http://search.cpan.org/dist/IPC-Run IPC::Run]
 +
* [http://search.cpan.org/dist/IPC-Run3 IPC::Run3]
 +
* [http://search.cpan.org/dist/JSON JSON]
 +
* [http://search.cpan.org/dist/Lingua-EN-NameParse Lingua::EN::NameParse]
 +
* [http://search.cpan.org/dist/Lingua-EN-Inflect Lingua::EN::Inflect]
 +
* [http://search.cpan.org/dist/Net-Domain-TLD Net::Domain::TLD]
 +
* [http://search.cpan.org/dist/Net-SSH Net::SSH]
 +
* [http://search.cpan.org/dist/Net-Whois-Raw Net::Whois::Raw]
 +
* [http://search.cpan.org/dist/String-ShellQuote String::ShellQuote]
 +
* [http://search.cpan.org/dist/Tie-IxHash Tie::IxHash]
 +
* [http://search.cpan.org/dist/Time-Duration Time::Duration]
  
Apache2 etc
+
==== Optional modules ====
<pre>
 
apt-get install apache2 libapache2-mod-perl2 postgresql-8.4 build-essential texlive-base
 
</pre>
 
  
 +
* [http://search.cpan.org/dist/Fax-Hylafax-Client Fax::Hylafax::Client] ''(Required if faxing invoices)''
 +
* [http://search.cpan.org/dist/Apache-DBI Apache::DBI] ''(recommended for better web interface performance)''
  
Common Perl Packages - Packages are much faster to install
+
==== Note on missing modules ====
<pre>
 
apt-get install libwww-perl liburi-perl libhtml-tagset-perl libhtml-parser-perl libdbd-pg-perl libtimedate-perl libdate-manip-perl libchart-perl
 
apt-get install libcache-cache-perl libdatetime-perl libdatetime-format-strptime-perl libdatetime-format-natural-perl libemail-sender-perl
 
apt-get install libhtml-mason-perl libmailtools-perl libmail-mboxparser-perl libnetaddr-ip-perl libnet-ping-external-perl
 
apt-get install libnumber-format-perl libnumber-format-perl libspreadsheet-writeexcel-perl libstring-approx-perl libtext-csv-xs-perl
 
apt-get install libtext-template-perl libnet-ping-external-perl libterm-readkey-perl libnet-ssleay-perl
 
</pre>
 
Additional Perl Packages
 
<pre>
 
apt-get install libfile-counterfile-perl libfile-policy-perl libipc-run-perl libipc-run3-perl libjson-perl
 
apt-get install liblingua-en-nameparse-perl liblingua-en-inflect-perl libnet-domain-tld-perl libnet-ssh2-perl
 
apt-get install libnet-whois-raw-perl libtime-duration-perl
 
</pre>
 
Modules not available as packages - Allow cpan to prepend any dependencies
 
<pre>
 
cpan Authen::Passphrase Business::CreditCard Business::US::USPS::WebTools Color::Scheme Crypt::PasswdMD5 Frontier::RPC2 HTML::Defang
 
cpan HTML::Widgets::SelectLayers String::ShellQuote Tie::IxHash Apache::DBI Email::Sender::Transport::SMTP::TLS DBIx::DBSchema
 
</pre>
 
  
==5. Prepare the system==
+
Prerequisites missing from 2.1 documentation?  Please add them.
  
Download latest freeside tar and extract
+
== Download Freeside ==
<pre>
+
* Get the source from one of the normal places
mkdir /freesidesource
+
**[http://www.freeside.biz/freeside/developers.html Open source link from the home page]
cd /freesidesource
+
**[http://www.freeside.biz/freeside/cvs.html Anonymous CVS]
wget http://www.freeside.biz/freeside/freeside-2.1.1.tar.gz
+
* Uncompress the tarball
tar -zxvf freeside-2.1.1.tar.gz
 
</pre>
 
  
Add the freeside user
+
== Installation ==
<pre>
 
adduser freeside
 
</pre>
 
  
Grant permissions to freeside in postgresql
+
=== System User ===
 +
* Add the user and group `freeside' to your system.
 +
=== Database User ===
 +
* Allow the freeside user full access to the freeside database.
 +
with Postgresql:
 
<pre>
 
<pre>
#su freeside
+
[ as postgres/pgsql user ]
$createuser -P freeside
+
$ createuser -P freeside  
 
Enter password for new role:  
 
Enter password for new role:  
 
Enter it again:  
 
Enter it again:  
Line 112: Line 121:
 
Shall the new role be allowed to create databases? (y/n) y
 
Shall the new role be allowed to create databases? (y/n) y
 
Shall the new role be allowed to create more new roles? (y/n) n
 
Shall the new role be allowed to create more new roles? (y/n) n
$exit
 
 
</pre>
 
</pre>
 +
or with MySQL:
 +
<pre>
 +
$ mysqladmin -u root password 'set_a_root_database_password'
 +
$ mysql -u root -p
 +
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* TO freeside@localhost IDENTIFIED BY 'set_a_freeside_database_password';
 +
</pre>
 +
=== Database Access ===
 +
Edit the top-level Makefile:
 +
* Configure the DATASOURCE to your DBI data source
 +
** Set the DB_TYPE (Pg or mysql)
 +
** See the DBI manpage and the manpage for your DBD for the exact syntax of your DBI data source.
 +
* Set DB_PASSWORD to the freeside database user's password.
 +
* If you are not using the integrated RT ticketing system, set RT_ENABLED to 0
  
Edit the Makefile
+
=== Database ===
Set DB_PASSWORD to the freeside database user's password.
+
* Add the freeside database to your database engine:
 +
with Postgres:
 
<pre>
 
<pre>
cd /freesidesource/freeside-2.1.1
+
$ su freeside
nano Makefile
+
$ createdb -E sql_ascii freeside
 
</pre>
 
</pre>
 
+
or with Postgres 8.3 +:
Add the database
 
 
<pre>
 
<pre>
#su freeside
+
$ su freeside
$createdb -E LATIN1 freeside
+
$ createdb -E LATIN1 freeside
 
</pre>
 
</pre>
 
+
or with MySQL:
Configure Apache
 
*Set user to freeside
 
 
<pre>
 
<pre>
nano /etc/apache2/httpd.conf
+
$ mysqladmin -u freeside -p create freeside
 
</pre>
 
</pre>
*Add
+
=== Perl Modules ===
 +
* Build and install the Perl modules:
 
<pre>
 
<pre>
User freeside
+
$ make perl-modules
Group Freeside
+
$ su
 +
# make install-perl-modules
 
</pre>
 
</pre>
 
+
=== Basic configuration Files ===
 
+
* Create the necessary configuration files:
==6. Install freeside==
 
 
 
Build and Install the Perl modules - stay as freeside user
 
 
<pre>
 
<pre>
cd /freeside/freeside-2.1.1
+
$ su
make perl-modules
+
# make create-config
su
 
make install-perl-modules
 
 
</pre>
 
</pre>
  
Create config files
+
=== Invoice Typesetting ===
 +
* If you are using typeset invoices, install fslongtable.sty:
 
<pre>
 
<pre>
make create-config
+
$ su
 +
# make install-texmf
 
</pre>
 
</pre>
  
Invoice Typesetting
+
=== Apache & Web GUI ===
 +
* Configuration
 +
** Enable mod_perl
 +
** Run as <code>User freeside</code>
 +
*** If you have other things being served by Apache on this machine (hopefully internal things), it is recommended to run a '''separate''' iteration of Apache as the freeside user.
 +
 
 +
* Edit the Makefile and set <code>FREESIDE_DOCUMENT_ROOT</code>.
 +
 
 +
* To install the web interface, run:
 
<pre>
 
<pre>
make install-texmf
+
$ su
 +
# make install-docs
 
</pre>
 
</pre>
  
Install the Web Interface
+
* Edit the Makefile and set <code>APACHE_VERSION</code> to '''1''' (mod_perl v1.XX), '''1.99''' (mod_perl v2 prereleases up to and including 1.999_21, shipped with Debian 3.1, CentOS/RHEL 4, others), or '''2''' (mod_perl v2 proper and prereleases 1.999_22 and later).
 +
 
 +
* Edit the Makefile and set <code>APACHE_CONF</code> to the location of an Apache include directory (not a file).  (If your Apache doesn't have an existing include directory, create one and add a line such as "<code>Include /etc/apache/conf.d</code>" to httpd.conf.)
 +
 
 +
* To install the apache configs, run:
 
<pre>
 
<pre>
make install-docs
+
$ su
 +
# make install-apache
 
</pre>
 
</pre>
  
Install Apache Config
+
''Note: Do not attempt to restart Apache (httpd) yet.''
 +
 
 +
=== Initialize Data ===
 +
* As the freeside UNIX user, run <code>freeside-setup -d your.domain.name</code> to create the database tables and initial data.
 
<pre>
 
<pre>
make install-apache
+
$ su freeside
 +
$ freeside-setup -d example.com
 
</pre>
 
</pre>
  
Drop back to freeside permissions
+
=== Additional System Users ===
 +
* Create the Freeside system users:
 
<pre>
 
<pre>
su freeside
+
$ su freeside
 +
$ freeside-adduser -g 1 fs_queue
 +
$ freeside-adduser -g 1 fs_daily
 +
$ freeside-adduser -g 1 fs_selfservice
 
</pre>
 
</pre>
  
Initialize Data
+
=== Create Freeside Users ===
 +
* Create one or more Freeside users (your internal sales/tech folks, not customer accounts):
 
<pre>
 
<pre>
freeside-setup -d example.com
+
$ su freeside
 +
$ freeside-adduser -g 1 username
 +
$ htpasswd /usr/local/etc/freeside/htpasswd username
 +
Password:
 
</pre>
 
</pre>
 +
Additional users can be added using the same command or from the web interface.
 +
 +
=== Queue Daemon ===
 +
 +
* freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or edit the top-level Makefile, replacing <code>INIT_FILE</code> with the appropriate location on your system and <code>QUEUED_USER</code> with the username of a Freeside user you created above, and run <code>make install-init</code>)
 +
 +
=== RT ===
 +
* Either [[Freeside:1.9:Documentation:RT_Installation|install the integrated RT ticketing system]], or delete the <code>ticket_system</code> entry from your conf table.
  
Stay as freeside user and add additional users
 
 
<pre>
 
<pre>
freeside-adduser -g 1 fs_queue
+
su freeside
freeside-adduser -g 1 fs_daily
+
psql freeside
freeside-adduser -g 1 fs_selfservice
+
delete from conf where name = 'ticket_system';
 
</pre>
 
</pre>
  
 +
=== Finalize ===
 +
* Restart Apache (httpd) and log into the web interface using the username and password you entered above.
  
== Trouble Shooting ==
+
* Now proceed to the initial [[Freeside:1.9:Documentation:Administration|administration]] of your installation.
* If freeside-setup fails its often due to a missing perl module - google the .pm filename and find and install the module
 
* If you are non us the database encoding might not be compatible - set the client encoding to LATIN1 and create the Database as Unicode
 

Latest revision as of 20:38, 16 January 2012

Introduction

Install Freeside on a firewalled, private server, not a public (web, RADIUS, etc.) server.

Prerequisites

Packages

  • Perl, minimum version 5.8.4
  • Apache, SSL highly recommended)
  • mod_perl
    • If compiling your own mod_perl, make sure you set the EVERYTHING=1 compile-time option
  • A transactional database engine supported by Perl's DBI.
    • PostgreSQL is recommended (v7.2 or later, v8.1 or later recommended).
    • MySQL (v4.1 or later, v5 recommended) is supported. DBIx::DBSchema 0.35 or later is required.

Note: the above only applies to the database used by the Freeside software itself. Freeside can integrate with RADIUS and other servers running a different database than the backend.

  • TeX (teTeX / TeX Live) and Ghostscript (included with most distributions) (Optional, enables typeset invoices)

Perl modules

Popular modules

These modules are included in most distributions.

Common modules

These modules are included in many distributions.

Additional modules

Optional modules

Note on missing modules

Prerequisites missing from 2.1 documentation? Please add them.

Download Freeside

Installation

System User

  • Add the user and group `freeside' to your system.

Database User

  • Allow the freeside user full access to the freeside database.

with Postgresql:

[ as postgres/pgsql user ]
$ createuser -P freeside 
Enter password for new role: 
Enter it again: 
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

or with MySQL:

$ mysqladmin -u root password 'set_a_root_database_password'
$ mysql -u root -p
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* TO freeside@localhost IDENTIFIED BY 'set_a_freeside_database_password';

Database Access

Edit the top-level Makefile:

  • Configure the DATASOURCE to your DBI data source
    • Set the DB_TYPE (Pg or mysql)
    • See the DBI manpage and the manpage for your DBD for the exact syntax of your DBI data source.
  • Set DB_PASSWORD to the freeside database user's password.
  • If you are not using the integrated RT ticketing system, set RT_ENABLED to 0

Database

  • Add the freeside database to your database engine:

with Postgres:

$ su freeside
$ createdb -E sql_ascii freeside

or with Postgres 8.3 +:

$ su freeside
$ createdb -E LATIN1 freeside

or with MySQL:

$ mysqladmin -u freeside -p create freeside 

Perl Modules

  • Build and install the Perl modules:
$ make perl-modules
$ su
# make install-perl-modules

Basic configuration Files

  • Create the necessary configuration files:
$ su
# make create-config

Invoice Typesetting

  • If you are using typeset invoices, install fslongtable.sty:
$ su
# make install-texmf

Apache & Web GUI

  • Configuration
    • Enable mod_perl
    • Run as User freeside
      • If you have other things being served by Apache on this machine (hopefully internal things), it is recommended to run a separate iteration of Apache as the freeside user.
  • Edit the Makefile and set FREESIDE_DOCUMENT_ROOT.
  • To install the web interface, run:
$ su
# make install-docs
  • Edit the Makefile and set APACHE_VERSION to 1 (mod_perl v1.XX), 1.99 (mod_perl v2 prereleases up to and including 1.999_21, shipped with Debian 3.1, CentOS/RHEL 4, others), or 2 (mod_perl v2 proper and prereleases 1.999_22 and later).
  • Edit the Makefile and set APACHE_CONF to the location of an Apache include directory (not a file). (If your Apache doesn't have an existing include directory, create one and add a line such as "Include /etc/apache/conf.d" to httpd.conf.)
  • To install the apache configs, run:
$ su
# make install-apache

Note: Do not attempt to restart Apache (httpd) yet.

Initialize Data

  • As the freeside UNIX user, run freeside-setup -d your.domain.name to create the database tables and initial data.
$ su freeside
$ freeside-setup -d example.com

Additional System Users

  • Create the Freeside system users:
$ su freeside
$ freeside-adduser -g 1 fs_queue
$ freeside-adduser -g 1 fs_daily
$ freeside-adduser -g 1 fs_selfservice

Create Freeside Users

  • Create one or more Freeside users (your internal sales/tech folks, not customer accounts):
$ su freeside
$ freeside-adduser -g 1 username
$ htpasswd /usr/local/etc/freeside/htpasswd username
Password: 

Additional users can be added using the same command or from the web interface.

Queue Daemon

  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your system and QUEUED_USER with the username of a Freeside user you created above, and run make install-init)

RT

su freeside
psql freeside
delete from conf where name = 'ticket_system';

Finalize

  • Restart Apache (httpd) and log into the web interface using the username and password you entered above.