Installing Apache, MySQL, PHP, and Tomcat on RedHat Linux 7.2, 8, 9 or Sun Solaris 8, 9 Daniel Krook August, 2003 I. Pre-install Checklist. 1. Have the root password. 2. Have Internet access. 3. Have GNU tar, gcc, automake, autoconf, ar, and ld in your PATH. You may also need to symlink other GNU tools from the default Solaris names as well. 4. Back everything up. 5. Take basic security precautions, these instructions are intended as a quickstart guide for a development server. 6. It's not necessary, but recommended that you use the prefix '/opt/local' instead of '/usr/local' if you're building on Solaris. II. Download and compile - if necessary - Apache, MySQL, PHP, and Tomcat. 1. Download Apache SOURCE tarball to your home directory and extract. mv the new directory to '/usr/local/apache' and compile. shell> ./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max shell> make shell> make install shell> /usr/local/apache/bin/apachectl start 2. Download MySQL BINARY tarball to your home directory and extract. mv the new directory to '/usr/local/mysql' Now, change to the '/usr/local/mysql' directory and run the following commands: shell> groupadd mysql shell> useradd -g mysql mysql shell> scripts/mysql_install_db shell> chown -R root . shell> chown -R mysql data shell> chgrp -R mysql . shell> bin/mysqld_safe --user=mysql & 3. Download PHP SOURCE tarball to your home directory and extract. mv the new directory to '/usr/local/php' and compile. Use the following build flags: shell> ./configure --prefix=/usr/local --with-apxs=/usr/local/apache/bin/apxs --enable-inline-optimization --enable -magic-quotes --enable-track-vars --enable-bcmath --with-mysql=/usr/local/mysql --with-xml shell> make shell> make install 4. Configure Apache and PHP: PHP will normally make the module changes (but not the AddType) to Apache, but if not: Open up '/usr/local/apache/conf/httpd.conf' and add the following lines: LoadModule php4_module libexec/libphp4.so AddModule mod_php4.c AddType application/x-httpd-php .php Check for typos with configtest and restart Apache shell> /usr/local/apache/bin/apachectl configtest shell> /usr/local/apache/bin/apachectl restart 5. Download Tomcat BINARY tarball to your home directory and extract. mv the new directory to '/usr/local/tomcat' 6. Configure Apache and Tomcat: Download the mod_jk connector to '/usr/local/apache/libexec' for your platform: http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.0/bin/ Create a 'workers.properties' file in '/usr/local/tomcat/conf' with the following information: worker.list=wrk worker.wrk.port=8009 worker.wrk.host=localhost worker.wrk.type=ajp13 Open up '/usr/local/apache/conf/httpd.conf' and add the following lines and customize as necessary: LoadModule jk_module libexec/mod_jk-1.3-noeapi.so AddModule mod_jk.c JkWorkersFile /usr/local/tomcat/conf/workers.properties Alias /examples /usr/local/tomcat/webapps/examples JkMount /examples/servlet/* wrk JkMount /*.jsp wrk AllowOverride None deny from all Start up Apache, then Tomcat shell> /usr/local/apache/bin/apachectl restart shell> /usr/local/tomcat/bin/start.sh (don't forget to set JAVA_HOME to your jsdk location) III. Confirm that everything is running. 1. Open up http://localhost/ and have a look see. While Apache and Tomcat will listen on port 80, you may need to kickstart Tomcat on port 8080 before it will cooperate with Apache on 80: http://localhost:8080/