Freeside:1.7:Documentation:InstallingOnCentOS4

From Freeside
Revision as of 15:52, 2 March 2007 by Khoff (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installing Freeside 1.7.x on CentOS 4.4

This is a (hopefully) step-by-step guide for doing a basic installation of Freeside on CentOS 4.4 using RPMs whenever possible. It would probably be easier to use CPAN directly in some cases, but that wouldn't be very fun now would it?

Software Installation

Run the correct command below depending on your architecture.

# export BASEARCH=i386

...or...

# export BASEARCH=x86_64

Binary Packages

*Package* *Repo* *Version*
httpd base 2.0.52-28.ent.centos4
postgresql-server update 7.4.16-1.RHEL4.1
tetex base 2.0.2-22.EL4.7
ghostscript.x86_64 base 7.07-33
# yum install httpd postgresql-server tetex ghostscript.$BASEARCH

Perl Packages

Setup 3rd party repos for most of the extra perl modules.

# rpm -ivh http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.$BASEARCH.rpm
# rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

# cat <<END>/etc/yum.repos.d/dries.repo
[dries]
name=Extra Fedora rpms dries - \$releasever - \$basearch
baseurl=http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el\$releasever/en/\$basearch/dries/RPMS
END
# rpm --import http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt

Install the cpan2rpm tool so we can build RPMs from CPAN packages.

# rpm --import http://perl.arix.com/cpan2rpm/gpg.pub.asc
# yum install rpm-build perl-Module-Build
# rpm -ivh http://superb-east.dl.sourceforge.net/sourceforge/cpan2rpm/cpan2rpm-2.027-1.noarch.rpm

mod_perl2

CentOS 4.4 still uses mod_perl-1.99_16. Unfortunately, this isn't really considered mod_perl-1.99 or mod_perl-2 because of major API changes that took place just before the mod_perl-2 release. Several of the required perl modules will break if we use 1.99_16. Instead, use the modified mod_perl 2.0.3 SRPM from Fedora Core 6.

# yum install httpd-devel apr-devel apr-util-devel gdbm-devel

# wget -O /usr/src/redhat/SRPMS/mod_perl-2.0.3-4.freeside.src.rpm http://users.fire2wire.com/~khoff/freeside/1.7.0/mod_perl-2.0.3-4.freeside.src.rpm
# rpmbuild --target=${BASEARCH} --rebuild /usr/src/redhat/SRPMS/mod_perl-2.0.3-4.freeside.src.rpm
# rpm -ivh /usr/src/redhat/RPMS/x86_64/mod_perl-2.0.3-4.freeside.${BASEARCH}.rpm

Freeside Prereqs

*Perl Module* *Package* *Version* *Repo*
libnet libnet.x86_64 1.1.2.1-2.rf extras
libwww-perl perl-libwww-perl.noarch 5.79-5 base
URI perl-URI.noarch 1.30-4 base
HTML::Tagset perl-HTML-Tagset.noarch 3.03-30 base
HTML::Parser perl-HTML-Parser.x86_64 3.35-6 base
DBI perl-DBI.x86_64 1.40-8 base
DBD::MySQL perl-DBD-MySQL.x86_64 2.9004-3.1 base
MailTools perl-MailTools.noarch 1.74-1.c4 extras
TimeDate perl-TimeDate.noarch 1.16-1.c4 extras
Date::Manip perl-DateManip.noarch 5.42a-3 base
HTML::Mason perl-HTML-Mason 1.3200-1.el4.rf rpmforge
Text::Template perl-Text-Template 1.44-1.2.el4.rf dries
DateTime perl-DateTime 0.2901-1.2.el4.rf rpmforge
Chart perl-Chart 2.4.1-1.el4.rf dries
Cache::Cache perl-Cache-Cache 1.05-1.el4.rf dries
NetAddr::IP perl-NetAddr-IP 4.004-1.el4.rf rpmforge
String::Approx perl-String-Approx 3.26-1.el4.rf dries
Locale::SubCountry perl-Locale-SubCountry 1.38-1.el4.rf dries
Term::ReadKey perl-Term-ReadKey 2.30-2.2.el4.rf dries
DateTime::Format::Strptime perl-DateTime-Format-Strptime 1.0700-1.2.el4.rf dries
Net::Whois::Raw perl-Net-Whois-Raw 1.20-1.el4.rf dries
DBIx::DBSchema perl-DBIx-DBSchema 0.31-1.el4.rf dries
Tie::IxHash perl-Tie-IxHash 1.21-1.2.el4.rf dries
Crypt::PasswdMD5 perl-Crypt-PasswdMD5 1.3-1.2.el4.rf dries
File::CounterFile perl-File-CounterFile 1.04-1.2.el4.rf dries
IPC::Run3 perl-IPC-Run3 0.036-1.el4.rf dries
Net::SSH perl-Net-SSH 0.08-1.2.el4.rf dries
String::ShellQuote perl-String-ShellQuote 1.03-2.2.el4.rf dries
JSON perl-JSON 1.07-1.el4.rf dries
Data::Table perl-Data-Table 1.50-1.el4.rf dries
Lingua::EN::NameParse perl-Lingua-EN-NameParse 1.22-2.2.el4.rf dries
Lingua::EN::Inflect perl-Lingua-EN-Inflect 1.89-1.2.el4.rf dries
Apache::DBI perl-Apache-DBI 0.9901-2.2.el4.rf dries
IO::Scalar perl-IO-stringy 2.110-1.2.el4.rf dries
Text::CSV_XS perl-Text-CSV_XS 0.23-1.2.el4.rf dries
Spreadsheet::WriteExcel perl-Spreadsheet-WriteExcel 2.17-1.el4.rf dries
MIME-tools perl-MIME-tools 5.420-1.el4.rf dries
Date::Manip perl-DateManip 5.42a-3 base
DBD::Pg cpan2rpm
Locale-Codes cpan2rpm
Frontier::RPC2 cpan2rpm
Business::CreditCard cpan2rpm
Time::Duration cpan2rpm
HTML::Widgets::SelectLayers cpan2rpm
Color::Scheme cpan2rpm
Fax::Hylafax::Client cpan2rpm
# yum install libnet perl-libwww-perl perl-URI perl-HTML-Tagset
# yum install perl-HTML-Parser 
# yum install perl-MailTools perl-TimeDate

# yum install perl-HTML-Mason perl-Text-Template perl-DateTime perl-Chart
# yum install perl-Cache-Cache perl-NetAddr-IP perl-String-Approx
# yum install perl-Locale-SubCountry perl-Term-ReadKey
# yum install perl-DateTime-Format-Strptime perl-Net-Whois-Raw
# yum install perl-Tie-IxHash perl-Crypt-PasswdMD5
# yum install perl-File-CounterFile perl-IPC-Run3 perl-Net-SSH
# yum install perl-String-ShellQuote perl-JSON perl-Data-Table
# yum install perl-Lingua-EN-NameParse perl-Lingua-EN-Inflect
# yum install perl-IO-stringy perl-Text-CSV_XS perl-Spreadsheet-WriteExcel
# yum install perl-MIME-tools perl-DateManip
# yum install perl-DBI perl-DBD-MySQL perl-Apache-DBI 

You can install these using cpan, or follow the directions here using cpan2rpm.

  • DBD::Pg
# cpan2rpm --version='1.32' http://search.cpan.org/CPAN/authors/id/R/RU/RUDY/DBD-Pg-1.32.tar.gz
# rpm -ivh /usr/src/redhat/RPMS/x86_64/perl-DBD-Pg-1.32-1.x86_64.rpm
  • DBIx::DBSchema
# yum install perl-DBIx-DBSchema
  • Frontier::RPC2
# yum install perl-XML-Parser
# cpan2rpm --author='Ken MacLeod <ken@bitsko.slc.ut.us>' --version='0.07b4' Frontier-RPC
# rpm -ivh /usr/src/redhat/RPMS/noarch/perl-Frontier-RPC-0.07b4-1.noarch.rpm


  • Business::CreditCard
# cpan2rpm Business::CreditCard
# rpm -ivh /usr/src/redhat/RPMS/noarch/perl-Business-CreditCard-0.30-1.noarch.rpm


  • Time::Duration
# yum install perl-Test-Pod perl-Test-Pod-Coverage
# cpan2rpm Time::Duration
# rpm -ivh /usr/src/redhat/RPMS/noarch/perl-Time-Duration-1.04-1.noarch.rpm


  • HTML::Widgets::SelectLayers
# cpan2rpm HTML::Widgets::SelectLayers
# rpm -ivh /usr/src/redhat/RPMS/noarch/perl-HTML-Widgets-SelectLayers-0.06-1.noarch.rpm


  • Color::Scheme

Ran into much brokenness when trying to build Test-Simple-0.67. Just skip the dep checks and test phase and hope. I mean, come on, it's Color::Scheme for crying out loud!

# yum install perl-Test-Differences
# cpan2rpm --make-no-test --no-depchk Color::Scheme
# rpm -ivh /usr/src/redhat/RPMS/noarch/perl-Color-Scheme-1.02-1.noarch.rpm


  • Fax::Hylafax::Client (Optional)

Skip the tests here as well, unless you happen to have a properly configured HylaFAX server handy. Or, skip the package entirely if you don't plan on sending FAX invoices.

# cpan2rpm --make-no-test Fax::Hylafax::Client
# rpm -ivh /usr/src/redhat/RPMS/noarch/perl-Fax-Hylafax-Client-1.02-1.noarch.rpm



RT Prereqs

*Perl Module* *Package* *Version* *Repo*
Apache::Session perl-Apache-Session 1.81-1.el4.rf dries
HTML-Format perl-HTML-Format 2.04-1.2.el4.rf dries
Class::ReturnValue perl-Class-ReturnValue 0.53-1.2.el4.rf dries
DBIx::SearchBuilder perl-DBIx-SearchBuilder 1.43-1.el4.rf rpmforge
Log::Dispatch perl-Log-Dispatch 2.11-1.2.el4.rf rpmforge
Locale::Maketext::Lexicon perl-Locale-Maketext-Lexicon 0.62-1.el4.rf dries
Locale::Maketext::Fuzzy perl-Locale-Maketext-Fuzzy 0.02-1.2.el4.rf dries
Text::Wrapper perl-Text-Wrapper 1.000-1.2.el4.rf dries
Time-modules perl-Time-modules 2003.1126-1.2.el4.rf dries
Text::Autoformat perl-Text-Autoformat 1.13-1.2.el4.rf dries
Text::Quoted perl-Text-Quoted 1.8-1.2.el4.rf dries
Regexp::Common perl-Regexp-Common 2.120-1.2.el4.rf dries
HTML::Scrubber perl-HTML-Scrubber 0.08-1.2.el4.rf dries
Tree::Simple perl-Tree-Simple 1.17-1.el4.rf dries
HTML::TreeBuilder perl-HTML-Tree 3.23-1.el4.rf dries
# yum install perl-Apache-Session perl-HTML-Format perl-Class-ReturnValue
# yum install perl-Locale-Maketext-Lexicon perl-Locale-Maketext-Fuzzy
# yum install perl-Text-Wrapper perl-Time-modules
# yum install perl-Text-Autoformat perl-Text-Quoted perl-Regexp-Common
# yum install perl-HTML-Scrubber perl-Tree-Simple perl-HTML-Tree
  • Log::Dispatch

Use the SRPM from Fedora Core 5. They have the correct and properly patched version that supports mod_perl 2.

But first, a couple of prereqs.

# yum install perl-File-Find-Rule perl-IO-String
# yum install perl-MIME-Lite perl-Mail-Sender

Now build and install Log::Dispatch itself.

# wget -O /usr/src/redhat/SRPMS/perl-Log-Dispatch-2.15-2.fc5.src.rpm http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/perl-Log-Dispatch-2.15-2.fc5.src.rpm

# rpmbuild --rebuild /usr/src/redhat/SRPMS/perl-Log-Dispatch-2.15-2.src.rpm
# rpm -ivh /usr/src/redhat/RPMS/noarch/perl-Log-Dispatch-2.15-2.noarch.rpm
  • DBIx::SearchBuilder

DBIx::searchBuilder is a little painful to install because it requires DBD::Oracle. You can just run "yum install perl-DBIx-SearchBuilder" if you want to go through the trouble of building and installing DBD::Oracle first. Again, that can be rather painful and isn't within the scope of this guide.

The alternative below is to force install the RPM for DBIx::SearchBuilder since we're not going to use Oracle anyway. You have to exclude it from future updates in yum otherwise you'll get dep failures everytime you do a "yum upgrade".

If you're not going to use RT, just skip DBIx::SearchBuilder altogether.

# yum install perl-Want perl-Clone perl-Cache-Simple-TimedExpiry
# yum install perl-DBD-SQLite perl-capitalization perl-Class-Accessor

# rpm -ivh --nodeps http://apt.sw.be/redhat/el4/en/x86_64/dag/RPMS/perl-DBIx-SearchBuilder-1.43-1.el4.rf.noarch.rpm

# echo "exclude=perl-DBIx-SearchBuilder" >> /etc/yum.conf


System configuration

This is just following the directions with CentOS-specific commands.

# groupadd freeside
# useradd -g freeside freeside

With CentOS 4.4, postgresql wouldn't start if SELinux was enabled. We call "setenforce 0" here to temporarily disable it. Some claim that it only needs to be disabled the first time postgresql is started.

Enable postgresql at startup, disable selinux temporarily, and start postgresql.

# chkconfig postgresql on
# setenfore 0
# service postgresql start

Create the freeside datbase user for postgresql.

# su -c "createuser -P freeside" - postgres

Installing Freeside

su to the freeside user, extract a copy of the freeside tarball or check out the code from CVS into the freeside user's home directory. You should have the freeside top-level Makefile in /home/freeside/freeside/Makefile or /home/freeside/freeside-1.7.0/Makefile at this point. 1.7.0 wasn't officially released at the time of writing, so we're using a version checked-out from CVS.

Edit freeside's top-level Makefile with your configuration. Here are some examples...

FREESIDE_CONF = /etc/freeside
FREESIDE_LOG = /var/log/freeside
FREESIDE_LOCK = /var/lib/freeside
FREESIDE_CACHE = /var/lib/freeside
FREESIDE_EXPORT = /var/lib/freeside

APACHE_VERSION = 2
FREESIDE_DOCUMENT_ROOT = /var/www/freeside/html

INIT_FILE = /etc/init.d/freeside
INIT_INSTALL = /sbin/chkconfig freeside on

HTTPD_RESTART = /etc/init.d/httpd restart
APACHE_CONF = /etc/httpd-freeside/conf.d

As the freeside user, create the database and make the perl modules.

$ createdb -E sql_ascii freeside

$ make perl-modules

As root, install the perl modules and create the initial config.

# make install-perl-modules

# mkdir -m 770 /var/lib/freeside
# chown -R freeside:root /var/lib/freeside/
# make create-config

Apache Configuration

Creating Freeside's Apache Instance

The default Apache init script for CentOS doesn't make it very easy to setup multiple instances of Apache. A few small modifications take care of that problem.

Start by making a copy of the init script, as well as download the patch and apply it to your httpd-freeside init script. You can make a symlink if you'd like to eventually setup additional Apache instances.

# ln -s /etc/init.d/httpd /etc/init.d/httpd-freeside

# cd /etc/init.d/
# wget -O /tmp/httpd-freeside.patch http://users.fire2wire.com/~khoff/freeside/1.7.0/httpd-freeside.patch
# patch < /tmp/httpd-freeside.patch

Make a copy of the Apache server root.

# cp -av /etc/httpd /etc/httpd-freeside

You can remove any extra conf files from /etc/httpd-freeside/conf.d (webdav, php, etc.) if you're not using them. They'll only take up more memory and potentially make freeside slower.

/etc/httpd-freeside/conf/httpd.conf

Change the following Apache configuration directives in /etc/httpd-freeside/conf/httpd.conf to match our previous changes.

  • ServerRoot "/etc/httpd-freeside"
  • PidFile run/httpd-freeside.pid

We're changing the listening port in case you're using the default Apache configuration (and port) for something else. This can be remedied by binding to a specific IP address as well (eg. 192.168.0.2:80).

  • Listen 8080

Freeside's instance of Apache needs to run as the freeside user and group.

  • User freeside
  • Group freeside
  • DocumentRoot "/var/www/freeside/html"
  • <Directory "/var/www/freeside/html">
  • ErrorLog logs/freeside_error_log
  • CustomLog logs/freeside_access_log combined


Install Docs and Freeside's Apache Includes

Inside the freeside source directory, run "make install-docs" and "make install-apache" as root.

# make install-docs
# make install-apache

Edit the config file that was just created (/etc/httpd-freeside/conf.d/freeside-base2.conf) by "make install-apache" and change the AuthUserFile directive to match our new path.

  • AuthUserFile /etc/freeside/htpasswd


Populating the Database

Populate the freeside database with the initial data, as the freeside user.

$ freeside-setup -d example.com

Create the freeside system users, as the freeside user.

$ freeside-adduser -g 1 fs_queue
$ freeside-adduser -g 1 fs_daily
$ freeside-adduser -g 1 fs_selfservice

Create whatever other freeside users you want, again, as the freeside user.

freeside-adduser -g 1 username
htpasswd /etc/freeside/htpasswd username

Repeat the last two commands as many times as you want for your internal staff's freeside accounts.

Startup Configuration

We just need to make sure that our new instance of Apache and the freeside queue daemon start when we boot.

# make install-init

# chkconfig freeside on
# chkconfig httpd-freeside on

And last but not least...start freeside's Apache instance.

# service httpd-freeside start

Hopefully, Apache should start without errors. If you do get errors, check /var/log/httpd/freeside_error_log.

Assuming Apache started correctly, you should now be able to access freeside via http://<Your server's FQDN or IP>:8080/. You can login using the username and password you set earlier with htpasswd.

From here, consult the standard freeside install documentation in the wiki on how to proceed with initial configuration. Good luck!

Problems

There might be some formatting issues as this was converted from TWiki to MediaWiki markup. If the syntax of a command doesn't look correct or doesn't make sense, it probably didn't get escaped correctly, or your web browser gobbled up some angle brackets, or both!