Project

General

Profile

Web Server Installation » History » Version 29

Amber Herold, 04/15/2010 03:12 PM

1 1 Amber Herold
h1. Web Server Installation
2
3 29 Amber Herold
# [[Differences between Linux flavors]]
4
# [[Install Web Server Prerequisites]]
5
# [[Configure php.ini]]
6
# [[Install Apache Web Server]]
7
# [[Check php information]]
8
# [[Install the MRC PHP Extension]]
9
# [[Install the Web Interface]]
10
# [[Potential Problems]]
11 6 Amber Herold
12 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).
13
14 9 Amber Herold
h2. Differences between Linux flavors
15
16 1 Amber Herold
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:
17
18 25 Amber Herold
Table Different File locations and Commands on CentOS vs SUSE
19 1 Amber Herold
20 9 Amber Herold
|_.File or Command Head|_.CentOS|_.SuSE|
21
| php.ini|/etc/| /etc/php5/apache2/|
22
| httpd.conf|/etc/httpd/conf/|/etc/php5/apache2/|
23
| default document_root|/var/www/html/|/srv/www/htdocs/|
24
| apache start/stop/restart command head|/etc/init.d/httpd|/etc/init.d/apache2|
25
| mysql start/stop/restart command head|/etc/init.d/mysqld|/etc/init.d/mysql|
26
27 15 Amber Herold
h2. Web Server Prerequisites
28 9 Amber Herold
29 15 Amber Herold
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.
30 1 Amber Herold
31
32 15 Amber Herold
h3. Install PHP, PHP-devel, gd, and fftw3
33
34
35 16 Amber Herold
* Use the installation tools available for your linux distribution.
36
37 15 Amber Herold
For example, to install gd as php extension you may use
38
39
<pre>
40
CentOS> yum install php-gd
41
SuSE10.2 and above> zypper install php-gd
42 1 Amber Herold
</pre>
43
44 16 Amber Herold
Likewise, use the SuSE Linux YaST2 utility or zypper (openSuSE 10.2 and above) to install.
45
"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.
46 15 Amber Herold
47 17 Amber Herold
* Use the following table to find and install the prerequisite packages required for your distribution of linux:
48 15 Amber Herold
49 17 Amber Herold
*Prerequisite packages for myamiweb*
50 15 Amber Herold
51 1 Amber Herold
|_.Name:|_.Download site:|_.yum package name|_.SuSE rpm name|
52 11 Amber Herold
| Apache| "www.apache.org":http://www.apache.org| httpd| apache2|
53 1 Amber Herold
| php| "www.php.net":http://www.php.net| php| php|
54
| php-devel*| "rpmfind.net/linux/RPM/Development_Languages_PHP.html":http://rpmfind.net/linux/RPM/Development_Languages_PHP.html| php-devel| php-devel|
55
| 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|
56 11 Amber Herold
| fftw3 library (including development libraries and header *)| "www.fftw.org":http://www.fftw.org  (Use fftw3.x)| fftw3-devel| fftw3-devel|
57 1 Amber Herold
58 20 Amber Herold
*Note:*
59 19 Amber Herold
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.
60 11 Amber Herold
61 1 Amber Herold
62 6 Amber Herold
h2. Configure php.ini
63 1 Amber Herold
64 22 Amber Herold
Edit the following items 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:
65 1 Amber Herold
66
<pre>
67 22 Amber Herold
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
68
69 1 Amber Herold
register_argc_argv = On
70
71
short_open_tag = On
72
73
max_execution_time = 300     ; Maximum execution time of each script, in seconds
74
max_input_time = 300     ; Maximum amount of time each script may spend parsing request data
75
memory_limit = 256M      ; Maximum amount of memory a script may consume (8MB)
76 11 Amber Herold
</pre>
77 1 Amber Herold
78
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.
79
80 11 Amber Herold
h2. Apache Web Server
81
82 1 Amber Herold
1. Install the Apache Web Server with the YaST or yum utility.
83
84
2. Find "httpd.conf".
85 11 Amber Herold
 This is /etc/httpd/conf/httpd.conf on CentOS and /etc/php5/apache2/httpd.conf on SuSE
86 1 Amber Herold
87 23 Amber Herold
3. Edit the "httpd.conf" configuration file with the following:
88 11 Amber Herold
 <pre>
89 1 Amber Herold
 DirectoryIndex index.htm index.shtm index.html index.shtml index.php
90 23 Amber Herold
91
 HostnameLookups On
92 1 Amber Herold
 </pre>
93 7 Amber Herold
94 23 Amber Herold
*Note:* It may be possible to edit httpd.conf in YaST2 as well.
95 4 Amber Herold
96 3 Amber Herold
4. Restart the web server.
97 1 Amber Herold
98
<pre>
99 24 Amber Herold
apachectl restart
100
     or
101
/etc/init.d/httpd restart     (ON CentOS)
102
     or
103
/etc/init.d/apache2 restart   (ON SuSE)
104
     or
105
/sbin/service httpd restart
106 11 Amber Herold
</pre>                  
107 1 Amber Herold
108
      If you want to start the web server automatically at boot on SuSE
109
110 11 Amber Herold
<pre>
111 24 Amber Herold
SuSE >chkconfig apache2 on
112 11 Amber Herold
</pre>
113 1 Amber Herold
114 11 Amber Herold
h2. Check php information
115 1 Amber Herold
116
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).
117
118
<pre>
119
<?php
120 7 Amber Herold
phpinfo();
121 1 Amber Herold
?>
122
</pre>
123
124
Visit this page at http://yourhost/info.php
125
126
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.
127
128
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.
129 6 Amber Herold
130 11 Amber Herold
!http://emg.nysbc.org/software/leginon/images/images/phpini.png!
131
132
133 26 Amber Herold
h2. MRC PHP Extension Installation
134 7 Amber Herold
135 21 Amber Herold
Follow [[MRC_PHP_Extension_Installation_and_Testing|these instructions]] to install mrctools which will allow viewing of mrc files in a web browser.
136 13 Amber Herold
137 6 Amber Herold
h2. Web Interface (myamiweb) Linux Installation
138 1 Amber Herold
139 25 Amber Herold
Install php and java scripts for viewing images and Leginon information through the web server.
140
If you are installing your web server on a different machine than your processing server, 
141
you need to download the myami code.
142
*TODO:* add a link to the myami code 
143 1 Amber Herold
144
145 7 Amber Herold
1. Move the myami/myamiweb directory to your Apache web directory
146 6 Amber Herold
147 3 Amber Herold
Example:
148 1 Amber Herold
<pre>
149 6 Amber Herold
> cd [webdirectory]   // /var/www/html in this example
150
> cp [path_to_myami_download_location]/myami/myamiweb .
151 7 Amber Herold
</pre>
152 3 Amber Herold
153 6 Amber Herold
2. Copy config.php.template to config.php and edit the latter by adding these MySQL parameters:
154 7 Amber Herold
"config.php" should be located in /var/www/html/myamiweb/ on CentOS and /srv/www/htdocs/myamiweb/ on SuSE.
155 1 Amber Herold
156 6 Amber Herold
<pre>
157
<?php
158 1 Amber Herold
// --- define myamiweb tools base --- //
159 6 Amber Herold
160
// This should be changed if the myamiweb directory is located 
161
// in a sub-directory of the Apache web directory.
162
// ex. myamiweb is in /var/www/html/applications/myamiweb/ then
163
// change to  define('BASE_PATH',"applications/myamiweb");
164 3 Amber Herold
define('BASE_PATH',"myamiweb"); 
165 6 Amber Herold
166
// Administrator email address
167 3 Amber Herold
define('ADMIN_EMAIL', "example@scripps.edu");
168 6 Amber Herold
169
// --- Set your MySQL database server parameters
170
define('DB_HOST', "localhost");		// DB Host name 
171
define('DB_USER', "usr_object");	// DB User name
172
define('DB_PASS', "");		        // DB Password
173
define('DB_LEGINON', "leginondb");	// Leginon database name
174 1 Amber Herold
define('DB_PROJECT', "projectdb");	// Project database name
175
</pre>
176 8 Amber Herold
177
* Enable the processing plug-in by uncommenting out the following line in the file`myamiweb/config.php`
178
179
<pre>
180
addplugin("processing");
181
</pre>
182
183
* Copy `myamiweb/processing/config_processing.php.template` to `myamiweb/processing/config_processing.php`
184
* Edit `myamiweb/processing/config_processing.php`
185
186
<pre>
187
$PROCESSING_DB_HOST = "your_db_host";
188
$PROCESSING_DB_USER = "usr_object";
189
$PROCESSING_DB_PASS = ""; 
190
$PROCESSING_DB = "";
191
</pre>
192
193
Remember that the last line should be kept empty as this will be set dynamically.
194
We will not include the processing host or cluster registration now. It is covered in the last part of this document.
195 6 Amber Herold
196 1 Amber Herold
3. Test the set-up by visiting http://yourhost/myamiweb
197 27 Amber Herold
198
h3. Potential problems 
199
200
h4. Firewall settings 
201
202
You may need to configure your firewall to allow incoming HTTP (port 80) and MySQL (port 3306) traffic:
203
204
<pre>
205
$ system-config-securitylevel
206
</pre>
207
208
h4. Security-enhanced linux 
209
210
"Security-enhanced linux (SELinux)":http://en.wikipedia.org/wiki/Security-Enhanced_Linux  may be preventing your files from loading. To fix this run the following command:
211
212
<pre>
213
$ sudo /usr/bin/chcon -R -t httpd_sys_content_t /var/www/html/
214
</pre>
215
216
see "this website":http://docs.fedoraproject.org/selinux-apache-fc3/sn-simple-setup.html  for more details on SELinux