TPP 5.0.0: Installing on Ubuntu 16.04

From SPCTools

(Difference between revisions)
Jump to: navigation, search
Revision as of 23:39, 29 November 2016
Edeutsch (Talk | contribs)

← Previous diff
Current revision
Edeutsch (Talk | contribs)

Line 13: Line 13:
* This installation assumes you are installing to <code>/local/tpp/</code>, if you want to install anywhere else, change accordingly * This installation assumes you are installing to <code>/local/tpp/</code>, if you want to install anywhere else, change accordingly
* This installation assumes you are using Apache 2.4 as your web server * This installation assumes you are using Apache 2.4 as your web server
-* Where a block is presented with lines beginning with a dollar ($), these are commands to be typed in at the shell directly. You should be able to copy and paste them a line at a time.+* The gray blocks are commands to be typed in at the shell directly. You should be able to copy and paste them a line at a time.
== Installation == == Installation ==
-=== Installing prerequisites ===+=== Installing prerequisite packages ===
Use the ubuntu package manager to install all the dependencies Use the ubuntu package manager to install all the dependencies
-<pre style="white-space: pre-wrap">$ apt-get install g++ subversion vim apache2 libbz2-dev swig expat libpng12-dev+<pre style="white-space: pre-wrap">sudo apt --yes install subversion
-$ apt-get install gnuplot libperl-dev libxml-parser-perl build-essential libgd2-xpm libgd2-xpm-dev libboost-all-dev+sudo apt --yes install make
-$ apt-get install libboost-dev libboost-doc boost-build</pre>+sudo apt --yes install g++
 +sudo apt --yes install g++-4.9
 +sudo apt --yes install build-essential
 +sudo apt --yes install zlib1g-dev
 +sudo apt --yes install libghc-bzlib-dev
 +sudo apt --yes install gnuplot
 +sudo apt --yes install unzip
 +sudo apt --yes install expat
 +sudo apt --yes install libexpat1-dev
 +</pre>
-=== Extracting and building the source ===+=== Using an old compatibility version of gcc ===
-Extract TPP-4-5-2-src.tgz to /usr/local/src+Although later TPP versions can use gcc 5, the version of Boost and ProteoWizard bundled with TPP 5.0.0 seems to require gcc 4.x. Use the below commands to force an older version of gcc (assumes you installed it above!)
-<pre>$ cd /usr/local/src+<pre style="white-space: pre-wrap">ll /usr/bin/gcc* /usr/bin/g++*
-$ tar xzf TPP-4-5-2-src.tgz</pre>+sudo rm /usr/bin/g++
 +sudo rm /usr/bin/gcc
 +sudo ln -s g++-4.9 /usr/bin/g++
 +sudo ln -s gcc-4.9 /usr/bin/gcc
 +ll /usr/bin/gcc* /usr/bin/g++*
 +</pre>
-Create a new file <code>/usr/local/src/TPP-4.5.2/src/Makefile.config.incl</code> and populate it with+=== Creating a suitable place to compile and install ===
-<pre>TPP_ROOT=/usr/local/tpp/+In this recipe, we install in /local. You may wish to install in a different location, and the recipe should be adjusted accordingly. This also assumes that you will use an account 'tpp' and group 'tpp'. Maybe you'll use a different account.
-TPP_WEB=/tpp/+
-## for Boost+
-BOOST_INCL=-I/usr/include/boost/+
-BOOST_LIBDIR=/usr/lib+
-BOOST_LIBSPEC=-gcc43-mt+
-LINK=shared+
-LIBEXT=so+
-PERL_LIB_CORE= /usr/lib/perl/5.10/CORE/</pre>+
-Build TPP+<pre style="white-space: pre-wrap">sudo mkdir /local
 +cd /local
 +sudo mkdir tpp data svn
 +sudo chown tpp.tpp tpp data svn
 +</pre>
-<pre>$ make && make install</pre>+=== Downloading the source code from svn ===
-Copy any files from /usr/local/src/TPP-4.5.2/perl to /usr/local/tpp/bin if they don't exist there already+<pre>cd /local/svn
 +svn checkout svn://svn.code.sf.net/p/sashimi/code/tags/release_5-0-0
 +</pre>
-<pre>$ cp -n /usr/local/src/TPP-4.5.2/perl/* /usr/local/tpp/bin</pre>+=== Compiling the source code ===
-=== Configuring your installation for use ===+Create a custom <code>site.mk</code> file with something like the following. After pasting in the three data lines, hit CTRL-D.
-Add local configuration data to <code>/usr/local/tpp/cgi-bin/tpp_gui_config.pl</code>. Add the following lines '''immediately after the line''' <code># SET TPP_GUI DEFAULTS HERE</code>. Nothing along these paths can be a symlink, because the TPP web client (Petunia) resolves absolute paths and checks those against the config, which means symlinks will look like they're outside of the allowed directories. You can probably get around this with some funky apache configuration using URL rewrites, but that's too complex to go into here, and not necessary generally. Note the trailing slashes, they are important!+
-<pre> 'base_dir' => '/usr/local/tpp/',+<pre>cd /local/svn/release_5-0-0
- 'www_root' => '/usr/local/tpp/',+cat > site.mk
- 'data_dir' => '/usr/local/tpp/data/',+INSTALL_DIR = /local/tpp
- 'tppbin' => '/usr/local/tpp/bin/',</pre>+TPP_BASEURL = /tpp
 +TPP_DATADIR = /local/data
 +</pre>
-Create the data directory and set permissions and ownership so that apache can use it properly+First make libgd.
-<pre>$ cd /usr/local/tpp+<pre>make libgd
-$ mkdir data+</pre>
-$ mkdir data/parameters+
-$ cp /usr/local/tpp/bin/isb_default_* /usr/local/tpp/data/parameters+
-$ chown -R www-data:www-data /usr/local/tpp/data+
-$ chmod -R 0660 /usr/local/tpp/data+
-$ chmod -R a+X /usr/local/tpp/data</pre>+
-=== Setting up apache ===+Then make everything else. This will start by unpacking Boost and ProteoWizard and compile all that and then compile the TPP. This takes quite a while.
-Now we need to tell apache about the TPP installation. Create a new file <code>/etc/apache2/sites-available/tpp-x.y.z</code> and populate with+<pre>make all
 +</pre>
-<pre><VirtualHost *:80>+If the above completed without error, then you're ready to proceed. If the compilation stopped with an error, you will need to troubleshoot. Perhaps some prerequisite is not installed on your system. It is rumored that sometimes just doing another `make all` will allow completion of compilation.<P>
 +Next, install it!
- # directory to store data for web browser viewing+<pre>make install
- Alias /tpp/data "/usr/local/tpp/data"+</pre>
- <Directory "/usr/local/tpp/data">+
- AllowOverride None+
- Options Indexes +FollowSymLinks Includes+
- Order allow,deny+
- Allow from all+
- </Directory>+
- # directory for tpp's html resources (css, js, images, etc)+Next you'll need to make sure that all the Perl modules are available. The following works on the fresh version of Ubuntu 16.04 that we tried on:
- Alias /tpp/html "/usr/local/tpp/html"+
- <Directory "/usr/local/tpp/html">+
- AllowOverride None+
- Options Includes Indexes FollowSymLinks MultiViews+
- Order allow,deny+
- Allow from all+
- </Directory>+
- # directory for tpp's schema resources+<pre>sudo cpan
- <Directory "/usr/local/tpp/schema">+ (answer yes)
- AllowOverride None+ make install
- Options Includes Indexes FollowSymLinks MultiViews+ install Bundle::CPAN
- Order allow,deny+ (this takes a long time. At one point you need to hit [ENTER] to accept the 'exit')
- Allow from all+ install CGI
- </Directory>+ install IO::Uncompress::Gunzip
 + (this might already be included in Bundle::CPAN, or maybe not)
 + install XML::Parser
 + (need to hit [ENTER] twice to answer silly questions)
 + install FindBin::libs
 + quit
 +</pre>
- # directory for tpp's executable files+Now test to make sure all modules are installed:
- ScriptAlias /tpp/cgi-bin "/usr/local/tpp/cgi-bin"+
- <Directory "/usr/local/tpp/cgi-bin">+
- #AllowOverride AuthConfig Limit+
- AllowOverride All+
- Options Indexes +FollowSymLinks MultiViews ExecCGI +Includes+
- AddHandler default-handler .jpg .png .css .ico .gif+
- AddHandler cgi-script .cgi .pl+
- Order allow,deny+
- Allow from all+
- SetEnv WEBSERVER_ROOT /usr/local/+
- #SetEnv WEBSERVER_ROOT /var/www+
- </Directory>+
- +
- # Enables Lorikeet spectrum display program to work for linux +
- Alias /ISB /usr/local/tpp+
-</VirtualHost></pre>+
-TPP produces pepxml files but links to them as .shtml in the putunia gui. We need to enable the SSI includes module to make these links work, which is not enabled by default in ubuntu server. You can see whether you already have the includes module enabled by running+<pre>cd /local/tpp/cgi-bin
 +perl tpp_gui.pl
 +</pre>
-<pre>$ apache2ctl -M</pre>+If it compiles and you get an error about being unable to find HomePath then you're fine.
 +However, if you get an error not being able to find a module, then go back to cpan and install it.<P>
-If the list contains "include_module" then you've already got it enabled, if not, enable it by running+If you have no interest in using the web interface, then you're done. Happy TPPing. However, if you want the web interface, install and configure Apache. The following assumes you will install on port 10401. Substitute 10401 for 80 if you want to install on the default port.
-<pre>$ a2enmod include</pre>+<pre>sudo apt --yes install apache2
 +cd /local/tpp/conf
 +cat httpd-tpp.conf | sed 's/_TPP_PORT_/10401/' > httpd-tpp-1.conf
 +cat httpd-tpp-1.conf | sed 's/ScriptInterpreterSource/#ScriptInterpreterSource/' > httpd-tpp-2.conf
-Finally, we enable the virtual host we've just created+vi httpd-tpp-2.conf
 +Comment out:
 +# PassEnv TPP_HOME
 +# PassEnv TPP_DATADIR
 +UNcomment and add beginning slashes:
 + SetEnv TPP_HOME /local/tpp
 + SetEnv TPP_DATADIR /local/tpp/data
 + SetEnv TPP_BASEURL /tpp
 + SetEnv TPP_DATAURL /tpp/data
 +</pre>
-<pre>$ a2ensite tpp-x.y.z+Next configure the permission access to the server. If only the localhost should be able to access the interface (e.g. installation on a laptop running Linux then only grant access to 127.0.0.1. Or you can just give access to a range of IP addresses. Or you could grant world access if you have collaborators everywhere accessing the system. This confers some additional possible security risks. In this example, we've used the Apache 2.4 syntax to grant world access:
-$ /etc/init.d/apache2 restart</pre>+
-And now you're good to go ... head on over to http://localhost/tpp/cgi-bin/tpp_gui.pl; And you can give up your root shell now by issuing the command +<pre>
 +<Directory "/local/tpp">
 + AllowOverride None
 + Require all granted
 +# Order deny,allow
 +# Deny from all
 +# Allow from 127.0.0.0/255.0.0.0 ::1/128
 +# Order allow,deny
 +# Allow from all
 +</pre>
 + 
 +Next set up some needed Apache modules:
 + 
 +<pre>sudo a2enmod rewrite
 +sudo a2enmod cgi
 +sudo service apache2 restart
 +</pre>
 + 
 +Next install this config file. This may vary among distributions, but this seems like a nice way to do it on our test instance.
 + 
 +<pre>cd /etc/apache2/conf-available
 +sudo cp -p /local/tpp/conf/httpd-tpp-2.conf httpd-tpp.conf
 +cd ../conf-enabled
 +sudo ln -s ../conf-available/httpd-tpp.conf
 +sudo service apache2 reload
 +</pre>
 + 
 +If that reload generated an error, you'll need to troubleshoot your configuration. Next, set some appropriate permissions for the web server to write. With the first command, verify that your Apache server is running as the user www-data. If it's running as a different user, then substitute that.
 + 
 +<pre>ps aux | grep apache
 +set tmpUser=www-data
 +cd /local/tpp
 +sudo chown -R $tmpUser.$tmpUser data log users
 +</pre>
 + 
 +And now you're good to go ... head on over to http://localhost:10401/tpp/cgi-bin/tpp_gui.pl or if this is installed on a different machine, use its name or IP address, e.g. http://40.83.177.49:10401/tpp/cgi-bin/tpp_gui.pl. Note that the above installation assumes installation on port 10401. If you chose a different port, then adjust the above URLs accordingly.
-<pre>$ exit</pre> 
== Installing the tutorial data (optional) == == Installing the tutorial data (optional) ==
-If you want to test your installation using the SPC demo/tutorial data (yeast ORF data) then there are a few extra steps. First create a demo directory in the data area+If you want to test your installation using the SPC demo/tutorial data (yeast data) then there are a few extra steps. First create a demo directory in the data area
 + 
 +<pre>mkdir /local/tpp/data/demo</pre>
-<pre>$ mkdir /usr/local/tpp/data/demo</pre>+Extract all the example files (mzXML, tandem params, fasta database) to <code>/local/tpp/data/demo</code>
-Extract all the example files (mzXML, tandem params, fasta database) to <code>/usr/local/tpp/data/demo</code>+[STOPPED HERE. WHERE DID THESE FILES MAGICALLY COME FROM??]
You'll also need to create a download directory for SpectraST libraries. You'll also need to create a download directory for SpectraST libraries.

Current revision

middle
Note that this recipe will likely not be exactly applicable to different versions of TPP and different distributions of Linux, but perhaps can be a useful head start. For other versions of TPP, please see the README and INSTALL_LINUX files found in source code distribution for instructions on how to build TPP for the Linux platform.


Contents

Before we begin

First some general notes

  • We assume a fresh installation of Ubuntu 16.04 as a starting point.
  • This recipe was tested on a fresh Ubuntu 16.04 LTS instance running on Azure in November 2016
  • We assume that there is an ordinary user account named 'tpp' that will be used as the primary account. This account will need sudo privileges
  • This installation assumes you are installing to /local/tpp/, if you want to install anywhere else, change accordingly
  • This installation assumes you are using Apache 2.4 as your web server
  • The gray blocks are commands to be typed in at the shell directly. You should be able to copy and paste them a line at a time.

Installation

Installing prerequisite packages

Use the ubuntu package manager to install all the dependencies

sudo apt --yes install subversion
sudo apt --yes install make
sudo apt --yes install g++
sudo apt --yes install g++-4.9
sudo apt --yes install build-essential
sudo apt --yes install zlib1g-dev
sudo apt --yes install libghc-bzlib-dev
sudo apt --yes install gnuplot
sudo apt --yes install unzip
sudo apt --yes install expat
sudo apt --yes install libexpat1-dev

Using an old compatibility version of gcc

Although later TPP versions can use gcc 5, the version of Boost and ProteoWizard bundled with TPP 5.0.0 seems to require gcc 4.x. Use the below commands to force an older version of gcc (assumes you installed it above!)

ll /usr/bin/gcc* /usr/bin/g++*
sudo rm /usr/bin/g++
sudo rm /usr/bin/gcc
sudo ln -s g++-4.9 /usr/bin/g++
sudo ln -s gcc-4.9 /usr/bin/gcc
ll /usr/bin/gcc* /usr/bin/g++*

Creating a suitable place to compile and install

In this recipe, we install in /local. You may wish to install in a different location, and the recipe should be adjusted accordingly. This also assumes that you will use an account 'tpp' and group 'tpp'. Maybe you'll use a different account.

sudo mkdir /local
cd /local
sudo mkdir tpp data svn
sudo chown tpp.tpp tpp data svn

Downloading the source code from svn

cd /local/svn
svn checkout svn://svn.code.sf.net/p/sashimi/code/tags/release_5-0-0

Compiling the source code

Create a custom site.mk file with something like the following. After pasting in the three data lines, hit CTRL-D.

cd /local/svn/release_5-0-0
cat > site.mk
INSTALL_DIR = /local/tpp
TPP_BASEURL = /tpp
TPP_DATADIR = /local/data

First make libgd.

make libgd

Then make everything else. This will start by unpacking Boost and ProteoWizard and compile all that and then compile the TPP. This takes quite a while.

make all
If the above completed without error, then you're ready to proceed. If the compilation stopped with an error, you will need to troubleshoot. Perhaps some prerequisite is not installed on your system. It is rumored that sometimes just doing another `make all` will allow completion of compilation.

Next, install it!

make install

Next you'll need to make sure that all the Perl modules are available. The following works on the fresh version of Ubuntu 16.04 that we tried on:

sudo cpan
      (answer yes)
  make install
  install Bundle::CPAN
      (this takes a long time. At one point you need to hit [ENTER] to accept the 'exit')
  install CGI
  install IO::Uncompress::Gunzip
      (this might already be included in Bundle::CPAN, or maybe not)
  install XML::Parser
      (need to hit [ENTER] twice to answer silly questions)
  install FindBin::libs
  quit

Now test to make sure all modules are installed:

cd /local/tpp/cgi-bin
perl tpp_gui.pl

If it compiles and you get an error about being unable to find HomePath then you're fine. However, if you get an error not being able to find a module, then go back to cpan and install it.<P>

If you have no interest in using the web interface, then you're done. Happy TPPing. However, if you want the web interface, install and configure Apache. The following assumes you will install on port 10401. Substitute 10401 for 80 if you want to install on the default port.

sudo apt --yes install apache2
cd /local/tpp/conf
cat httpd-tpp.conf | sed 's/_TPP_PORT_/10401/' > httpd-tpp-1.conf
cat httpd-tpp-1.conf | sed 's/ScriptInterpreterSource/#ScriptInterpreterSource/' > httpd-tpp-2.conf

vi httpd-tpp-2.conf
Comment out:
#    PassEnv TPP_HOME
#    PassEnv TPP_DATADIR
UNcomment and add beginning slashes:
   SetEnv TPP_HOME    /local/tpp
   SetEnv TPP_DATADIR /local/tpp/data
   SetEnv TPP_BASEURL /tpp
   SetEnv TPP_DATAURL /tpp/data

Next configure the permission access to the server. If only the localhost should be able to access the interface (e.g. installation on a laptop running Linux then only grant access to 127.0.0.1. Or you can just give access to a range of IP addresses. Or you could grant world access if you have collaborators everywhere accessing the system. This confers some additional possible security risks. In this example, we've used the Apache 2.4 syntax to grant world access:

<Directory "/local/tpp">
    AllowOverride None
    Require all granted
#    Order deny,allow
#    Deny from all
#    Allow from 127.0.0.0/255.0.0.0 ::1/128
#   Order allow,deny
#   Allow from all

Next set up some needed Apache modules:

sudo a2enmod rewrite
sudo a2enmod cgi
sudo service apache2 restart

Next install this config file. This may vary among distributions, but this seems like a nice way to do it on our test instance.

cd /etc/apache2/conf-available
sudo cp -p /local/tpp/conf/httpd-tpp-2.conf httpd-tpp.conf
cd ../conf-enabled
sudo ln -s ../conf-available/httpd-tpp.conf
sudo service apache2 reload

If that reload generated an error, you'll need to troubleshoot your configuration. Next, set some appropriate permissions for the web server to write. With the first command, verify that your Apache server is running as the user www-data. If it's running as a different user, then substitute that.

ps aux | grep apache
set tmpUser=www-data
cd /local/tpp
sudo chown -R $tmpUser.$tmpUser data log users 

And now you're good to go ... head on over to http://localhost:10401/tpp/cgi-bin/tpp_gui.pl or if this is installed on a different machine, use its name or IP address, e.g. http://40.83.177.49:10401/tpp/cgi-bin/tpp_gui.pl. Note that the above installation assumes installation on port 10401. If you chose a different port, then adjust the above URLs accordingly.


Installing the tutorial data (optional)

If you want to test your installation using the SPC demo/tutorial data (yeast data) then there are a few extra steps. First create a demo directory in the data area

mkdir /local/tpp/data/demo

Extract all the example files (mzXML, tandem params, fasta database) to /local/tpp/data/demo

[STOPPED HERE. WHERE DID THESE FILES MAGICALLY COME FROM??]

You'll also need to create a download directory for SpectraST libraries.

$ mkdir -p /usr/local/tpp/data/dbase/speclibs

Set the permissions and ownership

$ chown -R www-data:www-data /usr/local/tpp/data/demo /usr/local/tpp/data/dbase
$ chmod -R 0660 /usr/local/tpp/data/demo /usr/local/tpp/data/dbase
$ chmod -R a+X /usr/local/tpp/data/demo /usr/local/tpp/data/dbase

The tandem.xml parameters file has a hard coded path that is windows specific. You will need to change the windows path to isb_default_input_kscore.xml in tandem.xml to the correct Linux path. The file can normally be found in linux instalaltions at /usr/local/tpp/bin/isb_default_input_kscore.xml, but if you've followed these instructions, you will have copied it to /usr/local/data/parameters already.

Replace "C:\InetPub\wwwroot\ISB\data\parameters\isb_default_input_kscore.xml" with "/usr/local/tpp/data/parameters/isb_default_input_kscore.xml" in the tandem.xml file.