Difference between revisions of "GBrowse 2.0 Install HOWTO"

From GMOD
Jump to: navigation, search
(Final Installation: Making standard)
(Advanced Installation Topics: Just put it back the way it was if you don't like my idea of having shorter, more focused pages.)
Line 169: Line 169:
  
 
=Advanced Installation Topics=
 
=Advanced Installation Topics=
This section describes advanced installation topics such as accelerating GBrowse performance by running it under a persistent environment, configuring the user login and custom track upload system, and restricting access to certain databases and tracks via user authentication.
+
For advanced topics, such as accelerating GBrowse performance by running it under a persistent environment, configuring the user login and custom track upload system, and restricting access to certain databases and tracks via user authentication, see:
 
+
* [[GBrowse 2.0 Install HOWTO/Advanced]]
==Running GBrowse under FastCGI==
+
 
+
[[http://www.fastcgi.com/drupal/ FastCGI]] is a web protocol for generating dynamic that replaces the usual CGI mechanism. The first time a script is requested, FastCGI launches that script as a long-running process. Subsequent requests are forwarded to that process. Because startup time is eliminated, the responsiveness of a FastCGI script is greatly improved.
+
 
+
GBrowse is FastCGI ready. To take advantage of this facility, you will need a version of Apache equipped with FastCGI support, and a short Apache configuration stanza for GBrowse. If your Apache was compiled from source, you will need to download and install either the older [http://www.fastcgi.com/dist/ mod_fastcgi module], or the newer [http://httpd.apache.org/mod_fcgid/ mod_fcgid] module, and install as directed. If you have a binary distribution, please install the appropriate package: ''libapache2-mod-fastcgi'' or ''ibapache2-mod-fcgid'' for APT/Debian systems, or "mod_fcgid" for RPM systems. You will also need the Perl FCGI module (''libfcgi-perl'' for APT/Debian, ''fcgi-perl'' for RPM). The mod_fcgid module is more customizable than the older one and has better performance, but has a significant gotcha that you should be aware of if you use custom Perl library paths. See [[Recompiling mod_fcgid to avoid truncated Perl library paths]].
+
 
+
The next step is to create a suitable Apache configuration stanza for GBrowse, if needed. When you configured and install GBrowse, it probably created a default configuration for you, and stored it into your Apache web server's configuration directory (depending on your system, /etc/apache/conf.d/gbrowse2.conf, /etc/apache2/conf.d/gbrowse2.conf, /etc/httpd/conf.d/gbrowse2.conf, or similar). If this file is already installed, then you are all done. Fetch URL ''http://localhost/fgb2/gbrowse'' and compare the performance to GBrowse running as a CGI script.
+
 
+
If you declined to have the configuration script create this file and configured GBrowse manually, then you can generate a suitable config file by running '''./Build apache_conf''' from within the GBrowse distribution directory. The FastCGI portion of the configuration file that is generated will look something like this:
+
 
+
<IfModule mod_fastcgi.c>
+
  Alias /fgb2 "/usr/lib/cgi-bin/gb2"
+
  <Location /fgb2>
+
    SetHandler  fastcgi-script
+
  </Location>
+
  FastCgiConfig -initial-env GBROWSE_CONF=/etc/gbrowse2
+
</IfModule>
+
 
+
Copy this stanza into your main Apache configuration file, or, better, into the site configuration file directory, /etc/apache/conf.d (or similar). Restart Apache to pick up the configuration file changes and fetch the URL ''http://localhost/fgb2/gbrowse''. You should notice a marked improvement in load and update speed. The improvement will be particularly noticeable if you combine FastCGI with a rendering slave, as described in [[Running_a_GBrowse2_render_farm | Running a GBrowse2 Render Farm]].
+
 
+
If things don't seem to work as advertised, please check the Apache server error log file, usually /var/log/apache/error_log, for clues about where things are going wrong.
+
 
+
==Running GBrowse under modperl==
+
 
+
[http://perl.apache.org/ ModPerl] is an Apache extension that embeds a Perl interpreter in the Apache process. Because Perl is always loaded and running, the startup time of CGI scripts is greatly reduced.
+
 
+
GBrowse is modperl ready. To take advantage of this facility, you will need a version of Apache equipped with modperl support, and a short Apache configuration stanza for GBrowse. If your Apache was compiled from source, you will need to download and install the [[http://perl.apache.org/download/index.html mod_perl module]] following its installation directions. If you have a binary distribution, please install the appropriate package: ''libapache2-mod-perl2'' for APT/Debian systems, or "mod_perl" for RPM systems. No additional distributions are needed, although you may wish to install the mod_perl documentation and development packages as these are distributed separately.
+
 
+
To configure GBrowse to use modperl, you need a short Apache configuration file stanza. By default, an appropriate configuration file was already installed for you when you installed GBrowse, located at /etc/apache/conf.d/gbrowse2.conf, /etc/apache2/conf.d/gbrowse2.conf, or /etc/httpd/conf.d/gbrowse2.conf depending on your system. If it is already installed, and Apache is modperl enabled, then you are all done. Fetch ''http://localhost/mgb2/gbrowse'' and compare GBrowse's performance to the CGI version.
+
 
+
Otherwise, you can generate an appropriate stanza by running ''./Build apache_conf'' from the GBrowse distribution directory. The stanza will look something like this:
+
 
+
<IfModule mod_perl.c>
+
    Alias /mgb2 "/usr/lib/cgi-bin/gb2"
+
  <Location /mgb2>
+
      SetHandler perl-script
+
      PerlResponseHandler ModPerl::Registry
+
      PerlOptions +ParseHeaders
+
  </Location>
+
</IfModule>
+
 
+
Copy and paste this into the main Apache configuration file, or (better) into the site configuration file directory, /etc/apache/conf.d (or similar). Restart Apache to pick up the configuration file changes. Now fetch URL ''http://localhost/mgb2/gbrowse''. You should notice a marked improvement in load and update speed. The improvement will be particularly noticeable if you combine modperl with a rendering slave, as described in [[Running_a_GBrowse2_render_farm | Running a GBrowse2 Render Farm]].
+
 
+
As always, if things don't seem to work as intended, useful information can be found in the Apache server error log file, usually /var/log/apache/error_log.
+
 
+
==Configuring the User Account Database==
+
 
+
GBrowse offers an optional feature that allows users to register themselves and establish password-protected accounts. When a user logs into her account from any machine, her custom tracks and visual settings (such as panel width) are restored. Otherwise, these settings are lost as soon as the user moves to a different machine or web browser software. In future versions of GBrowse, enabling this feature will allow users to search for public shared tracks and selectively share custom tracks with each other. The user accounts feature also allows users to login using an [http://openid.net/ OpenID], such as one obtained from Yahoo or Flickr, or to associate one or several OpenIDs with their account.
+
 
+
Once user accounts are installed, you may use a special administrator's account to upload and manage public tracks remotely. This eliminates the need to log into the server each time you need to create or modify a track. This facility is described in [[#The_Admin_Interface The Admin interface]].
+
 
+
There are three steps to getting the user account database going: (1) installing the required Perl modules; (2) creating and configuring the user account database; and (3) configuring GBrowse to send outgoing email.
+
 
+
*Installing the necessary Perl modules
+
 
+
The login module needs to process OpenID transactions. It also needs to send outgoing email, which nowadays frequently requires authentication between the GBrowse web server host and the mail hub. The following additional libraries and modules are required for basic functionality:
+
 
+
;'''Digest::SHA'''
+
:For creating and storing passwords. Available from [http://www.cpan.org CPAN] or as Debian package or as Debian package libdigest-sha-perl.
+
 
+
;'''Crypt::SSLeay'''
+
:For OpenID authentication. Available from [http://www.cpan.org CPAN] or as Debian package libcrypt-ssleay-perl. This module in turn requires the [http://www.openssl.org/ OpenSSL package], Debian package ''libssl-dev''.
+
 
+
;'''Math::BigInt::Pari''' or '''Math::BigInt::GMP'''
+
:These libraries speed up Net::OpenID::Consumer, and in particular reduce the time needed to run the Net::OpenID::Consumer tests. To use the Pari module you will first need to install libpari (http://pari.math.u-bordeaux.fr/).To use GMP install libGMP (http://gmplib.org/). Debian users can simply install ''libmath-bigint-gmp-perl''.
+
 
+
;'''Net::OpenID::Consumer'''
+
:For OpenID authentication. Available from [http://www.cpan.org CPAN] or as Debian package ''libnet-openid-consumer-perl''.
+
 
+
If your preferred mail server requires user authentication to forward outgoing mail, then you will also need the following two modules:
+
 
+
;'''Net::SMTP::SSL'''
+
:Encrypted connections to mail servers. Available from [http://www.cpan.org CPAN] or as Debian package ''libnet-smtp-ssl-perl''.
+
 
+
;'''Authen::SASL'''
+
:Handle the authentication between mail client and server. Available from [http://www.cpan.org CPAN] or as Debian package ''libauthen-sasl-per''l.
+
 
+
===Creating and configuring the user account database===
+
 
+
First, choose the desired Perl DBI backend for the user account database. Currently two DBI backends are supported: mysql and SQLite. Mysql is appropriate for an environment in which multiple load-balancing GBrowse servers are running because the database can be hosted on a common network-connected server. SQLite is simpler to set up, and possibly faster.
+
 
+
To create and initialize a mysql login database run the script '''gbrowse_create_useraccount_db.pl''' which should have been installed when you installed GBrowse:
+
 
+
  gbrowse_create_useraccount_db.pl \
+
      -dsn DBI:mysql:gbrowse_login;user=gbrowse;password=gbrowse \
+
      -admin root \
+
      -p
+
 
+
'''-dsn''' specifies the full Perl-style path to a Mysql database named "gbrowse_login". GBrowse will access the newly-created database using a username of "gbrowse" and a password of "gbrowse".
+
 
+
'''-admin''' specifies the Mysql administrator's name (this user must have the ability to add and drop databases). You may combine the admin's name and password into a single argumenton the command line by following the format "-admin username:password".
+
 
+
'''-p''' tells the script to prompt for the administrator's password on standard input. This avoids having to put the password on the command line.
+
 
+
To create a SQLite database you can use the same script with options like these:
+
 
+
gbrowse_create_useraccount_db.pl \
+
      -dsn DBI:SQLite:/var/tmp/gbrowse2/users.sqlite \
+
      -owner www-data:www-data
+
 
+
This creates a user database at /var/tmp/gbrowse2/users.sqlite. This database has to be readable and writable by the web user and/or group, and so we must set this ownership using the '''-owner''' option. If you get a permissions error when you try to create the database, you may need to run the script as the superuser using "sudo" or "su".
+
 
+
Once the database has been created, you need to tell GBrowse about it, by setting the following options in the GBrowse.conf [GENERAL] section:
+
 
+
user accounts  = 1
+
user_account_db = DBI:SQLite:/var/tmp/gbrowse2/users.sqlite
+
 
+
'''user accounts = 1''' activates the login system. Change '''user_account_db''' to the DBI path specified when you created the database.
+
 
+
===Configuring outgoing email===
+
 
+
When a user registers an account in GBrowse, the system sends a confirmation message to the email address she provided during registration. When she receives the message, she is prompted to click a link to confirm her account.
+
 
+
To successfully send out this email message, the web server host on which GBrowse runs needs to send a message through an email gateway. You will need to identify the appropriate gateway to use and update GBrowse.conf with its address.
+
 
+
Only SMTP gateways are supported at this time, but almost all organizations and home computers will have access to one. Please see your local IT group, or check your internet service provider's documentation, to find out the hostname, port, and authentication required by your local gateway. As a last resort, you can always create a Google or Yahoo email account dedicated to the use of your GBrowse instance.
+
 
+
Once you have the gateway information, update the '''smtp_gateway''' option in GBrowse.conf. The full format is ''smtp_server:port:encryption:user:password'', but many of the fields are optional. Here is a config that is appropriate for a simple SMTP server that does not require authentication:
+
 
+
smtp_gateway = smtp.res.oicr.on.ca
+
 
+
Here is a config that is appropriate for a server listening on an unusual port (port 75 rather than the usual 25):
+
 
+
smtp_gateway = smtp.res.oicr.on.ca:75
+
 
+
Here is a config for a server that requires SSL encryption and listens on the standard ssl-mail port 465:
+
 
+
smtp_gateway = smtp.res.oicr.on.ca:465:ssl
+
 
+
And here is a config for GMail's gateway, which requires SSL encryption as well as the name and password of a user with a GMail account:
+
 
+
smtp_gateway = smtp.gmail.com:465:ssl:joe.user:joespasswd
+
 
+
The "encryption" field is one of "plain" or "ssl", defaulting to "plain" (no encryption). The port field defaults to 25 for plain encryption, and 465 for ssl encryption.
+
 
+
If the email step of the registration process does not work, check the server error log to see if there are any messages about the mail being rejected due to bad authentication or inadequate authorization, which could indicate that your SMTP gateway needs SSL or user authentication to accept mail. During debugging, it may be helpful to connect to the user database and periodically empty the "users" table of aborted user registrations by issuing the SQL command "delete from users".
+
 
+
There are several customization options in the user accounts section that you may wish to change. These are:
+
 
+
;'''application_name'''
+
:When the registration confirmation email arrives, it will appear to have been sent from a user named "GBrowse". You can change this value via this option.
+
;'''application_name_long'''
+
:The registration confirmation also includes a longer description of the e-mail sender. You may wish to change this as well.
+
;'''email_address'''
+
:This value will change the reply-to address on the confirmation email.
+
 
+
Here is a fully worked example:
+
 
+
application_name = Arabidopsis Genome Browser
+
application_name_long = The Arabidopsis Information Resource
+
email_address = help@arabidopsis.org
+
 
+
The email will now appear to come from a user named "Arabidopsis Genome Browser" and the letter will be signed by "The Arabidopsis Information Resource."
+
 
+
Note that some authenticated SMTP gateways do not allow you to arbitrarily change the apparent sender in order to reduce spam. In this case, the email address will always appear to come from the user whose authentication information was provided in the smtp_gateway information.
+
 
+
===The Admin Interface===
+
 
+
GBrowse recognizes a special privileged user who can upload and configure tracks that will be public. These tracks become part of the standard list of tracks that everyone sees. By default this user is known as "admin", but you can change the name by editing the value of the "admin_account" option in GBrowse.conf.
+
 
+
Because it is privileged, you cannot use the login registration system to create the account. Instead, run the script "gbrowse_set_admin_passwd.pl" which was installed when you installed GBrowse. It does not need any arguments. Simply run it from the command line, and it will prompt you for a password to use for the admin account:
+
 
+
<pre>
+
bin/gbrowse_set_admin_passwd.pl
+
Not running as www-data. Trying to use sudo to remedy. You may be asked for your login password.
+
New password for admin: ******
+
Confirm password for admin: ******
+
admin userid set to 38bc6f6c526f390c1422d1fd1476b2f7
+
Admin account "admin" is now registered.
+
</pre>
+
 
+
The only potentially confusing aspect of this script is that it needs to run with the same permissions as the web server. If it detects that it is not being run as this user, it invokes "sudo" to change the userid. This means that you may be prompted for your '''own''' passwd before being asked for the new admin password. You will know this is happening because the initial password prompt will begin with "[sudo]".
+
 
+
Once the admin user is set up, you can log into GBrowse as "admin" using the password you supplied. When you do so, uploading files to the "Upload and Share Tracks" section will create public tracks that all can see. It is suggested that you first upload a file, and then use the inline editing interface to customize the track configuration file as shown in the illustration below.
+
 
+
[[image:editing_track_config2.png|right|thumb|250px|editing_track_config2.png] [[Media:editing_track_config2.png|View at full resolution]]]]
+
 
+
The format of the track configuration files is identical to that described above. The only difference is that the ''database'' option is ignored, because upload database are managed internally by GBrowse. In addition, the ''remote renderer'' option will not have the desired effect unless you are using a shared mysql database backend for custom track uploads as described in the previous sections.
+
 
+
You may also, if you wish, log into the server machine and edit uploaded files directly. They are stored in a directory named "admin_uploads" under the $DATABASES directory (usually /var/www/gbrowse2/databases/admin_uploads). Each uploaded file lives in a directory named after it containing a config file, other support files, and often a SQLite database named index.SQLite.
+
 
+
====WebGBrowse====
+
 
+
WebGBrowse is a web-based administrative interface for GBrowse2 written by Ram Podicheti and colleagues at the University of Indiana. With it, you can create new GBrowse datasources, configure them, and manage tracks all from a convenient web-based user interface. You can try it out and download the source code for your own use from http://webgbrowse.cgb.indiana.edu/.
+
 
+
==Configuring the Uploaded Track Database==
+
 
+
When a user uploads or imports a custom track, GBrowse creates a directory containing information about this upload. This directory is stored in the GBrowse temporary path (typically /var/tmp/gbrowse2/userdata) under a directory named after the user's session ID, which is a long hexadecimal number. For fast indexed access to the information in the track, GBrowse also creates a secondary database using the BioPerl Bio::DB::SeqFeature::Store genome feature storage system.
+
 
+
A variety of backends are supported, and GBrowse will automatically pick one that your system supports based on Perl's installed DBI drivers. GBrowse prefers the SQLite backend because it requires no additional configuration and has excellent performance. You may wish to install DBD::SQLite if it is not already there.
+
 
+
To force a particular backend, set the '''userdb_adaptor''' option in GBrowse.conf's [GENERAL] section. Valid options are "memory", "berkeleydb", "DBI::SQLite" and "DBI::mysql". Use the "memory" adaptor only as a last resort, as it has poor performance relative to the others.
+
 
+
===Using the DBI::mysql backend===
+
 
+
The DBI::mysql backend has excellent performance, but it requires additional configuration to give the GBrowse server the rights to create and destroy databases on the Mysql server.
+
 
+
First, choose a username and password for the GBrowse account. We will use "gbrowse" and "secret" in this example.
+
 
+
Second, use the mysql client application to log into the Mysql server using the db administrator's name and password.
+
 
+
Now, grant the GBrowse user the ability to create and drop databases that begin with the string "userdata_":
+
 
+
  mysql> grant create on `userdata\_%`.* to 'gbrowse'@'localhost' identified by "secret";
+
 
+
If you are using a Mysql server running on a different host from the web server, replace "localhost" with the name of the web server host, or use the wildcard character "%" to allow GBrowse to connect from any host.
+
 
+
Last, update GBrowse.conf with the appropriate values for '''userdb_adaptor''', '''userdb_host''', '''userdb_user''' and '''userdb_pass'''.
+
 
+
==Authentication and Authorization==
+
 
+
You can restrict who has access to gbrowse by IP address, host name, domain or username and password. Restriction can apply to the datasource as a whole, or to particular annotation tracks.
+
 
+
To limit access to a whole datasource, you can use Apache's standard authentication and authorization. GBrowse uses a URL of this form to select which datasource it is set to:
+
 
+
      http://your.host/cgi-bin/gb2/gbrowse/your_datasource
+
 
+
where "your_datasource" is the name of the currently selected database. For example, the yeast source is http://your.host/cgi-bin/gb2/gbrowse/yeast.
+
 
+
To control access to the entire database, create a <Location> section in httpd.conf. The <Location> section should look like this:
+
 
+
  <Location /cgi-bin/gb2/gbrowse/your_database>
+
        Order deny,allow
+
        deny from all
+
        allow from localhost .cshl.edu .ebi.ac.uk
+
  </Location>
+
 
+
This denies access to everybody except for "localhost" and browsers from the domains .cshl.edu and .ebi.ac.uk. You can also limit by IP address, by username and password or by combinations of these techniques. See http://httpd.apache.org/docs/howto/auth.html for the full details.
+
 
+
You can also limit individual tracks to certain individuals or organizations. Unless the stated requirements are met, the track will not appear on the main screen or any of the configuration screens. To set this up, add a "restrict" option to the track you wish to make off-limits:
+
 
+
        [PROPRIETARY]
+
        feature = etc
+
        glyph  = etc
+
        restrict = Order deny,allow
+
                  deny from all
+
                  allow from localhost .cshl.edu .ebi.ac.uk
+
 
+
The value of the restrict option is identical to the Apache authorization directives and can include any of the directives "Order," "Satisfy," "deny from," "allow from," "require valid-user" or "require user." The only difference is that the "require group" directive is not supported, since the location of Apache's group file is not passed to CGI scripts. Note that username/password authentication must be turned on in httpd.conf and the user must have successfully authenticated himself in order for the username to be available.
+
 
+
As with other gbrowse options, restrict can be a code subroutine. The subroutine will be called with three arguments consisting of the host, ip address and authenticated user. It should return a true value to allow access to the track, or a false value to forbid it. This can be used to implement group-based authorization or more complex schemes.
+
 
+
Here is an example that uses the Text::GenderFromName to allow access if the user's name sounds female and forbids access if the name sounds male. (It might be useful for an X-chromosome annotation site.)
+
 
+
    restrict = sub {
+
              my ($host,$ip,$user) = @_;
+
              return unless defined $user;
+
              use Text::GenderFromName qw(gender);
+
              return gender($user) eq 'f';
+
            }
+
 
+
You should be aware that the username will only be defined if username authentication is turned on and the user has successfully authenticated himself against Apache's user database using the correct password. In addition, the hostname will only be defined if HostnameLookups have been turned on in httpd.conf. In the latter case, you can convert the IP address into a hostname using this piece of code:
+
 
+
    use Socket;
+
    $host = gethostbyaddr(inet_aton($addr),AF_INET);
+
 
+
Note that this may slow down the response time of gbrowse noticeably if you have a slow DNS name server.
+
 
+
Another thing to be aware of when restricting access to an entire datasource is that that even though the datasource itself will not be accessible to unauthorized users, the name of the datasource will still be available from the popup "Data Source" menu. If you wish the name to be suppressed from view, add the option '''hide=1''' to the datasource configuration stanza of the GBrowse.conf file:
+
 
+
  [example_datasource]
+
  description  = Draft annotation of v. volvulus
+
  path          = v_volvulus_draft.conf
+
  hide          = 1
+
 
+
The '''restrict''' option can also be used in a [datasource] section of GBrowse.conf to conditionally enable display of the source to certain IP addresses or users. For example, to display the V. volvulus source only to users in the .ebi.ac.uk domain or to an authenticated user named "Admin":
+
 
+
  [example_datasource]
+
  description  = Draft annotation of v. volvulus
+
  path        = v_volvulus_draft.conf
+
  restrict = Satisfy any
+
            Order deny,allow
+
            deny from all
+
            allow from .ebi.ac.uk
+
            require user Admin
+
 
+
To completely disable generation of the data sources popup menu, set '''show sources=0''' in the [GENERAL] section of GBrowse.conf.
+
  
 
[[Category:GBrowse]]
 
[[Category:GBrowse]]
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]

Revision as of 12:52, 29 September 2010

This article describes how to install GBrowse 2.0.

GBrowse Installation

This section describes how to install GBrowse 2.0 on either Linux or Mac OSX systems. Windows users please see Installing GBrowse 2.0 on Windows (document pending). Before you begin, please make sure that your system has all the GBrowse 2.0 Prerequisites installed. You can install GBrowse 2.0 either directly via the CPAN shell (recommended), which will check all prerequisites for you, or manually via the SVN (for advanced users).

Installing via the CPAN Shell

You can install the latest released version of GBrowse by running the CPAN shell. Run this command:

sudo perl -MCPAN -e 'install Bio::Graphics::Browser2'

This will run all the steps described in the "Installing Manually" section below, including configuring GBrowse's installation directories and installing GBrowse and its demo databases. Among other things, GBrowse will ask you a series of questions about where to install it. See #Selecting Installation Directories for a detailed description of each question. The suggested defaults are almost always correct.

If any perl modules are missing from the prerequisites, the CPAN shell will install them for you.

Installing Manually

Alternatively, you can download and install the bleeding edge version via SVN. The command to issue is:

svn co https://gmod.svn.sourceforge.net/svnroot/gmod/Generic-Genome-Browser/trunk Generic-Genome-Browser

This will create a directory named Generic-Genome-Browser:

Running the Build.PL Script

Next, enter the newly-created directory and run the Build.PL script:

 % cd Generic-Genome-Browser
 % perl Build.PL
 Checking whether your kit is complete...
 Looks good

 Checking prerequisites...
 Looks good

 cc -I/usr/lib/perl/5.8/CORE -fPIC -c -D_REENTRANT -D_GNU_SOURCE \
   -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe \
   -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
    -O2 -o /tmp/compilet.o /tmp/compilet.c
 cc -shared -L/usr/local/lib -o /tmp/compilet.so /tmp/compilet.o

 Creating new 'Build' script for 'GBrowse' version '2.00'
 Now run:
  ./Build test
  ./Build config
  ./Build demo          (optional)
  ./Build install       (as superuser/administrator)
        -or-
  ./Build install_slave (optional, for slave installations)

Among other things, this script will report all the missing Perl libraries that you need to run GBrowse. Please be sure to install all prerequisites before going any further.

This will create a script named Build in the current directory.

Running the Build Script

You will now use Build to test, configure and install GBrowse. First you will confirm that GBrowse's libraries are completely functional by running ./Build test (the "./" is there to ensure that you are running the Build script in the current directory, and not some other Build script somewhere in your path:

 % ./Build test
 t/01yeast...................ok
 t/02.rearchitecture.........ok
 t/03.render.................ok
 ...
 All tests successful.
 Files=8, Tests=323, 12 wallclock secs
 Result: PASS

All tests should pass (you may safely ignore warnings and occasional timeout errors). If not, please file a bug report, and/or send an inquiry to the GBrowse mailing list.

Selecting Installation Directories

After passings its tests, you should configure GBrowse by running ./Build config:

 % ./Build config

 **Beginning interactive configuration**
 Apache loadable module directory (for demo)? [/usr/lib/apache2/modules]
 Apache CGI scripts directory? [/usr/lib/cgi-bin]
 Directory for GBrowse's config and support files? [/etc/GBrowse2]
 Directory for GBrowse's static images & HTML files? [/var/www/gbrowse2]
 Internet port to run demo web site on (for demo)? [8000]
 User account under which Apache daemon runs? [www-data]

 **Interactive configuration done. Run './Build reconfig' to reconfigure**

The configuration process will ask you to confirm six site-specific configuration options, and will do its best to guess for you. In most cases you can just hit return to accept the default. If you specify a directory that does not exist, the system will ask you to confirm that this is what you mean. If you press yes, the directory (and all its needed parents) will be created at install time.

The configuration options are:

apachemodules
The directory in which Apache's loadable modules are located. This is only needed to run a demo GBrowse site before formal installation. If you do not know the location of this directory and you do not want to run the demo, you can safely ignore this option.
cgibin
The directory in which Apache's executable CGI scripts are located, for example /usr/lib/cgi-bin. This directory is set up for you when Apache is installed, and you must have the path correct in order for Build to install GBrowse's CGI scripts in the right place. GBrowse will be installed into the "gb2" subdirectory, so its path will be "/usr/lib/cgi-bin/gb2/gbrowse".
conf
The location of GBrowse's configuration files. The default is to place them in /etc/gbrowse2. This is where you will go to customize GBrowse and add new data sources.
databases
The default location for GBrowse's in memory databases, and the place where the example databases will be stored. The default is to place this into a subdirectory of the same directory in which GBrowse places its static files, such as /var/www/gbrowse2/databases.
htdocs
The directory in which to install GBrowse's Javascript libraries, static HTML pages and stylesheets. You can choose any location for this directory and it will be added to Apache's document tree. The default is to place the directory under the default document tree, such as /var/www/gbrowse2.
portdemo
The internet port on which the demo will run. The demo launches a new instance of Apache running under your user privileges. Because port 80 will usually already be taken by the system Apache, Build will choose an unused port like 8000 or 8080. You may manually select the port if you wish.
tmp
The directory in which GBrowse will store its working data, including users' session information (such as preferred tracks), uploaded data files, and temporary image files. The default is to place these files into /var/tmp/gbrowse2.
wwwuser
The account under which the system Apache runs, often "nobody", "www-data" or "httpd." If you do not know, you can find out by running ps aux | grep -i apache on a system that has Apache already running. The first column of the output contains the name of the user account.

Once you have configured GBrowse, the values you chose will stick until you run ./Build reconfig. You can also bypass interactive configuration by directly passing Build.PL one or more of the configuration options on the command line:

perl Build.PL --apachemodules=/usr/local/share/apache/libexec \
              --cgibin=/var/lib/cgi \
              --conf=/etc/gbrowse \
              --htdocs=/usr/local/docs/gbrowse \
              --databases=/usr/local/gbrowse/databases \
              --tmp=/tmp/gbrowse \
              --portdemo=9000 \
              --wwwuser=fred

The options passed on the command line will become the defaults for ./Build config will be used during installation, and will also become the defaults if you later run ./Build config or ./Build reconfig.


Here is an example of a 'non-standard' install, that allows you to install and run GB as a non-root user (assuming you have Perl's local-lib working properly):

perl Build.PL \
  --cgibin=$HOME/httpd/cgi-bin/gbrowse2 \
  --conf=$HOME/httpd/conf/gbrowse2 \
  --htdocs=$HOME/httpd/htdocs/potato/gbrowse2 \
  --tmp=$HOME/httpd/tmp

./Build test
./Build install


Note that we still need to tweak $HOME/httpd/conf/gbrowse2/GBrowse.conf to set the 'url_base' from '/gbrowse2' to '/potato/gbrowse2' in this case.

Running the GBrowse Demo (optional)

Before you install GBrowse, you may wish to run its demo. This will attempt to launch a correctly configured instance of Apache running under your own account. To launch the demo, run ./Build demo:

% ./Build demo
Demo is now running on http://localhost:8000
Run "./Build demostop" to stop it.

You can now point your web browser at http://localhost:8000 (or whatever the build message specifies), and interact with the GBrowse web site, browse sample genomes and otherwise test the waters. When you are done, run ./Build demostop to stop Apache and clean up.

Registering GBrowse (optional)

You may register GBrowse by running ./Build register. This is an optional step, but allows the GBrowse development group to track who is using GBrowse. This information is useful when writing grant renewals :-). The information is only used internally by the GMOD project and is not shared with any other parties.

Final Installation

To install GBrowse and its support files permanently, run ./Build install as the superuser. This will copy GBrowse's library and support files into the locations chosen during configuration. It will then configure Apache to run GBrowse by writing the appropriate configuration directives into Apache's configuration file. Finally, it will attempt to restart Apache. If all goes well, you will see a note telling you to load http://localhost/gbrowse2. This will take you to an autogenerated page that describes the install configurations you chose, points to an example database to run, and gives pointers to documentation, tutorials and other useful information.

Debugging and Customizing the Installation

If you are having trouble with the installation, see Common Problems with GBrowse2 Installation. If you wish install GBrowse in your home directory because you do not have superuser privileges or for any other reasons, see Installing GBrowse2 in your Home Directory. (These pages aren't written yet)!


Advanced Installation Topics

For advanced topics, such as accelerating GBrowse performance by running it under a persistent environment, configuring the user login and custom track upload system, and restricting access to certain databases and tracks via user authentication, see: