Web Server Installation » History » Revision 20
Revision 19 (Amber Herold, 04/06/2010 11:46 AM) → Revision 20/40 (Amber Herold, 04/06/2010 11:49 AM)
h1. Web Server 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:
Table 4.4. Different File locations and Commands on CentOS vs SUSE
|_.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. Web Server Prerequisites
The myamiweb files are mostly php scripts that run at the web server. PHP, PHP-devel, gd, and fftw3 packages are required before installation of myamiweb and the mrc extension that handles the display of mrc files. 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.
h3. Install PHP, PHP-devel, gd, and fftw3
* Use the installation tools available for your linux distribution.
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>
Likewise, 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.
* Use the following table to find and install the prerequisite packages required for your distribution of linux:
*Prerequisite packages for myamiweb*
|_.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| 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|
*Note:*
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. More information on the gd library can be found "here":http://www.php.net/manual/en/image.requirements.php. If you find that you can only view images as png instead of jpg, it may be that you do not have gd _jpeg_ support installed.
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
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)
</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
1. Install the Apache Web Server with the YaST or yum utility.
2. Find "httpd.conf".
This is /etc/httpd/conf/httpd.conf on CentOS and /etc/php5/apache2/httpd.conf on SuSE
3. Edit the "httpd.conf" configuration file to look like the following:
<pre>
DirectoryIndex index.htm index.shtm index.html index.shtml index.php
</pre>
*Note:* It may be possible to edit httpd.conf in YaST2 as well.
4. 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
Follow [[mrctools installation|these instructions]] to install mrctools which will allow viewing of mrc files in a web browser.
h2. Web Interface (myamiweb) Linux Installation
php and java scripts for viewing images and Leginon information through the web server.
1. Move the myami/myamiweb directory to your Apache web directory
Example:
<pre>
> cd [webdirectory] // /var/www/html in this example
> cp [path_to_myami_download_location]/myami/myamiweb .
</pre>
2. 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/myamiweb/ on CentOS and /srv/www/htdocs/myamiweb/ on SuSE.
<pre>
<?php
// --- define myamiweb tools base --- //
// This should be changed if the myamiweb directory is located
// in a sub-directory of the Apache web directory.
// ex. myamiweb is in /var/www/html/applications/myamiweb/ then
// change to define('BASE_PATH',"applications/myamiweb");
define('BASE_PATH',"myamiweb");
// Administrator email address
define('ADMIN_EMAIL', "example@scripps.edu");
// --- Set your MySQL database server parameters
define('DB_HOST', "localhost"); // DB Host name
define('DB_USER', "usr_object"); // DB User name
define('DB_PASS', ""); // DB Password
define('DB_LEGINON', "leginondb"); // Leginon database name
define('DB_PROJECT', "projectdb"); // Project database name
</pre>
* Enable the processing plug-in by uncommenting out the following line in the file`myamiweb/config.php`
<pre>
addplugin("processing");
</pre>
* Copy `myamiweb/processing/config_processing.php.template` to `myamiweb/processing/config_processing.php`
* Edit `myamiweb/processing/config_processing.php`
<pre>
$PROCESSING_DB_HOST = "your_db_host";
$PROCESSING_DB_USER = "usr_object";
$PROCESSING_DB_PASS = "";
$PROCESSING_DB = "";
</pre>
Remember that the last line should be kept empty as this will be set dynamically.
We will not include the processing host or cluster registration now. It is covered in the last part of this document.
3. Test the set-up by visiting http://yourhost/myamiweb