- 论坛徽章:
- 0
|
如何安装mysql+php+apache?
Apache + mod_ssl + php + mod_perl + MySQL + curl
Files to download to /usr/local/src:
MySQL www.mysql.com (binary tar.gz, not source)
openssl www.openssl.org (source tar.gz)
mod_ssl www.modssl.org (source tar.gz, must match apache version below)
apache www.apache.org (source tar.gz)
curl curl.haxx.se (source tar.gz)
php www.php.net (source tar.gz)
mod_perl perl.apache.org (source tar.gz)
Decompress the files:
cd /usr/local/src
tar -zxvf openssl-x.x.x.tar.gz
tar -zxvf mod_ssl-x.x.x-x.x.x.tar.gz
tar -zxvf apache_x.x.x.tar.gz
tar -zxvf curl-x.x.tar.gz
tar -zxvf php-x.x.x.tar.gz
tar -zxvf mod_perl-x.x.x.tar.gz
****************** Install MySQL (binary distro) ******************
cd /usr/local
tar -zxvf /usr/local/src/mysql-x.x.x.tar.gz
cp -R mysql-x.x.x mysql
rm -Rf mysql-x.x.x
groupadd mysql
useradd -g mysql mysql
cd mysql
scripts/mysql_install_db
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/data
chgrp -R mysql /usr/local/mysql
chown -R root /usr/local/mysql/bin
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d
chmod 0755 /etc/rc.d/init.d/mysql.server
---- a quick test ----
/etc/rc.d/init.d/mysql.server start
/usr/local/mysql/bin/mysql
mysql>; quit (ok its working so quit and continue)
/etc/rc.d/init.d/mysql.server stop
****************** OpenSSL ****************************************
cd /usr/local/src/openssl-x.x.x
./config
make
make install
****************** mod_ssl ******************************************
cd /usr/local/src/mod_ssl-x.x.x-x.x.x
./configure --with-apache=/usr/local/src/apache_x.x.x \
--with-ssl=/usr/local/src/openssl-x.x.x \
--prefix=/usr/local/apache \
--enable-module=ssl \
--enable-module=all \
--enable-shared=max \
--enable-rule=EAPI
****************** Apache *********************************************
cd /usr/local/src/apache_x.x.x
make
make certificate (answer questions and select no for encrypting private key with passphrase)
make install
******************** Curl ************************************************
cd /usr/local/src/curl-x.x
./configure --with-ssl
make
make install
install libpng-1.2.5, jpeg-6b, freetype-2.1.4, since gd is boundled with php4.3.*, we don't have to install gd. All the above is needed for photo gallery etc.
********************* PHP ***********************************************
cd /usr/local/src/php-x.x.x
./configure --with-apxs=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/apache/conf
--with-mysql=/usr/local/mysql --with-curl
--with-imap=/home/fengping/apache-mysql-php4/imap-2002b
--with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local
--with-png-dir=/usr --with-freetype-dir=/usr/local
--with-zlib-dir=/usr --enable-ftp --enable-trans-sid
--enable-debug=no --enable-track-vars
(see note 1 before continuing)
make
make install
cp /usr/local/src/php-x.x.x/php.ini-dist /usr/local/apache/conf/php.ini
******************* mod_perl *************************************************
cd /usr/local/src/mod_perl-x.x.x
perl Makefile.PL USE_APXS=1 WITH_APXS=/usr/local/apache/bin/apxs EVERYTHING=1
make
make install
******************* Edit /usr/local/apache/conf/httpd.conf with vi or pico ************************
** Change the following tag to read like:
<IfDefine SSL>;
LoadModule ssl_module libexec/libssl.so
</IfDefine>;
LoadModule php4_module libexec/libphp4.so
LoadModule perl_module libexec/libperl.so
** Change the following tag to read like:
<IfDefine SSL>;
AddModule mod_ssl.c
</IfDefine>;
AddModule mod_php4.c
AddModule mod_perl.c
** Make sure your user and group are set to nobody nobody (or apache apache)
User nobody
Group nobody
** Add the following to this tag **
<IfModule mod_dir.c>;
DirectoryIndex index.html index.php
</IfModule>;
** uncomment the following line**
AddType application/x-httpd-php .php
*************************** Test it ******************************************
/usr/local/apache/bin/apachectl startssl
/usr/local/apache/bin/apachectl stop
************************* Auto startup and shutdown scripts *****************
If you install Webmin you can easily create the scripts for auto starting and stoping the Apache server. In Webmin goto "System tab", then select "Bootup and Shutdown". Next at the bottom you will see "Create a new bootup or shutdown action", click there and enter the commands from above. Set it to start on bootup and your'e done with Apache. You should also enable the mysql.server script to start when the system reboots. Again in Webmin this is made all too easy for you.
I recommend you read more about the individual servers and applications from their websites. |
|