Topic: Debian Etch Installing Required Software

Topic type:

[Depreciated] Describes the steps necessary for installing Kete's required software on a Debian Etch host.

Documentation for Debian Etch is depreciated as Etch is now not a recommended platform for Kete. This Topic is kept as reference and not actively maintained.

Originally written by Walter McGinnis, Kete Project Lead 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 etch main
deb-src http://ftp.nz.debian.org/debian etch main
deb http://www.backports.org/debian etch-backports main contrib non-free
deb http://ftp.indexdata.dk/debian etch main
deb-src http://ftp.indexdata.dk/debian etch 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 from this source.

root@host: # apt-get update
root@host: # apt-get install debian-backports-keyring

And type 'Y' at the prompt. Then lets jump into what we can grab from debian packages.

root@host: # apt-get update   # grab any new packages after backport keyring was added
root@host: # apt-get 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-dev
root@host: # apt-get -t etch-backports install git-core git-svn git-doc
root@host: # apt-get build-dep imagemagick

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

root@host: # apt-get install wv poppler-utils lynx

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

root@host: # apt-get install libimage-exiftool-perl

Installing the Rails framework

You need an installation of Ruby. Ruby Enterprise Edition is a product from the same people that make mod_rails/Passenger (discussed at the bottom of this page). It's updated a lot more regularly than Debian updates their packages, which means it has more bug and security fixes. It's also optimized to run faster than a standard installation of Ruby. It requires a few extra installation steps, but it's well worth the effort. (for instructions on using debians packages, see an older version of this topic)

The great thing about Ruby Enterprise Edition (refered to as REE) is that the installer does the installing of Ruby and Rails in one go. It takes less than 15 minutes to setup once downloaded (depending on system speed) and less than 10 minutes to update in the future (depending on the amount of sites you have). Start by following the instructions at http://www.rubyenterpriseedition.com/download.html (download, extract, install). Keep the settings as the default ones REE assigns.

Warning: Versions prior to 20090610 contained a security issue which could cause DoS issues. It is highly recommended that you use 20090610 or a newer version when installing. If you have a previous version of Ruby Enterprise Edition, we recommend upgrading it as soon as possible.

Now add the following to the .bash_profile, and .bashrc filea 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.6-2009XXXX/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.6-2009XXXX/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

If this is the first time MySQL is being used on the system, 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 he 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.

ImageMagick

The version of ImageMagick on Debian is too old for the recent rmagik gem, that we'll install later, to work. To get around this, we have to compile the recent version of ImageMagick from scratch. The following steps were borrowed from Urban Puddle blog.

root@host: # cd /usr/local/src
# check the ImageMagick website for updates. At the time of writing, 6.5.0-10 was the most recent
root@host: # wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.5.0-10.tar.gz
root@host: # tar xvzf ImageMagick-6.5.0-10.tar.gz
root@host: # cd ImageMagick-6.5.0-10
root@host: # ./configure --with-gs-font-dir=/usr/share/fonts/type1/gsfonts
root@host: # make
root@host: # make install

Create /etc/ld.so.conf (if not already present) and make sure the following line is in it:

include /etc/ld.so.conf.d/*.conf

Add the following to /etc/ld.so.conf.d/libc6.conf: (You may need to create this file.)

# Added because we built ImageMagick from source
/usr/local/lib

Add the following to the .bashrc and .bash_profile files of root and the account running Kete

# Set LD Lib path
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

And finally, re-link the libraries:

root@host: # ldconfig

HTTP Request Server

We recommend Apache 2 in combination with Ruby Enterprise Edition for optimal performance.If you'd prefer to use Nginx with Mongrel, see an older version of this topic.

Apache 2 was installed earlier so, go ahead and install the passenger gem (the gem was installed during the setup of Ruby Enterprise Edition, if you are using a different interpreter, the run 'gem install passenger' as root, then continue).

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.6-2009XXXX/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot
/opt/ruby-enterprise-1.8.6-2009XXXX/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby
/opt/ruby-enterprise-1.8.6-2009XXXX/bin/ruby

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 http://tn123.ath.cx/mod_xsendfile/mod_xsendfile-0.9.tar.gz # or get the latest version of the source
root@host: # tar xfz mod_xsendfile-0.9.tar.gz
root@host: # cd mod_xsendfile-0.9
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
XSendFileAllowAbove 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

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 2 comments in this discussion.

Read and join this discussion

join this discussion

Creative Commons Attribution-Share Alike 3.0 New Zealand License
Debian Etch Installing Required Software by Walter McGinnis is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License