--- layout: post status: publish published: true title: Getting free_cite running on your own server wordpress_id: 2680 wordpress_url: https://www.martineve.com/?p=2680 date: !binary |- MjAxMy0wNS0xMiAxMDo0ODozOSArMDIwMA== date_gmt: !binary |- MjAxMy0wNS0xMiAwOTo0ODozOSArMDIwMA== categories: - Technology - Open Access tags: - Rails comments: [] ---

I decided that the best way to spend this Sunday morning was to try to get free_cite, a citation parsing system, running on my server. Turns out this is easier said than done; the README provides no information on which versions of different software you need and also gives no advice on setting up the ruby environment.

In any case, here's the best way to do it. Turns out that you run into a massive headache if you try to use default Debian/Ubuntu package managers to configure Ruby (really? this shouldn't be hard to get right... but hey).

If you think you don't need the below detailed instructions, here's the info you do need:

Ruby version: 1.8.7-p371
Rails version: 2.1

In any case, on Ubuntu 12.10, run:

{% highlight bash %} sudo apt-get install curl curl -L get.rvm.io | bash -s stable --auto rvm requirements sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \ curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \ libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison \ subversion pkg-config rvm install 1.8.7-p371 rvm --default use 1.8.7-p371 gem install -v=2.1 rails sudo apt-get install libpq-dev postgresql-client-9.1 postgresql-9.1 gem install pg wget http://superb-west.dl.sourceforge.net/sourceforge/crfpp/CRF++-0.47.tar.gz tar xvzf CRF++-0.47.tar.gz cd CRF++-0.47 ./configure && make && sudo make install cd CRF++-0.47/ruby ruby extconf.rb make sudo make install {% endhighlight %}

You then need to configure your postgresql database. As this is covered elsewhere, I'll leave it. Suffice to say that the instructions on the free_cite page for setting up the permissions are correct.

Next, do:

{% highlight bash %} git clone https://github.com/shoe/free_cite.git cd free_cite/config cp database.yml.example database.yml {% endhighlight %}

and then fill in the database details in database.yml.

Next:

{% highlight bash %} gem install crfpp gem install rake --version 0.8.7 {% endhighlight %}

You then need to edit lib/crfparser.rb to change the case of CRFPP to crfpp on the 4th "require" line.

Finally:

{% highlight bash %} rake _0.8.7_ crfparser:train_model rake _0.8.7_ db:migrate {% endhighlight %}