Project

General

Profile

Web Server Installation » History » Version 6

Amber Herold, 03/16/2010 04:19 PM

1 1 Amber Herold
h1. Web Server Installation
2
3
4 6 Amber Herold
5 1 Amber Herold
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).
6
Differences between Linux flavors
7
8
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:
9
10
Table 4.4. Different File locations and Commands on CentOS vs SUSE
11
File or Command Head	CentOS	SuSE
12
php.ini	/etc/	/etc/php5/apache2/
13
httpd.conf	/etc/httpd/conf/	/etc/php5/apache2/
14
default document_root	/var/www/html/	/srv/www/htdocs/
15
apache start/stop/restart command head	/etc/init.d/httpd	/etc/init.d/apache2
16
mysql start/stop/restart command head	/etc/init.d/mysqld	/etc/init.d/mysql
17
Prerequisites for dbemtools, projecttools, and mrctools extension
18
19 2 Amber Herold
The myamiweb files are mostly php scripts that run at the web server. The following 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.
20 1 Amber Herold
21 2 Amber Herold
Table 4.5.Prerequisite packages for myamiweb
22 1 Amber Herold
Name:	Download site:	yum package name	SuSE rpm name
23
Apache	www.apache.org	httpd	apache2
24
php	www.php.net	php	php
25
php-devel*	rpmfind.net/linux/RPM/Development_Languages_PHP.html	php-devel	php-devel
26
php-gd (including GD library, its development libraries and header *)	www.php.ned/gd (Use gd2)	php-gd, gd-devel	php-gd,gd-devel
27
fftw3 library (including development libraries and header *)	www.fftw.org (Use fftw3.x)	fftw3-devel	fftw3-devel
28
29
* 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.
30
Installation tools
31
32
Use the installation tools available for your linux distribution.
33
34 2 Amber Herold
    * For example, Use yum utility to install.
35
    * For example, Use the SuSE Linux YaST2 utility or zypper (openSuSE 10.2 and above) to install.
36
    * A list of required CENTOS rpms and instruction can be found at dbemtools bulletin board at leginon.org.
37 1 Amber Herold
38
PHP, PHP-devel, gd, and fftw3
39
40
Install the packages using your installation tools if available. For example, to install gd as php extension you may use
41
42
CentOS> yum install php-gd
43
SuSE10.2 and above> zypper install php-gd
44
45 6 Amber Herold
h2. Configure php.ini
46 1 Amber Herold
47
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:
48
49
register_argc_argv = On
50
51
short_open_tag = On
52
53
max_execution_time = 300     ; Maximum execution time of each script, in seconds
54
max_input_time = 300     ; Maximum amount of time each script may spend parsing request data
55
memory_limit = 256M      ; Maximum amount of memory a script may consume (8MB)
56
57
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.
58
Apache Web Server
59
60 4 Amber Herold
1. Install the Apache Web Server with the YaST or yum utility.
61
2. Find "httpd.conf".
62 1 Amber Herold
      This is /etc/httpd/conf/httpd.conf on CentOS and /etc/php5/apache2/httpd.conf on SuSE
63 4 Amber Herold
3. Edit the "httpd.conf" configuration file to look like the following:
64 1 Amber Herold
65 2 Amber Herold
      DirectoryIndex index.htm index.shtm index.html index.shtml index.php
66 1 Amber Herold
67
      (Note: It may be possible to edit httpd.conf in YaST2 as well.)
68 4 Amber Herold
4. Restart the web server.
69 1 Amber Herold
70 3 Amber Herold
<pre>
71 1 Amber Herold
      apachectl restart
72
           or
73
      /etc/init.d/httpd restart     (ON CentOS)
74
           or
75
      /etc/init.d/apache2 restart   (ON SuSE)
76
77
      If you want to start the web server automatically at boot on SuSE
78
79
       SuSE >chkconfig apache2 on
80 3 Amber Herold
</pre>                  
81 1 Amber Herold
82
Check php information
83
84
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).
85
86
<?php
87
phpinfo();
88
?>
89
90
Visit this page at http://yourhost/info.php
91
92
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.
93
94
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.
95
96 6 Amber Herold
h2. mrctools Installation
97 1 Amber Herold
98
mrctools are installed as php extension and are required for displaying mrc files live on the web browser.
99
Install php-devel packages on the web server if missing:
100
101
You can check whether php-devel is installed by typing
102
103
 >phpize
104
105
Follow the instruction for your specific Linux distribution.
106
107
For example, SUSE users can use YaST or zypper to install them
108
php-GD/FFTW3-devel
109
110
Follow instructions from the download site. These may be included already. If not, mrctools installation will fail.
111
mrctools Installation
112
113
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/info.php
114
115 4 Amber Herold
1. Download dbem tools from http://emg.nysbc.org/software/mrctools.
116
2. Follow the instruction at http://emg.nysbc.org/software/mrctools/mrc_so.php for installation and testing. The next session about checking php information can also help debugging the installation
117 1 Amber Herold
118
Check php information
119
120
Visit or refresh http://yourhost/info.php which you created earlier. It should have a section looking like this (The version should correspond to what you've just installed):
121
122
If mrc is not listed, the extension did not get added at the right order.
123
Alternative approach if mrc module does not show up in info.php output
124
125 4 Amber Herold
1. find in the info.php web page the location of "additional .ini files parsed" in the first table (such as /etc/php.d/conf.d/*).
126
2. Go to the directory and make a copy of any ini file to use as a template for mrc.ini
127 3 Amber Herold
<pre>
128 1 Amber Herold
      >cd [additional_ini_directory]
129
      >cp gd.ini mrc.ini
130 3 Amber Herold
</pre>
131 4 Amber Herold
3. Edit mrc.ini to the following
132 3 Amber Herold
<pre>
133 1 Amber Herold
      ; comment out next line to disable mrc extension in php
134
      extension=mrc.so
135 3 Amber Herold
</pre>
136 5 Amber Herold
137 4 Amber Herold
4. Comment out mrc extension from php.ini (found in /etc/php.ini/ on a typical PHP installation)
138 3 Amber Herold
<pre>
139 1 Amber Herold
      ;extension=mrc.so
140 3 Amber Herold
</pre>
141 4 Amber Herold
5. restart your webserver
142 1 Amber Herold
<pre>
143
      > /etc/init.d/httpd restart
144
</pre>
145
146 6 Amber Herold
h2. Web Interface (myamiweb) Linux Installation
147
148 1 Amber Herold
php and java scripts for viewing images and Leginon information through the web server.
149
150
151 6 Amber Herold
1. Move the myami/myamiweb directory to your Apache web directory
152
Example:
153 3 Amber Herold
<pre>
154 6 Amber Herold
> cd [webdirectory]   // /var/www/html in this example
155
> cp [path_to_myami_download_location]/myami/myamiweb .
156 3 Amber Herold
</pre>
157 6 Amber Herold
2. Copy config.php.template to config.php and edit the latter by adding these MySQL parameters:
158
"config.php" should be located in /var/www/html/myamiweb/ on CentOS and /srv/www/htdocs/myamiweb/ on SuSE.
159 1 Amber Herold
<pre>
160 6 Amber Herold
<?php
161
// --- define myamiweb tools base --- //
162 1 Amber Herold
163 6 Amber Herold
// This should be changed if the myamiweb directory is located 
164
// in a sub-directory of the Apache web directory.
165
// ex. myamiweb is in /var/www/html/applications/myamiweb/ then
166
// change to  define('BASE_PATH',"applications/myamiweb");
167
define('BASE_PATH',"myamiweb"); 
168 3 Amber Herold
169 6 Amber Herold
// Administrator email address
170
define('ADMIN_EMAIL', "example@scripps.edu");
171 3 Amber Herold
172 6 Amber Herold
// --- Set your MySQL database server parameters
173
define('DB_HOST', "localhost");		// DB Host name 
174
define('DB_USER', "usr_object");	// DB User name
175
define('DB_PASS', "");		        // DB Password
176
define('DB_LEGINON', "leginondb");	// Leginon database name
177
define('DB_PROJECT', "projectdb");	// Project database name
178 1 Amber Herold
</pre>
179
180 6 Amber Herold
3. Test the set-up by visiting http://yourhost/myamiweb