Project

General

Profile

Web Server Installation » History » Version 7

Amber Herold, 03/16/2010 04:22 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 7 Amber Herold
62 1 Amber Herold
2. Find "httpd.conf".
63 7 Amber Herold
This is /etc/httpd/conf/httpd.conf on CentOS and /etc/php5/apache2/httpd.conf on SuSE
64
65 1 Amber Herold
3. Edit the "httpd.conf" configuration file to look like the following:
66 7 Amber Herold
<pre>
67
DirectoryIndex index.htm index.shtm index.html index.shtml index.php
68
</pre>
69 2 Amber Herold
70 7 Amber Herold
*Note:* It may be possible to edit httpd.conf in YaST2 as well.
71 1 Amber Herold
72 4 Amber Herold
4. Restart the web server.
73 1 Amber Herold
74 3 Amber Herold
<pre>
75 1 Amber Herold
      apachectl restart
76
           or
77
      /etc/init.d/httpd restart     (ON CentOS)
78
           or
79
      /etc/init.d/apache2 restart   (ON SuSE)
80
81
      If you want to start the web server automatically at boot on SuSE
82
83
       SuSE >chkconfig apache2 on
84 3 Amber Herold
</pre>                  
85 1 Amber Herold
86
Check php information
87
88
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).
89
90 7 Amber Herold
<pre>
91 1 Amber Herold
<?php
92
phpinfo();
93
?>
94 7 Amber Herold
</pre>
95 1 Amber Herold
96
Visit this page at http://yourhost/info.php
97
98
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.
99
100
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.
101
102 6 Amber Herold
h2. mrctools Installation
103 1 Amber Herold
104
mrctools are installed as php extension and are required for displaying mrc files live on the web browser.
105
Install php-devel packages on the web server if missing:
106
107
You can check whether php-devel is installed by typing
108
109 7 Amber Herold
<pre>
110 1 Amber Herold
 >phpize
111 7 Amber Herold
</pre>
112 1 Amber Herold
113
Follow the instruction for your specific Linux distribution.
114
115
For example, SUSE users can use YaST or zypper to install them
116
php-GD/FFTW3-devel
117
118
Follow instructions from the download site. These may be included already. If not, mrctools installation will fail.
119
mrctools Installation
120
121
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
122
123 4 Amber Herold
1. Download dbem tools from http://emg.nysbc.org/software/mrctools.
124
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
125 1 Amber Herold
126
Check php information
127
128
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):
129
130
If mrc is not listed, the extension did not get added at the right order.
131
Alternative approach if mrc module does not show up in info.php output
132
133
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/*).
134 7 Amber Herold
135 4 Amber Herold
2. Go to the directory and make a copy of any ini file to use as a template for mrc.ini
136 7 Amber Herold
137 3 Amber Herold
<pre>
138 1 Amber Herold
      >cd [additional_ini_directory]
139
      >cp gd.ini mrc.ini
140
</pre>
141 7 Amber Herold
142 3 Amber Herold
3. Edit mrc.ini to the following
143 7 Amber Herold
144 3 Amber Herold
<pre>
145 1 Amber Herold
      ; comment out next line to disable mrc extension in php
146
      extension=mrc.so
147
</pre>
148 3 Amber Herold
149 5 Amber Herold
4. Comment out mrc extension from php.ini (found in /etc/php.ini/ on a typical PHP installation)
150 7 Amber Herold
151 1 Amber Herold
<pre>
152 3 Amber Herold
      ;extension=mrc.so
153 1 Amber Herold
</pre>
154 7 Amber Herold
155 3 Amber Herold
5. restart your webserver
156 7 Amber Herold
157 1 Amber Herold
<pre>
158
      > /etc/init.d/httpd restart
159
</pre>
160
161 6 Amber Herold
h2. Web Interface (myamiweb) Linux Installation
162
163 1 Amber Herold
php and java scripts for viewing images and Leginon information through the web server.
164
165
166
1. Move the myami/myamiweb directory to your Apache web directory
167 7 Amber Herold
168 6 Amber Herold
Example:
169 3 Amber Herold
<pre>
170 1 Amber Herold
> cd [webdirectory]   // /var/www/html in this example
171 6 Amber Herold
> cp [path_to_myami_download_location]/myami/myamiweb .
172
</pre>
173 7 Amber Herold
174 3 Amber Herold
2. Copy config.php.template to config.php and edit the latter by adding these MySQL parameters:
175 6 Amber Herold
"config.php" should be located in /var/www/html/myamiweb/ on CentOS and /srv/www/htdocs/myamiweb/ on SuSE.
176 7 Amber Herold
177 1 Amber Herold
<pre>
178 6 Amber Herold
<?php
179
// --- define myamiweb tools base --- //
180 1 Amber Herold
181 6 Amber Herold
// This should be changed if the myamiweb directory is located 
182
// in a sub-directory of the Apache web directory.
183
// ex. myamiweb is in /var/www/html/applications/myamiweb/ then
184
// change to  define('BASE_PATH',"applications/myamiweb");
185
define('BASE_PATH',"myamiweb"); 
186 3 Amber Herold
187 6 Amber Herold
// Administrator email address
188
define('ADMIN_EMAIL', "example@scripps.edu");
189 3 Amber Herold
190 6 Amber Herold
// --- Set your MySQL database server parameters
191
define('DB_HOST', "localhost");		// DB Host name 
192
define('DB_USER', "usr_object");	// DB User name
193
define('DB_PASS', "");		        // DB Password
194
define('DB_LEGINON', "leginondb");	// Leginon database name
195
define('DB_PROJECT', "projectdb");	// Project database name
196 1 Amber Herold
</pre>
197
198 6 Amber Herold
3. Test the set-up by visiting http://yourhost/myamiweb