This document goes over how we have set up the OpenAustralia web application on our development machines.
For a server set up, you can use this as a base however it might require a different approach unless you have complete control (i.e. you are root) on the server and can install all the dependencies, secure the machine, etc. So, use these instructions as a starting point rather than a definitive “this is the ultimate way” step-by-step guide.
If you don’t have the version control system git you’ll need to install it.
git clone git://github.com/openaustralia/openaustralia.git cd openaustralia git submodule init git submodule update
We need the following bits and pieces
(we’ve tested with Apache 2.X.X, PHP5, MySQL 5.0.x)
Apache, PHP and Ruby all come with Leopard. If you need to install any of these
on Mac OS X (if for whatever reason you don’t have them installed) there’s a ton
of information online:
You should also be able to get MySQL from MySQL’s website as they now distribute binary versions for Mac OS X (at the time of writing this document, you can find the 5.0.51a MySQL Community Server at MySQL Community Server).
As the parsing of XML files to insert into the database is done with Perl (and there’s quite a few scripts in Perl), you will need a few Perl CPAN modules:
sudo perl -MCPAN -e shell cpan> install Error cpan> install XML::Twig cpan> install DBD::mysql cpan> install XML::RSS
Use apt-get to install the requirements:
sudo apt-get install apache2 php5 php5-cli mysql-server libmysqlclient15-dev php5-mysql liberror-perl libxml-twig-perl libdbd-mysql-perl libxml-rss-perl # Enable the apache modules. a2enmod php a2enmod rewrite
The x86 version of ActivePerl comes with a GUI for installing packages that makes the whole process a lot easier. Refer to http://aspn.activestate.com/ASPN/docs/ActivePerl/5.10/faq/ActivePerl-faq2.html for instructions on running it. ActivePerl comes with a lot of packages already installed but there are a few you’ll need to install yourself, namely: XML-Twig, DBD-mysql and Error.
If DBD-mysql fails to install try installing it manually with
ppm install http://cpan.uwinnipeg.ca/PPMPackages/10xx/DBD-mysql.ppd
Reference http://dev.mysql.com/doc/refman/5.0/en/activestate-perl.html (bottom of page).
For development purposes we have our web application and the parser under
/var/www/ (Ubuntu) and, unless you want to patch the configuration too much, we recommend that you install it there.
openaustralia directory that you previously downloaded to
# For Mac mv openaustralia /Library/WebServer/Documents
# For Ubuntu mv openaustralia /var/www
Fix the permissions, this is necessary so that you don’t always have use sudo when editing files or coding on the website.
# For Mac sudo chown -R $USER:staff /Library/WebServer/Documents
# For Ubuntu chmod -R a+rX /var/www/openaustralia
We now need to create a database in MySQL and load the schema. We assume that you have MySQL running and that your MySQL super user is
root and the account has a password.
Step one. Create the database. This is pretty simple:
mysqladmin -u root -p create openaustralia Enter password: ******
Step two. Import the schema:
mysql -u root -p openaustralia < openaustralia/twfy/db/schema.sql Enter password: ******
Next, configure your Apache server using the example configuration files in
The configurations are to setup a virtual host at dev.openaustralia.org.
You will also need to ensure
mod-rewrite is enabled.
# in openaustralia/twfy/conf cp general-example.ubuntu general cp httpd.conf.ubuntu /etc/apache2/sites-available/
# in openaustralia/twfy/conf cp general-example.mac general cat httpd.conf.mac >> /etc/apache2/extra/httpd-vhosts.conf
Make sure that the name dev.openaustralia.org resolves to your localhost by doing the following:
echo "127.0.0.1 dev.openaustralia.org" >> /etc/hosts
Restart Apache to make your changes active:
sudo apachectl restart
short_open_tag = On is set in your
This file is located in
# On Mac cp openaustralia/twfy/conf/general-example.mac openaustralia/twfy/conf/general
# On Ubuntu cp openaustralia/twfy/conf/general-example.ubuntu openaustralia/twfy/conf/general
The configuration file
openaustralia/twfy/conf/general is well documented and quite self-explanatory. It contains the configuration for MySQL (database name, host, username, etc) as well as the URL and paths for the web application on your machine.
You should now be able to view the results at your webserver URL, dev.openaustralia.org
Hopefully, you should see a working version of openaustralia.org but without any data in it. This is because we haven’t loaded anything into the database yet. This is what we’re going to do next.
There are two alternative approaches to this:
The first approach is very quick and straightforward and recommended if you are mostly interested in working on the web application.
The second approach is more time consuming but allows you to work with the scraper / parser and downloads the Hansard data from www.aph.gov.au.
Next: follow the install instructions for downloading XML data or follow the install instructions for setting up the parser / scraper