Skip to content

Installation Instructions

cRugg edited this page Feb 8, 2014 · 11 revisions

Installation Instructions

Linux

Prerequisites

BibleForge requires the following dependencies:

  1. Node.js
  2. Nginx
  3. MariaDB (or MySQL)
  4. Sphinx

Node.js

BibleForge requires Node.js 0.8 or higher.

Nginx

A recent version of Nginx is required. The recommend version is 1.2.2, which can be downloaded here. See Nginx's installation guide for details.

MariaDB

BibleForge works best with the 5.5.x family of MariaDB. MariaDB can be downloaded from here. If you need help setting it up, see their installation guide. A sample my.cnf file can be found here if needed.

Although it is possible to use MySQL, MariaDB has better integration with Sphinx.

Sphinx

The BibleForge project maintains a customer version of Sphinx, which can be downloaded from here (however, the any official 2.0.x version will do in a pinch).

Note:

In order to compile Sphinx, you will need the source code from MariaDB or MySQL. On Ubuntu/Debian systems, you can run

sudo apt-get install libmysqlclient-dev

On Fedora, you can run the following:

yum install mysql-devel

You can also just download the source code and specify it's location when configuring Sphinx. For example:

./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql
make
sudo make install

See below for details on setting up Sphinx.

Installation:

1. After installing the above prerequisites, download and extract the Bible texts and other textual data.

wget https://github.com/bibleforge/BibleForgeDB/tarball/master
mv master BibleForgeDB.tar.gz
tar -zxvpf BibleForgeDB.tar.gz

(Note: If wget gives you an error, try adding the --no-check-certificate argument.)

2. Enable the SphinxSE storage engine plugin in MariaDB by starting up a MariaDB client and executing the following query: INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';. Below is an example of how to do this:

mysql -u MARIADB_USER -p
> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
> quit

3. Import the data.

cd bibleforge-BibleForgeDB-???????
./import.sh

4. To setup Sphinx, create a directory to store the Sphinx indexes (this can be anywhere except in the /var/www/ directory). The default location is /var/sphinx_data/.

mkdir /var/sphinx_data/

Then copy the file sphinx_bf.sample.conf from the Sphinx source directory to this new directory and rename the file to sphinx_bf.conf.

mv sphinx_bf.sample.conf /var/sphinx_data/sphinx_bf.conf

5. Edit the sphinx_bf.conf file that you just copied to add your MySQL password and directory paths. This will be done on each line with sql_pass. Now enter the full path to your sphinx_bf.conf directory on every line with path (if not the default). For example:

source verse_text_en_src
{
    type      = mysql
    sql_host  = localhost   # The MySQL server address
    sql_user  = MYSQL_USER  # The MySQL username
    sql_pass  = s3cRetPaS$  # The MySQL password
    sql_db    = bf          # The MySQL database
    sql_port = 3306         # The MySQL port
    #sql_sock  = /var/run/mysqld/mysql.sock # The MySQL socket (if not using a port)
    
    sql_query      = SELECT id, words FROM `bible_en_verses`
    sql_query_info = SELECT words FROM `bible_en_verses` WHERE id = $id
}

index verse_text_en
{
    source            = verse_text_en_src
    path              = /var/sphinx_data/data_verse_text_en
    docinfo           = none
    charset_type      = sbcs #NOTE: sbcs is "single-byte encoding". utf-8 can also be used (without quotes).
    morphology        = stem_en
    min_word_len      = 1
    enable_star       = 1
    min_infix_len     = 1
    index_exact_words = 1
}

...

Note that you need to do this for every occurrence of sql_user, sql_pass, and path. You may also want to change the locations of the log files (in the searchd section), which default to /var/sphinx_data/.

6. Index the Bible text in preparation for the search engine (Sphinx).

indexer --all --config sphinx_bf.conf

7. To setup Nginx, replace the default nginx.conf file (located in /usr/local/nginx/conf by default) with the one here. You may want to modify the location of log files (which are placed in /var/log/nginx/ by default), the root directory (which defaults to /var/www/BibleForge/client), or the port number (which defaults to 7070).

8. Download BibleForge, and extract it into /var/www directory (or where ever you choose).

wget https://github.com/bibleforge/BibleForge/tarball/master
mv master BibleForge.tar.gz
tar -zxvpf BibleForge.tar.gz

(Note: After extracting the data, move the directory to /var/www/BibleForge.)

9. Install Node.js modules.

In the BibleForge directory, run

npm install mysql emailjs

10. Configure BibleForge by copying /var/www/BibleForge/server/config.sample.js to /var/www/BibleForge/server/config.js and enter in the MariaDB/MySQL username and password.

11. Start Sphinx.

searchd --config /PATH/TO/sphinx_bf.conf

12. Start BibleForge.

cd /var/www/BibleForge/server
node bibleforge.js

13. Finally, go to http://localhost:7070/, and enjoy.

14. (Optional) If you wish for BibleForge to start automatically, you can create a cronjob that will start the search engine at boot and BibleForge.

To create a new cronjob, run the following:

crontab -e

Then add this line in the in text editor:

@reboot searchd --config /PATH/TO/sphinx_bf.conf
@reboot cd /var/www/BibleForge/server && node bibleforge.js

If Nginx and MariaDB do no automatically start at boot, add the following as well:

@reboot /PATH/TO/nginx
@reboot cd /PATH/TO/mariadb && ./bin/mysqld_safe --defaults-file=/PATH/TO/.my.cnf --basedir=.