Setting up NCBI wwwblast on Ubuntu 8.04 (Hardy), Apache 2

Recently I needed to install NCBI wwwblast on my local workstation to enable some software that needed to interface with BLAST via the web service. It was straightforward to install, but I took some notes, because there were a few changes required with respect to the official wwwblast documentation at NCBI. These instructions are for Ubuntu 8.04, but probably will work with many recent flavours of Debian.

Download and install

Download NCBI wwwblast from ftp://ftp.ncbi.nih.gov/blast/executables/LATEST/ (The version I used was wwwblast-2.2.18-ia32-linux.tar.gz).

Untar it into /var/www/ , preserving permissions.

$ cd /var/www/
$ sudo tar zxvpf wwwblast-2.2.18-ia32-linux.tar.gz

You will also need to make sure csh (the “C-shell”) is installed, since the blast.cgi script needs this to run:

$ sudo apt-get install csh

(Thanks to jpopesku for spotting this missing package [comments below])

Set up Apache2

The instructions in the official wwwblast manual didn’t seem to work for Apache2 .. (could be a typo: Follow SymLinks should be FollowSymLinks … one camel-case word without the space). I put this in into the VirtualHost definition in the standard /etc/apache2/sites-available/default file used by Apache2 in Ubuntu 8.04.

   # modified slightly from:
    #http://www.ncbi.nlm.nih.gov/staff/tao/URLAPI/wwwblast/node10.html
    <Directory "/var/www">
        AddHandler cgi-script cgi REAL
        Options Indexes FollowSymLinks MultiViews +ExecCGI
        Order allow,deny
        Allow from all
    </Directory>

The code above was inserted just before the </VirtualHost> closing tag.

Restart Apache for good measure.

$ sudo /etc/init.d/apache2 restart

Configure your wwwblast to see your databases

Assuming you already have some existing BLAST formatted databases made with formatdb, you will then need to configure wwwblast to find them, as per the manual. In short, this involves putting the BLAST database files into /var/www/blast/db/ (or symlinking to the files), modifying /var/www/blast/blast.rc (or one of the other *.rc files, for other BLAST programs, eg psiblast) to associate the database name with a BLAST program, and modifying the dropdown database list in /var/www/blast/blast.html (or one of the other *.html files for other BLAST programs) to add the name of the database(s).

My BLAST databases live in /data/databases/blast/, so I simply moved the example database directory /var/www/blast/db to /var/www/blast/db.orig:

$ sudo mv  /var/www/blast/db /var/www/blast/db.orig

then symlinked /var/www/blast/db to /data/databases/blast:

$ sudo ln -s /data/databases/blast /var/www/blast/db

In /var/www/blast/blast.rc I changed the line:

blastp test_aa_db

to:

blastp nr swissprot pdbaa

(you may also want to configure blastn etc in the same way)

In /var/www/blast/blast.html, I changed the test database code:

<select name = "DATALIB">
    <option VALUE = "test_aa_db"> test_aa_db
    <option VALUE = "test_na_db"> test_na_db
</select>

to:

<select name = "DATALIB">
    <option VALUE = "nr"> nr
    <option VALUE = "swissprot"> swissprot
    <option VALUE = "pdbaa"> pdbaa
</select>

(you may want to do this for other BLAST programs too, eg also edit psiblast.html)

This will allow be to search the nr, swissprot and pdbaa databases I have installed using plain-vanilla BLAST.

Test it out

Go to http://localhost/blast/blast.html.

You should find the wwwblast interface, with a dropdown box featuring the database(s) you added. Run a test search with your favorite sequences (ensure you also select the correct blast program, eg blastp !). Enjoy using your own CPU time !

19 thoughts on “Setting up NCBI wwwblast on Ubuntu 8.04 (Hardy), Apache 2

  1. thanks a lot! i have been struggling a bit with setting up a BLAST server for my lab, and this helped

  2. This question is more for xander: I am a research fellow at NIH and I was wondering if NIH supports Ubuntu. Many Institutes offer support for Red Hat Enterprise but I am an Ubuntu fan (who had before Fedora and Red Hat but then I switched to Ubuntu).

  3. Radu: I’m not at NIH, but I visitd there for a few months last year. They were apparently _allowed_ to install and use Ubuntu if they needed it, but I’m unsure if it is _officially_ supported.

  4. Hi,
    great post, thanks for sharing! However, I’m having an Apache2 related (I think) configuration problem:
    I keep getting a “Forbidden You don’t have permission to access /blast/blast.cgi on this server.” message when trying to run the scripts (via the Search button). At this stage I’ve even tried chmod ugo+rwx on all files but no success. I did uncomment the AddHandler cgi-script .cgi line in /etc/apache2/mods-available/mime.conf.
    This is my /etc/apache2/sites-available/blast (the /etc/apache2/sites-available/default left unchanged):

    DocumentRoot /var/www/

    AddHandler cgi-script cgi REAL
    Options Indexes FollowSymLinks MultiViews +ExecCGI
    Order allow,deny
    Allow from all

    Any help most welcomed!
    Thanks,
    Johan

  5. Not 100 % sure what’s causing that problem (unfortunately your config text got munged by the blog due to html-like tags). Here are a few ideas:

    As a test, are you able to try putting the block of <Directory> config stuff just before the closing </VituralHost> tag in your /etc/apache2/sites-available/default file ? I can see why you may want it in a separate site definition like /etc/apache2/sites-available/blast (say you were running on some site off http://www.example.com and you wanted blast accessible from wwwblast.example.com), but testing it this way could help isolate the issue, since presumably regular cgi’s run fine from the default site.

    Not sure if it matters, since it’s already defined the line AddHandler cgi-script cgi REAL, but you should try adding REAL to the uncommented AddHandler line in /etc/apache2/mods-available/mime.conf too.

    Sorry I can’t be of more help … I wouldn’t claim to be an Apache expert 😛

  6. Perry!
    Thanks for the suggestions. I’ve basically tried those but the problems is probably somewhere else on my setup. I tried your original instructions on a different computer with a fresh Ubuntu installation and it worked perfectly. Have to find time to repair the other server someday…
    Thanks afain for your reply.
    Cheers
    Johan

  7. Hey all,
    I’m hoping maybe someone here can help me out. First off, Perry: thanks for the howto.

    To the meat & potatoes:
    I had installed wwwblast on Edgy a couple of years ago under Apache. When Apache2 came out, I upgraded. When Feisty and then Hardy and Intrepid came along, I upgraded. Everything was smooth sailing with my BLAST server.

    Then the HDD crashed.

    So I bought a new drive and installed a fresh version of (desktop) Intrepid, followed by the necessary updates:

    sudo apt-get upgrade

    I installed Apache2 (sudo apt-get install apache2) and then tried installing wwwblast (currently 2.2.19). I followed the instructions in the above howto (copy/paste into my sites-available/default file), but when I run a BLAST query, I get a Error 500 (Internal Server Error).

    Anyone have any clues? I tried comparing my old apache2.conf with the new one, and they’re virtually identical. I’ve also uncommented the AddHandler for cgi in mime.conf. Apart from that, the install is fresh.

    Could it be a permissions problem for cgi/REAL?? I’m pretty sure I’m missing something, but it’s been years, so I can’t remember!!!

    Any help would be greatly appreciated! Thanks in advance!

    Specs:
    – Ubuntu Intrepid Ibex 8.10 AMD64
    – wwwblast 2.2.19 x64
    – apache2

    JP

  8. I think I’ve narrowed down my problem.
    In my /var/log/apache2/error.log, it’s saying:

    No such file or directory: exec of ‘/var/www/blast/blast.cgi’ failed, referer: http://localhost/blast/blast.html
    Premature end of script headers: blast.cgi, referer: http://localhost/blast/blast.html

    Googling the error doesn’t really help as it just tells me that there’s a problem with the code, which I don’t think I can change (can I?!).

    Any suggestions?
    Thanks again!
    JP

  9. Great to see you solved it – and thanks for leaving notes about how you got there … hopefully that will help others out too. The old ‘missing csh’ (or tcsh) problem seems to crop up quite often when installing bioinformatic and structural biology software – it’s just that little bit harder to diagnose the problem with a cgi script (but usually cgi scripts can be run from the command line … trying this sometimes gives a hint).

    I guess using csh is a hangover from a time when most scientists wrote code on ‘real Unix’ machines that tend to have csh but not bash, rather than Linux (or BSD/OSX etc) boxes that don’t always have csh by default.

    (Also, sorry I didn’t get a chance to reply before you solved your own problem – it’s been a busy week, and I was leaving it for the weekend when I have time).

  10. Oh, I should add that I’ve updated the post to reflect your discovery that csh is required (I must have just been lucky and already had it installed when I wrote the how-to). Cheers !

Leave a Reply

Your email address will not be published. Required fields are marked *