Installing Discovery on Ubuntu 10.04 LTS

This document assumes we're beginning the process from a vanilla installation of Ubuntu 10.04 LTS, i.e. no programming languages, databases, or webservers installed. We also assume you have terminal access to the system.

At the terminal ensure you have updated the system to the latest patches etc.

sudo apt-get update
sudo apt-get upgrade

Installing MongoDB

Please read and follow http://support.vamosa.com/kb/discovery/installing-mongodb-on-ubuntu... first.

Installing Ruby 1.9.2

Discovery is written in Ruby, however Ubuntu 10.04 only supports Ruby 1.8.7, so we'll need to compile Ruby 1.9.2 from source.

First install the following packages:

sudo apt-get -y install build-essential libc6-dev libssl-dev curl git-core zlib1g-dev libreadline5-dev libxslt-dev libxml2-dev libcurl4-gnutls-dev libcurl4-gnutls-dev

Then download and compile Ruby 1.9.2 with the following steps:

cd /tmp
mkdir src
cd src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.bz2
tar xjvf ruby-1.9.2-p290.tar.bz2
cd ruby-1.9.2-p290
./configure --prefix=/usr/local
sudo make && sudo make install

Check the Ruby version now installed:

ruby -v             # Should say 'ruby 1.9.2p290'

Installing Redis

Redis is used a queue/messaging system by Discovery. The following steps will download, compile from source, and install the software

cd /tmp/src
wget http://redis.googlecode.com/files/redis-2.4.2.tar.gz
tar -zxvf redis-2.4.2.tar.gz
cd redis-2.4.2
sudo make && make install

Next download the following daemon and config scripts:

wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server
wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
sudo mv redis-server /etc/init.d/redis-server
sudo chmod +x /etc/init.d/redis-server
sudo mv redis.conf /etc/redis.conf

Create a redis user and prepare the data and logging folders:

sudo mkdir -p /var/lib/redis
sudo mkdir -p /var/log/redis
sudo useradd --system --home-dir /var/lib/redis redis
sudo chown redis.redis /var/lib/redis
sudo chown redis.redis /var/log/redis

Lastly activate the daemon scripts and start Redis:

sudo update-rc.d redis-server defaults
sudo service redis-server start

Test your Redis installation by running:

redis-cli info           # should return lots of stats

Installing Discovery Dependencies

Before intalling Discovery we need to install some Ruby Gem dependencies.
First ensure we're using the most update to date gem manager:

sudo gem update --system

Next install the following gem:

sudo gem install bundler --no-rdoc --no-ri

Now switch into the Discovery folder and continue:

cd ~/discovery
sudo bundle

Configuring Discovery's datasources

Discovery requires connection details for the Redis and MongoDB backends. In single-server Discovery instances the Redis process will be local to the Discovery server, however the MongoDB process should be hosted on it own server.

Copy the example configuration file.

cp ~/discovery/config/mtron_solo.yml.example ~/discovery/config/mtron_solo.yml

Edit the ~/discovery/config/mtron_solo.yml file. You'll see a section of the file called production. Change redis_host and mongo_host sections to reflect your servers. You can use either DNS hostnames or IP-addresses.

production:
    redis_host:               "localhost"
    mongo_host:               "mongodb.local"