Skip to content

Instantly share code, notes, and snippets.

@brantfaircloth
Last active August 4, 2017 18:30
Show Gist options
  • Save brantfaircloth/9619a51c635d30c7bfd8 to your computer and use it in GitHub Desktop.
Save brantfaircloth/9619a51c635d30c7bfd8 to your computer and use it in GitHub Desktop.
Install and configure stacks 1.21 on Ubuntu 14.04 LTS

Stacks on Ubuntu 14.04 LTS

  • install dependencies:

      apt-get install build-essential zlib1g-dev vim
      apt-get install libsparsehash-dev mysql-server php5 apache2 php-mdb2 php-mdb2-driver-mysql libdbd-mysql-perl samtools libbam-dev
    
  • for ease of compilation, symlink sparsehash to /usr/local/include:

      sudo ln -s /usr/include/google /usr/local/include/sparsehash
    
  • get stacks:

      wget http://creskolab.uoregon.edu/stacks/source/stacks-1.21.tar.gz
    
  • untar stacks:

      tar -xzvf stacks-1.21.tar.gz && cd stacks-1.21
    
  • configure stacks:

      ./configure \
              --enable-sparsehash \
              --enable-bam \
              --with-sparsehash-include-path=/usr/local/include \
              --with-bam-include-path=/usr/include/samtools \
              --with-bam-lib-path=/usr/lib
    
  • compile stacks:

      make
    
  • install stacks:

      sudo make install
    
  • add a mysql superuser for stacks_user (replace 'some_pass' with your password) by logging in (use password you created during apt-get above):

      mysql -u root -p
    
  • create a stacks user and give local privileges on all databases (replace 'some_pass' with your password):

      mysql> CREATE USER 'stacks_user'@'localhost' IDENTIFIED BY 'some_pass';
      mysql> GRANT ALL PRIVILEGES ON *.* TO 'stacks_user'@'localhost' WITH GRANT OPTION;
    
  • logout:

      mysql> \q
    
  • fill in the mysql configuration parameters:

      cd /usr/local/share/stacks/sql/
      sudo cp mysql.cnf.dist mysql.cnf
      sudo vim mysql.cnf
    
  • make the mysql.cnf file look like the following (replace 'some_pass' with your password):

      [client]
      user=stacks_user
      password=some_pass
      host=localhost
      port=3306
    
  • fill in the php configuration parameters:

      cd /usr/local/share/stacks/php
      sudo cp constants.php.dist constants.php
      sudo vim constants.php
    
  • make the constants.php file look like the following (replace 'some_pass' with your password):

      //
      // Credentials to access Stacks MySQL databases
      //
      $db_user     = "stacks_user";
      $db_pass     = "some_pass";
      $db_host     = "localhost";
    
  • change the permissions on the stacks export folder:

      cd /usr/local/share/stacks/php/
      sudo chown www-data /usr/local/share/stacks/php/export
    
  • add a fully-qualified domain name config file for apache2:

      sudo vim /etc/apache2/conf-avaialable/fqdn.conf
    
  • edit the file to contain the following:

      ServerName localhost
    
  • enable this fqdn file:

      sudo a2enconf fqdn
    
  • add a virtual host entry for stacks:

      sudo vim /etc/apache2/sites-available/stacks.conf
    
  • paste the following into that new file:

      <VirtualHost *:80>
              DocumentRoot /var/www/html
    
              # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
              # error, crit, alert, emerg.
              # It is also possible to configure the loglevel for particular
              # modules, e.g.
              #LogLevel info ssl:warn
    
              ErrorLog ${APACHE_LOG_DIR}/error.log
              CustomLog ${APACHE_LOG_DIR}/access.log combined
    
              <Directory "/usr/local/share/stacks/php">
              Require all granted
              </Directory>
    
              Alias /stacks "/usr/local/share/stacks/php"
      </VirtualHost>
    
  • disable the default virtual host file:

      sudo a2dissite 000-default
    
  • enable the new virtual host file:

      sudo a2ensite stacks
    
  • reload the apache configuration to pick up the new changes:

      service apache2 reload
    
  • visit:

      http://localhost/stacks
    
@khaled8523
Copy link

Hello
Not Found
The requested URL /stacks was not found on this server.
what should i do please hellp me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment