Project

General

Profile

Actions

Appion Home » History » Revision 18

« Previous | Revision 18/101 (diff) | Next »
Amber Herold, 03/31/2010 04:03 PM


Complete Installation

Four Parts of Leginon System

Leginon as a system that we distribute can be divided into three parts:

Processing Server (Python-side)

Python (and some c) scripts that handle instrument control, data acquisition, and
processing.

Database Server (MySQL-side)

a MySQL server that handles the database

Web Server (PHP-side)

This includes php and Java scripts at a webserver that we will create to retrieve image
and metadata from the database and file-storage system.

File Server

This is up to you to set up to store lots of data coming out of Leginon system.

What is in this chapter

Leginon runs under both the Linux and Microsoft Windows Operating systems. However, the
current php-mrctool can not be installed on Windows which means mrc images can not be viewed
on the web. See the section on Possible Computer Set-up Configurations for details.

The many components for the Leginon system are divided into packages and need to be
installed separately. It has been integrated with several third party software packages that
are necessary for its operation. The installation documentation will describe how to set-up
Leginon and give hints as to how to install and set-up the necessary third-party software.
This documentation is not intended to support the additional, but necessary third-party
software.

There has been interest in installing Leginon under Mac OS X. While this is possible in
theory, we have not been successful in installing a fully functional system. The two main
problems are (1) compilation of php-mrctool from the pre-installed php and (2) wxPython on Mac
is unable to hide bitmap objects which makes Leginon graphical user interface difficult to
use.

See <link linkend="InstT_install">Installation Troubleshooting</link> and Leginon Bulletin Board searching
for "install" if you run into problems.

Possible Computer Set-up Configurations

Computer(s) used for the whole Leginon system need to support five functions:
  • TEM/Camera control and data output (by python-side packages of Leginon
    system)

*The computer attached to the microscope/camera is used for this function.
Therefore, it is on a Windows computer.

  • General Leginon operation such as target selection and image processing (processing
    server of Leginon system)
  • Image data storage.
  • Other meta-data storage through MySQL database (by database server of Leginon
    system)
  • Web server (using PHP-side of Leginon system).

Important The MRC module that is used to load mrc formatted files to the web
pages is not compiled on Windows. Therefore, this function must be on a linux box unless
you don't need to see the images***

The five functions can be distributed to five different computers on a network or all on
one single computer. However, since the latter minimal setup requires the use of the computer
attached to the microscope for all functions, it is not advisable.

Processing server of Leginion is a multi-platform software, meaning it can run on both
Microsoft Windows and Linux. It is also inherently designed to utilize distributed systems on
a network. MySQL used in the database server is also supported by multiple platforms. This is
not true for the Web server because the custom MRC module used in the web viewer only compiles
on linux machines. Therefore, one of the computer not part of the microscope must be a linux.
The following examples show several arrangements that take advantage of distributed system.
Other combinations are possible, but will basically be variations on one of the following
themes.

A: 1 Windows computer (attached to the Microscope) & 1 Linux computer (for all
other functions, separate from the Microscope) (Good for single user and small-scale
acquisition)

  • Install the latest processing server side of Leginon release (and supporting
    packages) on the Windows computer controlling the microscope and on the Linux computer
    which is to run Leginon image acquisition and processing.
  • Install the additional modules needed for CCD camera and film interaction on the
    Windows computer controlling the microscope.
  • Install MySQL, PHP, the Apache Web Server, and dbem tools only on the Linux
    computer that will perform these functions, (i.e. NOT the computer controlling the
    microscope).

B: 1 Windows computer (attached to the Microscope) & 4 Linux computers (one for
each function) (Good for multiple microsopes, users and large-scale acquisition)

This is the set-up at NRAMM. It has the processing server side of Leginon installed on
the Windows computer attached to the microscope and on the Linux computer that is used for
running Leginon. A second Linux machine is dedicated to the database while the web-based
viewer is hosted by another server.

  • Install the python-side Leginon (and supporting packages) on the Windows computer
    controlling the microscope and on the Linux computer that is to run Leginon. You can
    make the latter installation accessable to any numbers of linux computers on your
    network.
  • Install MySQL, PHP, the Apache Web Server, and dbem tools on the second Linux
    computer that will serve as the database/web server/PHP host.
  • The computer hosting the data storage should be accessable by all linux
    boxes.

C: 1 Windows computer (attached to the Microscope), 1 Windows computer running python-
and MySQL-side functions and 1 Linux computer as web server (Has been applied
successfully)

The data storage may be on one of these computers that is accessable by other
computers.

Ports that Leginon system uses:

This information is useful if you want to open specific ports between computers with a
firewall in between.

  • MySQL normally uses port 3306 (but configurable in /etc/my.cnf)
  • Leginon Client running on TEM host: port 55555
  • Leginon main program on the processing server: dynamically assigned ports between
    49152 and 65535

There is no strict port assignment since we could potentially have more than one
Leginon process running on the same linux host talking to different TEM hosts. It is
probably good enough if you only worry about opening up the first few of those ports in
your firewall (maybe 49152 through 49160, or something like that).

See more discussion at Leginon bulletin board thread on ""network problem, Leginon not seeing
tecnai host":http://emg.nysbc.org/bb/viewtopic.php?t=7 "

Where to Register and download Leginon system

http://www.leginon.org/ is the home. Please
register if you want to recieve support from Leginon team.

  • python-side Leginon packages

direct link: http://emg.nysbc.org/software/leginon/ * mrctools: including the tools for reading mrc images on the web

direct link: http://emg.nysbc.org/software/mrctools/ * dbemtools: including the tools for administration and webviewing

direct link: http://emg.nysbc.org/software/dbemtools/ * project tools (optional): For administration and webviewing of projects

direct link: http://emg.nysbc.org/software/dbemtools/ h2. Processing server-side Leginon Installation

For the lack of better name, processing server-side Leginon refers to packages that
performs the general functions of image acquisition and processing. The instructions here are
for Linux. Refer to Windows Installation for Windows specific instructions.

Download svn checkout script from Leginon website

http://www.leginon.org/ Download
svnget-1.6.sh to a convenient location such as your home directory.

Check out SVN Source Files from the depository

run svnget-1.6.sh. It does the
following:

mkdir Leginon-1.6-ALL
cd Leginon-1.6-ALL
svn co http://emg.nysbc.org/svn/leginon/branches/1.6 Leginon
svn co http://emg.nysbc.org/svn/pyami/branches/leg1.6 pyami
svn co http://emg.nysbc.org/svn/pyScope/branches/leg1.6 pyScope
svn co http://emg.nysbc.org/svn/sinedon/branches/leg1.6 sinedon
svn co http://emg.nysbc.org/svn/numextension/branches/leg1.6 numextension
svn co http://emg.nysbc.org/svn/libcv/branches/leg1.6 libcv
svn co http://emg.nysbc.org/svn/ImageViewer/branches/leg1.6 ImageViewer

If the process fails, you probably do not have svn client installed. Skip to "Install
the supporting packages first if missing:", then try this again.

Perform system check:

In addition to the downloads from our svn depository, there are several other
requirements that you will get either from your OS installation source, or from its
respective website. The system check in the Leginon package checks your system to see if you
already have these requirements

cd your_download_area/Leginon-1.6-ALL/Leginon
python syscheck.py

If python is not installed, this, of course will not run. If you see any lines like "***
Failed...", then you have something missing. Otherwise, everything should result in
"OK".

Install the supporting packages first if missing:

Follow the instruction for your specific Linux distribution.

For example, SUSE users can use YaST to install them; RedHat and CentOS users can use
yum.

*SciPy may not build properly on some versions of SuSE due to an incompatible LAPACK
package that comes with SuSE. You can get scipy as well as a compatible LAPACK etc. from
http://repos.opensuse.org/science (need to specify your SuSE version and machine
etc.)

Required supporting packages:

Name: Download site: yum package name SuSE rpm name
Python 2.4 or newer http://www.python.org python python-devel
wxPython 2.5.2.8 or newer http://www.wxpython.org wxPython python-wxGTK
MySQL Python client 1.2 or newer http://sourceforge.net/projects/mysql-python MySQL-python python-mysql
Python Imaging Library (PIL) 1.1.4 or newer http://www.pythonware.com/products/pil/ python-imaging python-imaging
Python XML module 0.8.3 or newer http://pyxml.sourceforge.net PyXML python-xml
NumPy 1.0.1 or newer http://www.scipy.org numpy numpy
SciPy 0.5.1 (tested, others may work)* http://www.scipy.org , http://repos.opensuse.org/science * scipy python-scipy

*SciPy may not build properly on some versions of SuSE due to an incompatible LAPACK
package that comes with SuSE. You can get scipy as well as a compatible LAPACK etc. from
http://repos.opensuse.org/science (need to specify your SuSE version and machine
etc.)

Optional supporting packages:

  • For using Matlab to explore holefinding algorithm (Matlab HoleFinder)

pymat: http://sourceforge.net/projects/pymat h2. Install the packages you downloaded from svn depository

Here are the packages you need to install with python installer inside the
Leginon-1.6-ALL folder.

Name: Purpose:
Leginon modular TEM image acquisition
pyami general functions
pyScope microscope control and monitoring
sinedon Leginon/database interaction
numExtension c extension for numerical processing
libCV small c library of algorithm from computer vision field
ImageViewer image viewing for tomography
  • run syscheck.py again to make sure you have everything.
  • Install the package in <emphasis role="bold">each folder</emphasis> with commands
    like
    these
    cd /your_download_area/Leginon-1.6-ALL/Leginon
    python setup.py install
    
    cd ../pyami
    python setup.py install
    cd ../pyScope
    python setup.py install
    cd ../sinedon
    python setup.py install
    cd ../numextension
    python setup.py install
    cd ../libcv
    python setup.py install
    cd ../ImageViewer
    python setup.py install

python-site-package-path: where the installed python
packages went:

Python installer put the packages you installed to its site-packages directory. This
enable all users on the same computer to access them. The easiest way to find where your
installed package is called by python is to load a module from the package using interactive
python command lines like this:

  • Start python command line from shell
> python
  • Import a module from the package. Let's try sinedon here. All packages installed
    through the above setup.py script should go to the same place.
python> import sinedon
  • If the module is loaded successfully, call the module attribute path (two
    underscrolls before "path" and two underscrolls after) will return the location of the
    module it is loaded from
python> sinedon.__path__

RETURNS, For example,
python> &lt;module 'sinedon' from '/usr/lib/python2.5/site-packages/sinedon/__init__.pyc'> 

In this case, /usr/lib/python2.5/site-packages/ is your python-site-package-path.
If you go to that directory, you will find all the packages you just installed.

Configure leginon.cfg:

Leginon can be configured at three levels:

  • A skeleton (default) configuration file is available:
 <emphasis><link linkend="package_path">[python-site-package-path]</link></emphasis>/Leginon/config/default.cfg
  • Configurations for all users
 <emphasis><link linkend="package_path">[python-site-package-path]</link></emphasis>/Leginon/config/leginon.cfg

Example of the configuration that you should set: (Here we assume your leginon
database is named "dbemdata", and Leginon log into the database as a user named
"usr_object" with no password
set).

[Images]
path: <emphasis>your_storage_disk_path</emphasis>/leginon

  • Configurations for individual users that overrides the all-user configuration if
    exists
 ~/leginon.cfg

This configuration should include all the minimal configuration above and
additional configuration for individual user for
convenience

[User]
Fullname: <emphasis>your_name</emphasis>  #The name you entered in the leginon administration web page. Note that it is case sensitive

Names used in the example installation

From this point on, you will need to enter database user names for different
configuration files and settings. These are NOT Leginon user names but what is required by
MySQL database interaction. Consistent names are essential. In the example shown here, the
leginon database is called "dbemdata", the project database is called "projectdata". The
MySQL user name are the same, "usr_object", and in this case without a password.

Configure sinedon.cfg:

Sinedon is designed to be able to interact with multiple databases. It can be
configured at global or user level.

  • An example configuration file is available at:
/your_download_area/Leginon-1.6-ALL/sinedon/examples/sinedon.cfg
  • Configurations for all users should be placed at the following path
  <emphasis><link linkend="package_path">[python-site-package-path]</link></emphasis>/sinedon/sinedon.cfg
  • Modify host,db,user,passwd to what is used. Note that the user here is MySQL user
    Leginon uses to communicate with the database for all Leginon users. For Leginon that
    uses Project database, set the following:
[global]
host: <emphasis>your_database_host</emphasis>
user: usr_object
passwd:

[projectdata]
db: projectdata

[leginondata]
db: dbemdata
  • Add database configuration if you intend to use grid-inserting robot. The Robot2
    module uses the database to communicate to the robot. Applications that carries the
    name "Robot" requires this to be set. In general, using the same database as the
    general leginon database is fine.
[robot2]
db: dbemdata

Database Server-side Installation

The following is for the computer that hosts the databases. This involves installing MySQL
server and creation/configuration of the leginon and project databases.

Name: Download site:
MySQL-Server 5.0 or higher http://www.mysql.com
MySQL-Client 5.0 or higher http://www.mysql.com

MySQL

  • Install MySQL-Server
  • Use your package installer (yum, zypper, YaST) if available.

OR

  • Download the latest MySQL-server RPM for Linux from www.mysql.com * Install the MySQL-server rpm:
 rpm -Uvh MySQL-server-5.0.xx-y.i386.rpm

(substitute correct version numbers)
  • Install MySQL-Client
  • Use your package installer (yum, zypper, YaST) if available.

OR

  • Download the latest MySQL-client RPM for Linux from www.mysql.com * Install the MySQL-client rpm:
 rpm -Uvh MySQL-client-5.0.xx-y.i386.rpm

(substitute correct version numbers)
  • MySQL configuration file is usually located in /usr/share/mysql. There are
    several examples there:
&gt; ls /usr/share/mysql/my*
/usr/share/mysql/my-huge.cnf
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-large.cnf
/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-small.cnf
&gt; 
  • Configure my.cnf in /etc using my-huge.cnf as the template
  • > cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
  • Edit /etc/my.cnf to add or change query cache variables like these:
query_cache_type= 1
query_cache_size = 100M
query_cache_limit= 100M
  • start MySQL Server
 &gt;/etc/init.d/mysqld start

on some installation,

 &gt;/etc/init.d/mysql start

For future reference: start | stop | restart MySQL Server with similar
commands:

 &gt;/etc/init.d/mysqld start
&gt;/etc/init.d/mysqld stop
&gt;/etc/init.d/mysqld restart

If you want to start MySQL automatically at boot on SuSE

 SuSE &gt;chkconfig mysql on
  • For future reference, the database location will be:
&gt; cd /var/lib/mysql
Directory: /var/lib/mysql
&gt; ls
yourdbserver.pid
ib_logfile0
mysql
mysql.sock
test
&gt; 
  • Create leginon database, here we call <link linkend="db_example_names"

dbemdata</link>

 &gt;mysqladmin create dbemdata
  • Create project database, here we call <link linkend="db_example_names"

projectdata</link> (optional)

 &gt;mysqladmin create projectdata
  • Connect to mysql db
&gt;mysql mysql

mysql&gt; select user, password, host from user;
+------+----------+-----------+
| user | password | host      |
+------+----------+-----------+
| root |          | localhost |
| root |          | host1     |
|      |          | host1     |
|      |          | localhost |
+------+----------+-----------+
4 rows in set (0.00 sec)
  • Create and grant privileges to a user called <link linkend="db_example_names"

usr_object</link> for the databases on both the localhost and other hosts involved.

For example, use wild card '%' for all hosts. You may also set specific privilege to
the user. See MySQL Reference Manual for details

mysql&gt; create user usr_object@'localhost';
mysql&gt; grant all privileges on dbemdata.* to usr_object@'localhost';
mysql&gt; grant all privileges on projectdata.* to usr_object@'localhost';

Similarly,

mysql&gt; create usr_object@'%';
mysql&gt; grant all privileges on dbemdata.* to usr_object@'%';
mysql&gt; grant all privileges on projectdata.* to usr_object@'%';
  • Change Root passworld
mysql&gt; update user set password=password('<emphasis>a passwd</emphasis>') where user="root";
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql&gt;^D or exit;

From now on, you will need to specify the password to connect to the database as
root user like this:
>mysql -u root -p mysql

<emphasis role="bold">***If your password change does not take effect in your next
database connection, you will need to flush the mysql pivileges cache as mysql root
and connecting with you old password (or no password in the above
case):</emphasis>

>mysql -u root mysql

mysql&gt; flush privileges;
mysql&gt;^D or exit;
  • Check MySQL variables
&gt;mysql -u usr_object dbemdata

mysql&gt; SHOW VARIABLES LIKE 'query%';
+------------------------------+-----------+
| Variable_name                | Value     |
+------------------------------+-----------+
| ft_query_expansion_limit     | 20        |
| have_query_cache             | YES       |
| long_query_time              | 10        |
| query_alloc_block_size       | 8192      |
| query_cache_limit            | 104857600 | &lt;&lt;---This should correspond to your change
| query_cache_min_res_unit     | 4096      |
| query_cache_size             | 104857600 | &lt;&lt;---This should correspond to your change
| query_cache_type             | ON        | &lt;&lt;---This should correspond to your change
| query_cache_wlock_invalidate | OFF       |
| query_prealloc_size          | 8192      |
+------------------------------+-----------+
10 rows in set (0.00 sec)

mysql&gt; exit;
  • Make sure MySQL is running
prompt:~&gt; mysqlshow
+--------------+
| Databases    |
+--------------+
| mysql        |
| dbemdata     |
| projectdata  |
+--------------+
  • Or check with the following php script (if already installed)
&lt;?
mysql_connect('your_host.your_institute.edu', 'usr_object', '','dbemdata');
echo mysql_stat();
?&gt; 

Output

 Uptime: 1452562 Threads: 1 Questions: 618 Slow queries: 0 Opens: 117 Flush tables: 1 Open tables: 106 Queries per second avg: 0.000

Web server set up and Installation

The following applies to the computer that will host the web-accessable image viewers ( a
part of dbem tools) and project manager (a part of project tools).

Differences between Linux flavors

Different Linux flavors often put web server and mysql-related files in different
locations. This can be confusing. From experience, we found the equivalent on CentOS vs
SuSE. Here we list them for reference. If your system use a different naming and you are
willing to share your experience, please send us the list. We will add it here:

File or Command Head CentOS SuSE
php.ini /etc/ /etc/php5/apache2/
httpd.conf /etc/httpd/conf/ /etc/php5/apache2/
default document_root /var/www/html/ /srv/www/htdocs/
apache start/stop/restart command head /etc/init.d/httpd /etc/init.d/apache2
mysql start/stop/restart command head /etc/init.d/mysqld /etc/init.d/mysql

Prerequisites for dbemtools, projecttools, and mrctools extension

The dbemtools are mostly php scripts that run at the web server. The followings are
required before installation of dbemtools and the mrc extension that handles mrc files to be
displayed. Some of these packages may be found on the SuSE Linux DVD or included in common
package repository. MySQL and the Apache Web Server can be downloaded from their respective
websites.

Name: Download site: yum package name SuSE rpm name
Apache www.apache.org httpd apache2
php www.php.net php php
php-devel* rpmfind.net/linux/RPM/Development_Languages_PHP.html php-devel php-devel
php-gd (including GD library, its development libraries and header *) www.php.ned/gd (Use gd2) php-gd, gd-devel php-gd,gd-devel
fftw3 library (including development libraries and header *) www.fftw.org (Use fftw3.x) fftw3-devel fftw3-devel
  • mrctools are compiled and added to php extension with php-devel package. Mrctools use
    GD and FFTW3 that need to be compiled from their development libraries while the extension
    is compiled. If GD and FFTW3 sources were downloaded and compiled directly on your computer,
    these development files are included. If (as in most cases) GD and FFTW3 are installed from
    rpm, they are not included. An error message will appear when you attempt to compile
    mrctools. In this case, you will need separate download and installation of GD-devel and
    FFTW3-devel. Search http://rpmfind.net/linux/rpm2html/ for GD-devel and FFTW3-devel for the rpm
    distribution needed for your system.

Installation tools

Use the installation tools available for your linux distribution.

  • For example, Use yum utility to install.
  • For example, Use the SuSE Linux YaST2 utility or zypper (openSuSE 10.2 and above)
    to install.
  • "A list of required CENTOS
    rpms and instruction":http://emg.nysbc.org/bb/viewtopic.php?t=238 can be found at dbemtools bulletin board at
    leginon.org.

PHP, PHP-devel, gd, and fftw3

Install the packages using your installation tools if available. For example, to
install gd as php extension you may use

CentOS> yum install php-gd
SuSE10.2 and above> zypper install php-gd

Configure php.ini

Edit the following two sections in php.ini (found as /etc/php.ini on CentOS and
/etc/php5/apache2/php.ini on SuSE) so that they look like the following:

register_argc_argv = On
short_open_tag = On
max_execution_time = 300     ; Maximum execution time of each script, in seconds
max_input_time = 300     ; Maximum amount of time each script may spend parsing request data
memory_limit = 256M      ; Maximum amount of memory a script may consume (8MB)

You may want to increase max_input_time and memory_limit if the server is heavily used.
At NRAMM, max_input_time=600 and memory_limit=4000M.

Apache Web Server

  • Install the Apache Web Server with the YaST or yum utility.
  • Find "httpd.conf".

This is /etc/httpd/conf/httpd.conf on CentOS and /etc/php5/apache2/httpd.conf on
SuSE

  • Edit the "httpd.conf" configuration file to look like the following:
&lt;IfModule mod_dir.c&gt;
DirectoryIndex index.htm index.shtm index.html index.shtml index.php
&lt;/IfModule&gt;

(Note: It may be possible to edit httpd.conf in YaST2 as well.)

  • Restart the web server.
apachectl restart
or
/etc/init.d/httpd restart     (ON CentOS)
or
/etc/init.d/apache2 restart   (ON SuSE)

If you want to start the web server automatically at boot on SuSE

 SuSE &gt;chkconfig apache2 on

Check php information

Create the following info.php in your web server document root directory (/var/www/html
on CentOS. /srv/www/htdocs on SuSE. You can find its location in httpd.conf mentioned above
under the line starting
DocumentRoot).

&lt;?php
phpinfo();
?&gt;

Visit this page at http://yourhost/info.php

You will see comprehensive tables of php and apache information, including the location
of the addition .ini files, extension, include path, and what extension is enabled.

Here is an example screen shot of the part of the info.php page that tells you where
php.ini and other configuration files are.

mrctools Installation

mrctools are installed as php extension and are required for displaying mrc files live
on the web browser.

Install php-devel packages on the web server if missing:

You can check whether php-devel is installed by
typing

 &gt;phpize

Follow the instruction for your specific Linux distribution.

For example, SUSE users can use YaST or zypper to install them

php-GD/FFTW3-devel

Follow instructions from the download site. These may be included already. If not,
mrctools installation will fail.

mrctools Installation

mrctools are installed from php devel directory. This is usually /usr/include/php/ext
where you will find other php extension source such as gd. After the installation, mrc.so
should be placed in php's extension directory (Look for "extension_dir" in
http://your_host/&lt;link linkend="install_infophp">info.php</link>

Check php information

Visit or refresh http://yourhost/info.php <link linkend="install_infophp">which you
created earlier</link>. It should have a section looking like this (The version should
correspond to what you've just installed):

If mrc is not listed, the extension did not get added at the right order.

Alternative approach if mrc module does not show up in info.php output

  • find in the <link linkend="install_infophp">info.php web page</link> the location
    of "additional .ini files parsed" in the first table (such as
    /etc/php.d/conf.d/*).
  • Go to the directory and make a copy of any ini file to use as a template for
    mrc.ini
&gt;cd [additional_ini_directory]
&gt;cp gd.ini mrc.ini
  • Edit mrc.ini to the following
; comment out next line to disable mrc extension in php
extension=mrc.so
  • Comment out mrc extension from php.ini (found in /etc/php.ini/ on a typical PHP
    installation)
;extension=mrc.so
  • restart your webserver
&gt; /etc/init.d/httpd restart

Web Viewing Tools (dbemtools) Linux
Installation

php and java scripts for viewing images and Leginon information through the web
server.

  • Unpack the package in your [webdirectory]
&gt;cd [webdirectory]            #/var/www/html in this example
[webdirectory&gt;tar zxvf dbem_1_5_1.tgz
  • Copy config.php.template to config.php and edit the latter by adding these MySQL
    parameters:

"config.php" should be located in /var/www/html/dbem_1_5_1/ on CentOS and
/srv/www/htdocs/dbem_1_5_1/ on SuSE.

&lt;?
// ---define dbem web tools base ---//
define('BASE_URL',"/dbem_1_5_1/";
// --- Leginon Viewer Configuration --- //

// --- Set your leginon MySQL database server parameters

$DB_HOST    = "[your database host]";
$DB_USER    = "<link linkend="db_example_names">usr_object</link>";
$DB_PASS    = "";
$DB        = "<link linkend="db_example_names">dbemdata</link>";

// --- XML test dataset
$XML_DATA = "test/viewerdata.xml";

// --- Project database config

$PROJECT_URL = "/project_1_2";
$PROJECT_DB_HOST = "[your database host]";
$PROJECT_DB_USER = "<link linkend="db_example_names">usr_object</link>";
$PROJECT_DB_PASS = "";
$PROJECT_DB = "<link linkend="db_example_names">projectdata</link>";

Project management tools Linux Installation

Leginon sessions can be catagorized into different projects. The projects are created
and viewed trhough a set of web tools. To access them, install the tools on the web server.
The same project management tools are also used to create and track appion processing
databases. If you want to use our processing pipeline, Appion, in the future, you must
install this.

Prerequisites for project tools

installed dbemtools and its prerequisites

project tools

Current release: project 1.2.

  • Unpack the package in your [webdirectory]
&gt;cd [webdirectory]            #/var/www/html in this example
[webdirectory]&gt;tar zxvf project_1_2.tgz
  • Go to the uncompressed directory
    project_1_2.
    > cd project_1_2
  • Copy config.php.template to <emphasis role="bold">config.php</emphasis>
> cp config.php.template to config.php
  • Edit <emphasis role="bold">config.php</emphasis>: You need to insert these MySQL
    parameters in project tool's config.php
// --- Project Configuration --- //

// --- Leginon database config
$DBEM_PATH="../dbem_1_5_1/";

$DB_HOST  = "[your database host]";
$DB_USER  = "usr_object";
$DB_PASS  = "";
$DB   = "<link linkend="db_example_names">dbemdata</link>";

// --- Project database config
$PROJECT_DB_HOST = "[your database host]";
$PROJECT_DB_USER = "<link linkend="db_example_names">usr_object</link>";
$PROJECT_DB_PASS = "";
$PROJECT_DB = "<link linkend="db_example_names">projectdata</link>";

Other Tools

This section includes tools that may help with Leginon development.

phpMyAdmin

  • Download phpMyAdmin from Yast2 or www.phpmyadmin.net * Download phpMyAdmin into the directory where the web server has been
    installed.
  • Check phpMyAdmin installation:
&gt;rpm -qa |grep -i phpmyadmin 
  • Install from tarball:
> cd [webdirectory]
[webdirectory]&gt;tar zxvf phpMyAdmin-2.x.tar.gz

or Install with yum if availabe:

> yum install phpMyAdmin
  • Create phpMyAdmin configuration file called config.inc.php from a
    sample.
[webdirectory]&gt;cd phpMyAdmin
(if you install with yum, the program directory is /usr/share/phpMyAdmin)

> cp config.sample.inc.php config.inc.php
  • Make sure these are set correctly in <emphasis role="bold"

config.inc.php</emphasis>. Note that these are for MySQL which we set earlier.

You can set specific user, but it is safer just leave it blank.

$cfg['Servers'][$i]['host']            = '[your host]';
$cfg['Servers'][$i]['port']            = '';
$cfg['Servers'][$i]['socket']          = '';
$cfg['Servers'][$i]['connect_type']    = 'tcp';
$cfg['Servers'][$i]['extension']       = 'mysql';
$cfg['Servers'][$i]['compress']        = FALSE;
$cfg['Servers'][$i]['controluser']     = '';
$cfg['Servers'][$i]['auth_type']     = 'http';
$cfg['Servers'][$i]['user']          = '';
$cfg['Servers'][$i]['password']      = '';
  • For additional security, you may restrict mysql root access
$cfg['Servers'][$i]['AllowRoot']     = FALSE;
  • If you want to access phpMyAdmin from another computer, you can add it to its
    web access configuration file found as /etc/httpd/conf.d/phpMyAdmin.conf in a
    typical installation
&lt;Directory /usr/share/phpMyAdmin/>
order deny,allow
deny from all
allow from 127.0.0.1
allow from YOUR_IP_ADDRESS
&lt;/Directory>

Windows installation

Processing-side Leginon Windows Installation

Install Python and Support Packages (Note that python 2.5 must be used):

This list does not include pyton XML module because it is included in the python
package for window.

Name: Download site:
Python 2.5* http://www.python.org
Python for Windows extension (pywin32) http://sourceforge.net/projects/pywin32/
wxPython 2.5.2.8 or newer http://www.wxpython.org
MySQL Python client 1.2 or newer http://sourceforge.net/projects/mysql-python
Python Imaging Library (PIL) 1.1.4 or newer http://www.pythonware.com/products/pil/
NumPy 1.0b5 (tested, others may work) http://www.scipy.org
SciPy 0.5.1 or newer http://www.scipy.org
Tortoise SVN client http://tortoisesvn.tigris.org

*Python 2.5 is the only python version that we have compiled numExtension. libCV and
comarray in. Therefore no other python version works for now.

Execute the installer file and follow the directions.

Packages required from NRAMM

Here are the packages you need to install with python installer

Name: Purpose:
Leginon modular TEM image acquisition
pyami general functions
sinedon Leginon/database interaction
pyScope microscope control and monitoring
ImageViewer image viewing for tomography

Because numextension and libCV requires extra compilers, we have created window
installer for them for python 2.5 and made them available through http://www.leginon.org/

Downloadfile Name Installed Python Package File Purpose:
NumExtension-1.2.0.win32-py2.5.exe numextension.pyd c extension for numerical processing
libCV-0.2.win32-py2.5.exe libCV.pyd small c library of algorithm from computer vision field

Check out SVN Source Files from the depository

Use your mouse to do the following
  • Create Leginon-1.6-ALL directory somewhere at your convenience
  • Change directory into Leginon-1.6-ALL
  • Right-click the mouse botton in this directory window and select Tortoise svn
    Checkout in the menu:!http://emg.nysbc.org/software/leginon/images/images/svnmenu.png!
  • Set up svn checkout window like this for <link linkend="windows_packages">EACH
    of the leginon packages</link>.!http://emg.nysbc.org/software/leginon/images/images/svnco.png!

Install the packages you downloaded from NRAMM svn depository

  • Start a command line Window from Start Menu
  • Install the package in each folder with commands such as
    cd Your_Download_Place\Leginon-1.6-ALL\leginon
    c:\\python25\python.exe setup.py install

Download the two Window Installer Files from Leginon website

http://www.leginon.org/ h2. Install individual packages

Excute the installer files and follow the instruction.

Mapping Drives:

If you plan to run Leginon directly on the Windows machine, such as in <link
linkend="config_C">configuration C</link>, and your data files are served through a
Samba server on a Linux machine, you will need to map the network drive. For example, if
your Samba server has a hostname your_smbserver, and you have set up a share called
[your_share_point] which points to /your_data_path/ and leginon data will be saved under a
folder in /your_data_path/leginon/

  • Start, My Computer
  • Tools menu, Map network drive
  • Use an unmapped drive such as Z:

Enter shared path in Windows format
as

\\your_smbserver\your_share_point

  • Add the drive and the Linux path to leginon.cfg on the Windows machine
    as
    [Drive Mapping]
    Z:/your_data_path
  • Add image path to leginon.cfg on the Windows machine in Linux format
    as
    [Images]
    path:/your_data_path/leginon

Configure leginon.cfg:

Follow instruction in "<link linkend="leginon_cfg">Configure leginon.cfg</link>" in
the section for Linux installation but note the location of the configuration files
follows. In addition, if the storage disk is mapped onto the Windows PC as drive Z, this
mapping should be included in leginon.cfg. See above.

  • Configurations for all users
 &lt;Python directory&gt;\Lib\site-packages\Leginon\config\leginon.cfg

Example:

 C:\Python25\Lib\site-packages\Leginon\config\leginon.cfg

  • Configurations for individual users
 &lt;Home directory&gt;\leginon.cfg

Example:

 C:\Documents and Settings\Leginon User\leginon.cfg 

  • A skeleton (default) configuration file is available:
 C:\Python25\Lib\site-packages\Leginon\config\default.cfg

Configure sinedon.cfg:

Sinedon is designed to be able to interact with multiple databases.

Follow instruction in "<link linkend="sinedon_cfg">Configure sinedon.cfg</link>" in
the section for Linux installation but note the location of the configuration files
follows.

  • For all users, put sinedon.cfg with the installed package
    as
    C:\Python25\Lib\site-packages\sinedon\sinedon.cfg
  • Your home directory on
    Windows:
    C:\Documents and Settings\your_name&gt;
  • the skeleton sinedon configuration file
    is
    C:\Python25\Lib\site-packages\sinedon\examples\sinedon.cfg

Create Leginon and Leginon Client shortcut in Start menu menu under Leginon

This instruction refers to Windows XP

  • Go to C:\Documents and Settings\All Users\Start Menu\Programs\ and create a new
    folder named Leginon.
  • In another window, go
    to
    C:\Python25\Lib\site-packages\Leginon
  • Create a shortcut from start-leginon.py as Leginon and a shortcut from
    launcher.py as Leginon Client.
  • Move the two shortcuts into
    C:\Documents and Settings\All Users\Start Menu\Programs\Leginon

Additional Software (Optional):

TightVNC (http://www.tightvnc.com)

Database server Windows Installation

We do not do this at NRAMM. Please follow the instruction in Linux installation and
modify it for Windows at your own risk.

For a good Windows specific instruction for general PHP configuration with MySQL for
Apache 2 in Windows, try http://www.artfulsoftware.com/php_mysql_win.html.

Additional installation on the microscope computer:

The full leginon and its supporting packages need to be installed on the Windows computer
controlling the microscope. Additional programs are required for communication with the CCD
and extra functions for Tecnai scripting not supported as default by FEI Tecnai
microscopes

Required supporting programs for the CCD camera from camera makers

Install and register the following programs for CCD cameras from the two makes:

Camera Make: File:
Gatan TecnaiCCD.dll
Tietz CAMC4.exe*
  • We have experienced slowness of the CAMC4.exe comes with later version Tecnai TUI/TIA.
    Replacing it with an earlier version of CAMC4.exe resolved the problem.

Additional Package required from NRAMM for Gatan camera or camera that uses TIA

For Gatan Camera or FEI Eagle Camera that uses TIA, comarray package need to be install
with python

SVN Package Name Installed Python Package Name Reason for update:
comarray comarray com module output conversion to array
  • <link linkend="window_svn">Check out the comarray package</link> from svn
    depository with your SVN client
cd Leginon-1.6-ALL
svn co http://emg.nysbc.org/svn/comarray/branches/leg1.6 comarray
  • Start a command line Window from Start Menu
  • Install the package with commands such as
    cd Your_Download_Place\Leginon-1.6-ALL\comarray
    c:\\python25\python.exe setup.py install

Supporting programs for film exposure

Install the following if you need film exposure on FEI Tecnai TEM through Leginon,
available through FEI. Please contact Max Otten: <email></email> and request
for adaexp.exe that works with your version of Tecnai user interface program.

Name: File:
exposure adaptor adaexp.exe

Register adaexep.exe

  • From the command prompt:
adaexp.exe /regserver
  • From the program start menu under pyScope or
    C:\Python25\Lib\site-packages\pyScope\
updatecom.py

Modify instruments.cfg:

Sinedon now have full control of database interaction, therefore, the database
configuration in leginon.cfg is no longer needed.

  • Modify the file instruments.cfg in the installed pyScope directory to that for
    your microscope and camera. For example, if your microscope uses Tecnai Scripting
    Interface and you have a Gatan camera that you interface through
    DigitalMicrograph:
[tem]
class: tecnai.Tecnai
[camera]
class: gatan.Gatan

The file contains other examples of microscope and camera drivers that we
distribute from NRAMM.

Run updatecom.py

From a command line window:

cd C:\python25\Lib\Site-Packages\pyScope
C:\python25\python.exe updatecom.py

This should generate a few files, including tecnaicom.py, gatancom.py and tietzcom.py,
in the same directory.

Additional setup on Tietz PXL camera (optional)

The actual Tietz PXL camera dimension is slightly larger than 2048 x 2048. If you'd like
to take the images using the maximum of 2048 x 2048 pixels, you may modify the function that
get camera dimension in tietz.py of pyScope package.

  • Go to C:\Python25\Lib\site-packages\pyScope\
  • Edit tietz.py with a plain text editor
  • Find the lines:
 def getCameraSize(self):
# {'type': dict, 'values': {'x': {'type': int}, 'y': {'type': int}}}}
x = self._getParameterValue('cpTotalDimensionX')
y = self._getParameterValue('cpTotalDimensionY')
return {'x': x, 'y': y}
  • Change the last line to:
    return {'x': 2048, 'y': 2048}

Additional Software (Optional):

TightVNC (http://www.tightvnc.com) if you get tired of going into the microscope room
just to open the column valves.

What is next

Perform Administration Setup

See Next chapter on <link linkend="addusers">Leginon Administration Tools</link>.

Create a test project

See the chapter on <link linkend="project">Project Management Tools</link>.

Perform Microscope Setup and Test run

See the chapter on <link linkend="runleg_chapter">Start Leginon</link>.

Backup Practices

Ideal setup:

Regular computer backup

To protect your program installation.

Full backup of the databases every night

The database is the metadata generated by Leginon named "dbemdata" in the installation
example.

Full/Incremental/differential backup of the images

The image files located in [your storage disk] should be backup in full at least once
a month, and nightly in differential or incremental mode.

Current NRAMM setup:

Because our tape backup system is not on-site and the data have to transfer over slow
network to perform the task, we have not been able to backup in the ideal setting. Here is
what we currently do:

Regular computer backup

TSRI Research Computing provides regular back up service that does full backup of the
computers every four weeks and incremental backup every night. The full backup expires in
4 months and the incremental backup one month. We do this for the computers running
Leginon main program, the database server, as well as the web server.

Regular backup & tar of the databases every night

On top of the TSRI backup, we also tar the database everynight and store it on the
institutional tape library.

rsync to a tape library of the image storage disk

As our image storage disks total 15T byte, we currently use rsync function to update a
copy on our institutional tape library. It creates new files, updates old files, but does
not remove old files on the tape if it is removed on the storage disk. We do not think
this is the best solution since it is not possible to retrieve old files that have been
modified on a later time.

Updated by Amber Herold about 14 years ago · 18 revisions