Appion Home » History » Revision 29
Revision 28 (Amber Herold, 04/01/2010 11:04 AM) → Revision 29/101 (Amber Herold, 04/01/2010 11:06 AM)
h1. Complete Installation h2. Four Parts of Leginon System !http://emg.nysbc.org/software/leginon/images/images/Leg_Proj_parts.png! Leginon as a system that we distribute can be divided into three parts: h2. Processing Server (Python-side) Python (and some c) scripts that handle instrument control, data acquisition, and processing. h2. Database Server (MySQL-side) a MySQL server that handles the database h2. 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. h2. File Server This is up to you to set up to store lots of data coming out of Leginon system. h2. 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 <ulink url="http://emg.nysbc.org/bb/viewforum.php?f=2">Leginon Bulletin Board":http://emg.nysbc.org/bb/viewforum.php?f=2 Board</ulink> searching for "install" if you run into problems. h2. 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. h2. 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). h2. 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. h2. 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. h2. 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 "<ulink url="http://emg.nysbc.org/bb/viewtopic.php?t=7">network problem, Leginon not seeing tecnai host":http://emg.nysbc.org/bb/viewtopic.php?t=7 " host</ulink>" h2. Where to Register and download Leginon system "http://www.leginon.org/":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/":http://emg.nysbc.org/software/leginon/ <ulink url="http://emg.nysbc.org/software/leginon/" >http://emg.nysbc.org/software/leginon/</ulink> * mrctools: including the tools for reading mrc images on the web direct link: "http://emg.nysbc.org/software/mrctools/":http://emg.nysbc.org/software/mrctools/ <ulink url="http://emg.nysbc.org/software/mrctools/" >http://emg.nysbc.org/software/mrctools/</ulink> * dbemtools: including the tools for administration and webviewing direct link: "http://emg.nysbc.org/software/dbemtools/":http://emg.nysbc.org/software/dbemtools/ <ulink url="http://emg.nysbc.org/software/dbemtools/" >http://emg.nysbc.org/software/dbemtools/</ulink> * project tools (optional): For administration and webviewing of projects direct link: "http://emg.nysbc.org/software/dbemtools/":http://emg.nysbc.org/software/dbemtools/ <ulink url="http://emg.nysbc.org/software/dbemtools/" >http://emg.nysbc.org/software/dbemtools/</ulink> 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. h2. Download svn checkout script from Leginon website "http://www.leginon.org/":http://www.leginon.org/ Download svnget-1.6.sh to a convenient location such as your home directory. h2. Check out SVN Source Files from the depository run svnget-1.6.sh. It does the following:<pre>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</pre> 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. h2. 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 <pre>cd your_download_area/Leginon-1.6-ALL/Leginon python syscheck.py</pre> 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". h2. 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.) h2. Required supporting packages: |_.Name:|_.Download site:|_.yum package name|_.SuSE rpm name| |Python 2.4 or newer|"http://www.python.org":http://www.python.org|python|python-devel| |wxPython 2.5.2.8 or newer|"http://www.wxpython.org":http://www.wxpython.org|wxPython|python-wxGTK| |MySQL Python client 1.2 or newer|"http://sourceforge.net/projects/mysql-python":http://sourceforge.net/projects/mysql-python|MySQL-python|python-mysql| newer|<ulink url="http://sourceforge.net/projects/mysql-python" >http://sourceforge.net/projects/mysql-python</ulink>|MySQL-python|python-mysql| |Python Imaging Library (PIL) 1.1.4 or newer|"http://www.pythonware.com/products/pil/":http://www.pythonware.com/products/pil/|python-imaging|python-imaging| newer|<ulink url="http://www.pythonware.com/products/pil/" >http://www.pythonware.com/products/pil/</ulink>|python-imaging|python-imaging| |Python XML module 0.8.3 or newer|"http://pyxml.sourceforge.net":http://pyxml.sourceforge.net|PyXML|python-xml| |NumPy 1.0.1 or newer|"http://www.scipy.org":http://www.scipy.org|numpy|numpy| |SciPy 0.5.1 (tested, others may work)*|"http://www.scipy.org":http://www.scipy.org , "http://repos.opensuse.org/science":http://repos.opensuse.org/science *|scipy|python-scipy| <ulink url="http://repos.opensuse.org/science" >http://repos.opensuse.org/science</ulink>*|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.) h2. Optional supporting packages: * For using Matlab to explore holefinding algorithm (Matlab HoleFinder) pymat: "http://sourceforge.net/projects/pymat":http://sourceforge.net/projects/pymat <ulink url="http://sourceforge.net/projects/pymat" >http://sourceforge.net/projects/pymat</ulink> 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 _each folder_ with commands like these<pre>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</pre> h2. 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 <pre>> python</pre> * 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. <pre>python> import sinedon</pre> * 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 <pre>python> sinedon.__path__ RETURNS, For example, python> <module 'sinedon' from '/usr/lib/python2.5/site-packages/sinedon/__init__.pyc'> </pre> 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. h2. Configure leginon.cfg: Leginon can be configured at three levels: * A skeleton (default) configuration file is available: <pre> _<link linkend="package_path">[python-site-package-path]</link>_/Leginon/config/default.cfg</pre> * Configurations for all users <pre> _<link linkend="package_path">[python-site-package-path]</link>_/Leginon/config/leginon.cfg</pre> 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).<pre>[Images] path: _your_storage_disk_path_/leginon </pre> * Configurations for individual users that overrides the all-user configuration if exists <pre> ~/leginon.cfg</pre> This configuration should include all the minimal configuration above and additional configuration for individual user for convenience<pre>[User] Fullname: _your_name_ #The name you entered in the leginon administration web page. Note that it is case sensitive</pre> h2. 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. h2. 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: <pre>/your_download_area/Leginon-1.6-ALL/sinedon/examples/sinedon.cfg</pre> * Configurations for all users should be placed at the following path <pre> _<link linkend="package_path">[python-site-package-path]</link>_/sinedon/sinedon.cfg</pre> * 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: <pre>[global] host: _your_database_host_ user: usr_object passwd: [projectdata] db: projectdata [leginondata] db: dbemdata </pre> * 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. <pre>[robot2] db: dbemdata</pre> h2. 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":http://www.mysql.com| |MySQL-Client 5.0 or higher|"http://www.mysql.com":http://www.mysql.com| h2. 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":http://www.mysql.com * Install the MySQL-server rpm: <pre> rpm -Uvh MySQL-server-5.0.xx-y.i386.rpm</pre> (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":http://www.mysql.com * Install the MySQL-client rpm: <pre> rpm -Uvh MySQL-client-5.0.xx-y.i386.rpm</pre> (substitute correct version numbers) * MySQL configuration file is usually located in /usr/share/mysql. There are several examples there: <pre>> 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 > </pre> * Configure my.cnf in /etc using my-huge.cnf as the template * <pre>> cp /usr/share/mysql/my-huge.cnf /etc/my.cnf</pre> * Edit /etc/my.cnf to add or change query cache variables like these: <pre>query_cache_type= 1 query_cache_size = 100M query_cache_limit= 100M</pre> * start MySQL Server <pre> >/etc/init.d/mysqld start</pre> on some installation, <pre> >/etc/init.d/mysql start</pre> For future reference: start | stop | restart MySQL Server with similar commands: <pre> >/etc/init.d/mysqld start >/etc/init.d/mysqld stop >/etc/init.d/mysqld restart</pre> If you want to start MySQL automatically at boot on SuSE <pre> SuSE >chkconfig mysql on </pre> * For future reference, the database location will be: <pre>> cd /var/lib/mysql Directory: /var/lib/mysql > ls yourdbserver.pid ib_logfile0 mysql mysql.sock test > </pre> * Create leginon database, here we call <link linkend="db_example_names" >dbemdata</link> <pre> >mysqladmin create dbemdata</pre> * Create project database, here we call <link linkend="db_example_names" >projectdata</link> (optional) <pre> >mysqladmin create projectdata</pre> * Connect to mysql db <pre>>mysql mysql mysql> select user, password, host from user; +------+----------+-----------+ | user | password | host | +------+----------+-----------+ | root | | localhost | | root | | host1 | | | | host1 | | | | localhost | +------+----------+-----------+ 4 rows in set (0.00 sec)</pre> * 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 <pre>mysql> create user usr_object@'localhost'; mysql> grant all privileges on dbemdata.* to usr_object@'localhost'; mysql> grant all privileges on projectdata.* to usr_object@'localhost';</pre> Similarly, <pre>mysql> create usr_object@'%'; mysql> grant all privileges on dbemdata.* to usr_object@'%'; mysql> grant all privileges on projectdata.* to usr_object@'%'; </pre> * Change Root passworld <pre>mysql> update user set password=password('_a passwd_') where user="root"; Query OK, 2 rows affected (0.01 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql>^D or exit;</pre> From now on, you will need to specify the password to connect to the database as root user like this: <pre>>mysql -u root -p mysql</pre> _***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):_ <pre>>mysql -u root mysql</pre> <pre>mysql> flush privileges; mysql>^D or exit;</pre> * Check MySQL variables <pre>>mysql -u usr_object dbemdata mysql> 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 | <<---This should correspond to your change | query_cache_min_res_unit | 4096 | | query_cache_size | 104857600 | <<---This should correspond to your change | query_cache_type | ON | <<---This should correspond to your change | query_cache_wlock_invalidate | OFF | | query_prealloc_size | 8192 | +------------------------------+-----------+ 10 rows in set (0.00 sec) mysql> exit;</pre> * Make sure MySQL is running <pre>prompt:~> mysqlshow +--------------+ | Databases | +--------------+ | mysql | | dbemdata | | projectdata | +--------------+</pre> * Or check with the following php script (if already installed) <pre><? mysql_connect('your_host.your_institute.edu', 'usr_object', '','dbemdata'); echo mysql_stat(); ?> </pre> Output <pre> Uptime: 1452562 Threads: 1 Questions: 618 Slow queries: 0 Opens: 117 Flush tables: 1 Open tables: 106 Queries per second avg: 0.000</pre> h2. 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). h2. 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| h2. 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":http://www.apache.org| httpd| apache2| | php|"www.php.net":http://www.php.net| php| php| | php-devel*|"rpmfind.net/linux/RPM/Development_Languages_PHP.html":http://rpmfind.net/linux/RPM/Development_Languages_PHP.html| php-devel*|<ulink url="http://rpmfind.net/linux/RPM/Development_Languages_PHP.html" >rpmfind.net/linux/RPM/Development_Languages_PHP.html</ulink>| php-devel| php-devel| | php-gd (including GD library, its development libraries and header *)|"www.php.ned/gd":http://www.libgd.org (Use gd2)| php-gd, gd-devel| php-gd,gd-devel| | fftw3 library (including development libraries and header *)|"www.fftw.org":http://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/":http://rpmfind.ned/linux/rpm2html/ <ulink url="http://rpmfind.ned/linux/rpm2html/" >http://rpmfind.net/linux/rpm2html/</ulink> for GD-devel and FFTW3-devel for the rpm distribution needed for your system. h2. 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 <ulink url="http://emg.nysbc.org/bb/viewtopic.php?t=238">A list of required CENTOS rpms and instruction":http://emg.nysbc.org/bb/viewtopic.php?t=238 instruction</ulink> can be found at dbemtools bulletin board at leginon.org. h2. 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 <pre>CentOS> yum install php-gd SuSE10.2 and above> zypper install php-gd</pre> h2. 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: <pre>register_argc_argv = On</pre> <pre>short_open_tag = On</pre> <pre>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)</pre> 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. h2. 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: <pre><IfModule mod_dir.c> DirectoryIndex index.htm index.shtm index.html index.shtml index.php </IfModule></pre> (Note: It may be possible to edit httpd.conf in YaST2 as well.) * Restart the web server. <pre>apachectl restart or /etc/init.d/httpd restart (ON CentOS) or /etc/init.d/apache2 restart (ON SuSE)</pre> If you want to start the web server automatically at boot on SuSE <pre> SuSE >chkconfig apache2 on </pre> h2. 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).<pre><?php phpinfo(); ?></pre> 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. !http://emg.nysbc.org/software/leginon/images/images/phpini.png! h2. mrctools Installation mrctools are installed as php extension and are required for displaying mrc files live on the web browser. h2. Install php-devel packages on the web server if missing: You can check whether php-devel is installed by typing<pre> >phpize</pre> Follow the instruction for your specific Linux distribution. For example, SUSE users can use YaST or zypper to install them h2. php-GD/FFTW3-devel Follow instructions from the download site. These may be included already. If not, mrctools installation will fail. h2. 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/<link linkend="install_infophp">info.php</link> * Download dbem tools from "http://emg.nysbc.org/software/mrctools":http://emg.nysbc.org/software/mrctools . <ulink url="http://emg.nysbc.org/software/mrctools" >http://emg.nysbc.org/software/mrctools</ulink>. * Follow the instruction at "http://emg.nysbc.org/software/mrctools/mrc_so.php":http://emg.nysbc.org/software/mrctools/mrc_so.php <ulink url="http://emg.nysbc.org/software/mrctools/mrc_so.php" >http://emg.nysbc.org/software/mrctools/mrc_so.php</ulink> for installation and testing. The next session about checking php information can also help debugging the installation h2. 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): !http://emg.nysbc.org/software/leginon/images/images/phpmrc.png! If mrc is not listed, the extension did not get added at the right order. h2. 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 <pre>>cd [additional_ini_directory] >cp gd.ini mrc.ini</pre> * Edit mrc.ini to the following <pre>; comment out next line to disable mrc extension in php extension=mrc.so</pre> * Comment out mrc extension from php.ini (found in /etc/php.ini/ on a typical PHP installation) <pre>;extension=mrc.so</pre> * restart your webserver <pre>> /etc/init.d/httpd restart</pre> h2. Web Viewing Tools (dbemtools) Linux Installation php and java scripts for viewing images and Leginon information through the web server. * Download dbem tools from "http://emg.nysbc.org/software/dbemtools":http://emg.nysbc.org/software/dbemtools . <ulink url="http://emg.nysbc.org/software/dbemtools" >http://emg.nysbc.org/software/dbemtools</ulink>. * Unpack the package in your [webdirectory] <pre>>cd [webdirectory] #/var/www/html in this example [webdirectory>tar zxvf dbem_1_5_1.tgz</pre> * 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. <pre><? // ---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>"; </pre> * Test the set-up by visiting http://yourhost/dbem_1_5_1 h2. 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. h2. Prerequisites for project tools installed dbemtools and its prerequisites h2. project tools Current release: project 1.2. * Download project tools from "http://emg.nysbc.org/software/dbemtools":http://emg.nysbc.org/software/dbemtools . <ulink url="http://emg.nysbc.org/software/dbemtools" >http://emg.nysbc.org/software/dbemtools</ulink>. * Unpack the package in your [webdirectory] <pre>>cd [webdirectory] #/var/www/html in this example [webdirectory]>tar zxvf project_1_2.tgz</pre> * Go to the uncompressed directory project_1_2.<pre>> cd project_1_2</pre> * Copy config.php.template to _config.php_ <pre>> cp config.php.template to config.php</pre> * Edit _config.php_: You need to insert these MySQL parameters in project tool's config.php <pre>// --- 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>"; </pre> * Test the set-up by visiting http://yourhost/project_1_2 h2. Other Tools This section includes tools that may help with Leginon development. h2. phpMyAdmin * Download phpMyAdmin from Yast2 or "www.phpmyadmin.net":http://www.phpmyadmin.net <ulink url="http://www.phpmyadmin.net" >www.phpmyadmin.net</ulink> * Download phpMyAdmin into the directory where the web server has been installed. * Check phpMyAdmin installation: <pre>>rpm -qa |grep -i phpmyadmin </pre> * Install from tarball: <pre>> cd [webdirectory] [webdirectory]>tar zxvf phpMyAdmin-2.x.tar.gz</pre> or Install with yum if availabe: <pre>> yum install phpMyAdmin</pre> * Create phpMyAdmin configuration file called config.inc.php from a sample. <pre>[webdirectory]>cd phpMyAdmin (if you install with yum, the program directory is /usr/share/phpMyAdmin) > cp config.sample.inc.php config.inc.php </pre> * Make sure these are set correctly in _config.inc.php_. Note that these are for MySQL which we set earlier. You can set specific user, but it is safer just leave it blank. <pre> $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'] = ''; </pre> * For additional security, you may restrict mysql root access <pre> $cfg['Servers'][$i]['AllowRoot'] = FALSE; </pre> * 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 <pre> <Directory /usr/share/phpMyAdmin/> order deny,allow deny from all allow from 127.0.0.1 allow from YOUR_IP_ADDRESS </Directory> </pre> h2. Windows installation h2. Processing-side Leginon Windows Installation h2. 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":http://www.python.org| |Python for Windows extension (pywin32)|"http://sourceforge.net/projects/pywin32/":http://sourceforge.net/projects/pywin32/| (pywin32)|<ulink url="http://sourceforge.net/projects/pywin32/" >http://sourceforge.net/projects/pywin32/</ulink>| |wxPython 2.5.2.8 or newer|"http://www.wxpython.org":http://www.wxpython.org| |MySQL Python client 1.2 or newer|"http://sourceforge.net/projects/mysql-python":http://sourceforge.net/projects/mysql-python| newer|<ulink url="http://sourceforge.net/projects/mysql-python" >http://sourceforge.net/projects/mysql-python</ulink>| |Python Imaging Library (PIL) 1.1.4 or newer|"http://www.pythonware.com/products/pil/":http://www.pythonware.com/products/pil/| newer|<ulink url="http://www.pythonware.com/products/pil/" >http://www.pythonware.com/products/pil/</ulink>| |NumPy 1.0b5 (tested, others may work)|"http://www.scipy.org":http://www.scipy.org| |SciPy 0.5.1 or newer|"http://www.scipy.org":http://www.scipy.org| |Tortoise SVN client|"http://tortoisesvn.tigris.org":http://tortoisesvn.tigris.org| client|<ulink url="http://tortoisesvn.tigris.org" >http://tortoisesvn.tigris.org</ulink>| *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. h2. 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/":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| h2. 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! h2. 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 <pre>cd Your_Download_Place\Leginon-1.6-ALL\leginon c:\\python25\python.exe setup.py install</pre> h2. Download the two Window Installer Files from Leginon website "http://www.leginon.org/":http://www.leginon.org/ h2. Install individual packages Excute the installer files and follow the instruction. h2. 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<pre>\\your_smbserver\your_share_point</pre> * Add the drive and the Linux path to leginon.cfg on the Windows machine as<pre>[Drive Mapping] Z:/your_data_path</pre> * Add image path to leginon.cfg on the Windows machine in Linux format as<pre>[Images] path:/your_data_path/leginon</pre> h2. 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 <pre> <Python directory>\Lib\site-packages\Leginon\config\leginon.cfg</pre> Example: <pre> C:\Python25\Lib\site-packages\Leginon\config\leginon.cfg</pre> * Configurations for individual users <pre> <Home directory>\leginon.cfg</pre> Example: <pre> C:\Documents and Settings\Leginon User\leginon.cfg </pre> * A skeleton (default) configuration file is available: <pre> C:\Python25\Lib\site-packages\Leginon\config\default.cfg</pre> h2. 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<pre>C:\Python25\Lib\site-packages\sinedon\sinedon.cfg</pre> * Your home directory on Windows:<pre>C:\Documents and Settings\your_name></pre> * the skeleton sinedon configuration file is<pre>C:\Python25\Lib\site-packages\sinedon\examples\sinedon.cfg</pre> h2. 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<pre>C:\Python25\Lib\site-packages\Leginon</pre> * Create a shortcut from start-leginon.py as Leginon and a shortcut from launcher.py as Leginon Client. * Move the two shortcuts into <pre>C:\Documents and Settings\All Users\Start Menu\Programs\Leginon</pre> h2. Additional Software (Optional): TightVNC (http://www.tightvnc.com) h2. Database server Windows Installation h2. 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. h2. 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 h2. 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. h2. 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 <pre>cd Leginon-1.6-ALL svn co http://emg.nysbc.org/svn/comarray/branches/leg1.6 comarray</pre> * Start a command line Window from Start Menu * Install the package with commands such as <pre>cd Your_Download_Place\Leginon-1.6-ALL\comarray c:\\python25\python.exe setup.py install</pre> h2. 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>mto@feico.com</email> and request for adaexp.exe that works with your version of Tecnai user interface program. |_.Name:|_.File:| | exposure adaptor|adaexp.exe| h2. Register adaexep.exe * From the command prompt: <pre>adaexp.exe /regserver</pre> * From the program start menu under pyScope or C:\Python25\Lib\site-packages\pyScope\ <pre>updatecom.py</pre> h2. 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: <pre>[tem] class: tecnai.Tecnai [camera] class: gatan.Gatan</pre> The file contains other examples of microscope and camera drivers that we distribute from NRAMM. h2. Run updatecom.py From a command line window: <pre>cd C:\python25\Lib\Site-Packages\pyScope C:\python25\python.exe updatecom.py</pre> This should generate a few files, including tecnaicom.py, gatancom.py and tietzcom.py, in the same directory. h2. 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: <pre> 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} </pre> * Change the last line to: <pre> return {'x': 2048, 'y': 2048}</pre> h2. Additional Software (Optional): TightVNC (http://www.tightvnc.com) if you get tired of going into the microscope room just to open the column valves. h2. What is next h2. Perform Administration Setup See Next chapter on <link linkend="addusers">Leginon Administration Tools</link>. h2. Create a test project See the chapter on <link linkend="project">Project Management Tools</link>. h2. Perform Microscope Setup and Test run See the chapter on <link linkend="runleg_chapter">Start Leginon</link>. h2. Backup Practices h2. Ideal setup: h2. Regular computer backup To protect your program installation. h2. Full backup of the databases every night The database is the metadata generated by Leginon named "dbemdata" in the installation example. h2. 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. h2. 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: h2. 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. h2. 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. h2. 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.