Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

[CyberArmy] A Step-by-Step Guide: Installing Dinah on L


[Replies] [Reply] [View by Thread] [Help]
[Back To Article Discussion Forum]

Posted by Author int16h On 2007-11-21 04:23:24




View and vote on the article here: A Step-by-Step Guide: Installing Dinah on Linux


A Step-by-Step Guide: Installing Dinah on Linux

Category
CyberArmy
Summary
This step-by-step guide aims to give you a clear walk-through on building a Development environment on Linux.
Body
Prerequisites: I shall assume that Perl, MySQL, wget, GPG and Subversion are pre-installed, recommending you use your distro's package manager to install and configure these.

Begin by creating a local user-account for Dinah. You could name it dinah, but I've decided to name the account 'int16h'. Once this is done, open a terminal and either login or switch to the new user: # su - "dinah" (sans quotes).

Next, we'll create our directory structure which will hold Dinah's code, Apache (and its source), and our mod_perl tarballs:
mkdir ~/src
mkdir ~/MyDinah
mkdir ~/APACHE
Download apache_1.3.xx.tar.gz and mod_perl-1.30 into src, and extract them:
# tar zxf apache_1.3.xx.tar.gz
# tar zxf mod_perl-1.0-current.tar.gz
Now that we have Apache and mod_perl extracted, we'll enter mod_perl's directory, configure, and then install it. The settings here provide the Apache modules Dinah needs and will provide use of APache AutoConf-style Interface(APACI), which allows configuration of Apache's source through the AutoConf-like 'configure' script - These settings aren't for optimisation, as this install won't be on a production server.
# cd mod_perl-1.xx 
# perl Makefile.PL APACHE_SRC=../apache_1.3.39/src APACHE_PREFIX=/home/int16h/APACHE DO_HTTPD=1
USE_APACI=1 APACI_ARGS='--enable-shared=access --enable-shared=alias --enable-shared=auth
--enable-shared=env --enable-shared=log_config --enable-shared=mime --enable-shared=dir
--enable-module=rewrite --enable-module=so' EVERYTHING=1

# make
# make test (optional, and requires additional perl modules for complete testing)
# su
#make install
[* Optional *]

If you'd like to compile some third party modules for Apache, or pass extra options - you may
re-configure from the Apache source directory, making sure you remember to activate libperl.a:
# cd ../apache_1.3.xx
# ./configure --prefix=/home/int16h/APACHE --enable-shared=access --enable-shared=alias
--enable-shared=auth --enable-shared=env --enable-shared=log_config --enable-shared=mime
--enable-shared=dir --enable-module=rewrite --enable-module=so
# make install
If you've ever tried to install Dinah previously, you'll know there are a few Perl modules which are required for everything to function correctly. To speed this up a little, we can install Bundle::Apache - which contains a variety of modules useful for mod_perl development and production with Apache.
# perl -MCPAN -e 'install("Bundle::Apache")'
OR
# cpan
cpan> install Bundle::Apache
cpan> quit
#
Before we proceed, we should grab the Dinah sources from CyberArmy's SubVersion repo:
# cd ~/MyDinah
# svn co https://svn.cyberarmy.net/repos/dinah/trunk
And now to install a few more modules from cpan:
# cpan
cpan> install Module::Build
cpan> install MIME::Parser XML::RSS Template Template::Plugin Net::Server
cpan> install Proc::PID_File Proc::Daemon Data::Password Algorithm::Diff
cpan> install GD Apache::Singleton MySQL::Diff
(If any modules fail - try: cpan> force install MySQL::Diff)

You may install these all at the same time, but be warned that some module (either from above, or dependency) tests may fail and you will have to force install the modules (Ok, so it's not a great idea to install code which has failed self-tests, but in most cases it won't pose a problem ;)

Assuming everything went as planned, change to the MyDinah directory and by issuing the 'ls' command - you should see something similar to the following:
CONTRIBUTIONS  LICENSE  Makefile  README  User.pm.README  bin
conf  docs  htdocs  lib  logs  support  templates  test
Our next step, is to run the installer - which basically asks you for some basic settings and installs a CyberArmy module in one of perl's lib trees. I think the best way to show you this stage, is to paste everything that the install script will do:
root[MyDinah]# make install
bin/install.pl
Checking prerequisites...
Looks good

What is your hostname [bombuzal ]mydinah.net
What is your email address? [root@mydinah.net ]mail@mydinah.net
What is an SMTP relay I can use? [mydinah.net ]mydinah.net
Where is your httpd located  /home/int16h/APACHE/bin/httpd

Copying lib/CyberArmy.pm -> blib/lib/CyberArmy.pm
Installing /usr/lib/perl5/site_perl/5.8.8/CyberArmy.pm
Deleting lib/CyberArmy.pm
Deleting blib
root[MyDinah]# 
As you can see - the installer asks for a hostname, e-mail address, SMTP relay and the location of our Apache HTTPd binary. Note that bind or /etc/hosts should have entries for the hostname pointing to your local IP.

Next, we need to configure httpd.conf, my.cnf etc for Dinah:
root[MyDinah]# make config
bin/config.pl
Checking prerequisites...
Looks good

FIXME: You need to manually install /home/int16h/MyDinah/conf/dinah.cron at the moment at bin/config.pl line 194.

Overwrite current httpd.conf? [n] y
Where is your apache LIBEXECDIR [/home/int16h/APACHE/libexec ]
/home/int16h/APACHE/libexec 
Any other places to look in?  

User to run as [nobody]
nobody 
Port to bind to [80] 8080
Pid file [logs/httpd.pid ]
logs/httpd.pid 
Error file [logs/error_log]
logs/error_log 
How many instances do you want to run? [1]
1 
Where is your gpg? [/usr/bin/gpg ]
/usr/bin/gpg 
Written /home/int16h/MyDinah/conf/httpd.conf
Overwrite current my.cnf? [n] y
localhost 
MySQL username? [cyberarmy ] root
MySQL password? [ ]
 
Written /home/int16h/MyDinah/conf/my.cnf

Sync your database schema? [n ]
You may receive some errors at the end of this script, just ignore them.

Now before we go any further, we need to create a database for dinah:
# mysqladmin -p create cyberarmy
On a shared system or if you don't have any iptables rules setup, you would generally want to create a "normal" MySQL user for Dinah's database. But as this box is pretty-much locked down - I will be using the default root account.

Let's import Dinah's database schema into the db we just created:
# mysql -p -C cyberarmy < conf/scheme.sql
Great! We finally have a Dinah/CyberArmy database structure, which is pretty useless at the moment as there are no users/admins in the database. Let's bootstrap the database using bootstrap.sql:
# mysql -p -C cyberarmy < conf/bootstrap.sql
OK, we should be ready to roll!
# make start
bin/dinahctl start
#1: started
Due to the way I've setup Apache here - you may need to edit Dinah's httpd.conf slightly if you receive errors about LoadModule; have a look at ~/MyDinah/conf/httpd.conf and if it looks odd, and modify it like so:
LoadModule env_module           /home/int16h/APACHE/libexec/mod_env.so
LoadModule config_log_module    /home/int16h/APACHE/libexec/mod_log_config.so
LoadModule mime_module          /home/int16h/APACHE/libexec/mod_mime.so
LoadModule dir_module           /home/int16h/APACHE/libexec/mod_dir.so
# LoadModule rewrite_module
LoadModule access_module        /home/int16h/APACHE/libexec/mod_access.so
If there were no errors, browse to http://mydinah.net:8080 (or whatever you set your host to) and use the following details to login:
Username: dinah
Password: dinah
I hope this guide has provided you with an easy to follow, near-copy+paste walk-through on installing Dinah on any Linux distro. Perhaps I will release a follow-up, explaining her code.

int16h.

This article was originally published by CyberArmy.net in the CyberArmy Library.





Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.02224 seconds


About Us | Privacy Policy | Mission Statement | Help