Topic: Debian Lenny Installing Required Software

Topic type:

Describes the steps necessary for installing Kete's required software on a Debian Lenny host.

Originally written by Kieran Pilkington, Kete Developer for Katipo Communications, Ltd.

Part of the Installation Guide


Install Required Software for Running Kete

Note: all of the commands on this page are run as root, so if you close the console, make sure you 'su' back to root before continuing

First, lets setup a new source where we can grab the latest Git from. We'll need it to grab the source code later on. In a new console, open up /etc/apt/sources.list in an editor and add to that file these lines (if they aren't already there)

deb http://ftp.nz.debian.org/debian lenny main # see note below about adjusting domain name for local mirror
deb-src http://ftp.nz.debian.org/debian lenny main
deb http://backports.debian.org/debian lenny-backports main contrib non-free
deb http://ftp.indexdata.dk/debian lenny main
deb-src http://ftp.indexdata.dk/debian lenny main

Change .nz in the first two sources to the closest mirror where you live (.uk. for England, .au. for Australia etc).

Now update, and install the keyring so you can install YAZ and Zebra.

root@host: # aptitude update
root@host: # wget http://ftp.indexdata.dk/debian/indexdata.asc
root@host: # apt-key add indexdata.asc

Then lets jump into what we can grab from debian packages.

root@host: # aptitude update   # grab any new packages after backport keyring was added
root@host: # aptitude install apt-utils build-essential ruby1.8-dev rubygems imagemagick librmagick-ruby1.8 librmagick-ruby-doc libmagick9-dev libmysqlclient15off libmysqlclient15-dev mysql-server mysql-common mysql-client libmysql-ruby1.8 memcached libxslt1-dev libpcre3-dev zlib1g-dev unzip gzip mytop
yaz libyaz3-dev idzebra-2.0 libidzebra-2.0 libidzebra-2.0-dev libidzebra-2.0-modules curl libcurl3-dev libreadline5-dev apache2 apache2-threaded-dev
root@host: # aptitude -t lenny-backports install git-core git-doc

(optional - enables conversion of uploaded HTML, Plain Text, PDF, and Microsoft Word documents to the description of the document)

root@host: # aptitude install wv poppler-utils lynx

(optional - enables support for harvesting embedded metadata in uploaded files, see mini_exiftool gem step later)

root@host: # aptitude install libimage-exiftool-perl

Installing the Rails framework

The Kete project, at least for the time being, has standardized on Ruby Enterprise Edition for its version of the Ruby programming language. In addition we use Passenger (a.k.a mod_rails) in combination with Apache to serve Kete as a Ruby on Rails application.

Ruby Enterprise Edition (refered to as REE) has an installer. Start by following the download and install instructions at http://www.rubyenterpriseedition.com/download.html with one change:

./ruby-enterprise-X.X.X/installer --dont-install-useful-gems

Now add the following to the .bash_profile, and .bashrc files of any users that'll affect the installation (root, kete, and yourself for example). Be sure to use the correct path for REE; it varies by release. Replace the X's in the string below.

# Use correct Ruby, RubyGem paths
PATH=/opt/ruby-enterprise-1.8.7-20XX.XX/bin:$PATH
export PATH

Then as both root and the kete user, check that we are using the correct RubyGems version:

$ which gem
/opt/ruby-enterprise-1.8.7-20XX.XX/bin/gem # should look something like this with correct date

Note: If you plan to use Ruby Enterprise Edition as well as Capistrano, an extra step is necessary. See how to Configure sudo path in capistrano deployments.

Additional Setup Instructions

MySQL

You would have been prompted to add a MySQL root password during install of mysql. If you weren't, run the following commands (change [your_new_password] to a password of your choosing) :

root@host: # mysqladmin -u root password [new_password]

Kete also supports unicode characters, so we'll want to adjust mysql to make unicode the default for new databases. Make utf8 the default by editing /etc/mysql/my.cnf (as root) and adding this in the existing sections:

[client]
default-character-set=utf8
[mysqld]
init-connect = SET NAMES utf8
character-set-server = utf8

Save the file, and restart mysql with

root@host: # /etc/init.d/mysql restart

You can confirm that required charset variables now point at utf8 by connecting to the mysql database as mysql root (remember you set that password above) and running:

SHOW VARIABLES LIKE 'character_set%';

Aside from file system and dir, everything else should be utf8.

HTTP Request Server

Current versions of Kete run on Apache 2 in combination with Ruby Enterprise Edition with Passenger. If you have an older version of Kete that requires Nginx with Mongrel, see an older version of this topic.

IMPORTANT - SKIP THIS STEP UNTIL MENTIONED IN 'PREPARING APPLICATION', THEN COME BACK TO THESE INSTRUCTIONS.

Apache 2 was installed earlier so, go ahead and install Passenger module for Apache.

root@host: # passenger-install-apache2-module

Copy the Apache2 config lines it gives you at the end of the file to the end of your apache2.conf configuration file at /etc/apache2/apache2.conf. The lines look similar to this (paths may differ depending on which ruby implementation you're using):

LoadModule passenger_module /opt/ruby-enterprise-1.8.7-20XX.XX/lib/ruby/gems/1.8/gems/passenger-2.2.8/ext/apache2/mod_passenger.so
PassengerRoot
/opt/ruby-enterprise-1.8.7-20XX.XX/lib/ruby/gems/1.8/gems/passenger-2.2.8
PassengerRuby
/opt/ruby-enterprise-1.8.7-20XX.XX/bin/ruby

 END STUFF TO SKIP FOR NOW

Some of Kete's downloading functionality requires an authorization step.  If used a lot this potentially can slow all requests being served from the site.  Thankfully there is an easy solution that Kete knows to use if enabled; X-sendfile.  You need to do the following to set it up:

root@host: # cd /usr/local/src/; wget https://tn123.org/mod_xsendfile/mod_xsendfile-0.12.tar.gz --no-check-certificate # or get the latest version of the source
root@host: # tar xfz mod_xsendfile-0.12.tar.gz
root@host: # cd mod_xsendfile-0.12
root@host: # apxs2 -cia mod_xsendfile.c
root@host: # cd /etc/apache2/mods-available; touch xsendfile.load
root@host: # echo "LoadModule xsendfile_module /usr/lib/apache2/modules/mod_xsendfile.so" > xsendfile.load
root@host: # cd /etc/apache2/mods-enabled/; ln -s ../mods-available/xsendfile.load

Then you need to add the following to your Apache2 config file (either global, or in a virtualhost):

XSendFile on

And force a reload of apache:

root@host: # /etc/init.d/apache2 force-reload

If it isn't already, you'll probably want to get Apache2 to start up automatically at boot. To do that, open a new console and run

root@host: # update-rc.d apache2 defaults # if it is already enabled, the response will tell you so

Important Note: At this point, Apache2 and Passenger are installed but not yet configured for our Kete site. We'll handle that in a separate step once we have Kete installed. Until then, web requests will throw an error until you have actually deployed your Kete application.



Next step:
Setting Up the Environment

Discuss This Topic

There are 0 comments in this discussion.

join this discussion

Creative Commons Attribution-Share Alike 3.0 New Zealand License
Debian Lenny Installing Required Software by Kieran P is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License