安装Mysql Apache2 PHP

发表于:2007-07-04来源:作者:点击数: 标签:
安装Rd9时一定要安装gdbm gdbm-devel openssl openssl-devel stunnel krb5-devel(这些是安装Qmail必须的组件) 也可选安装perl-Time-HiRes perl-Digest-SHA1 perl-HTML-Parser perl-HTML-Tagset(这些是SpamAssassin需要的组件) 安装完RD9后可以用rpm -q s

安装Rd9时一定要安装gdbm gdbm-devel openssl openssl-devel stunnel krb5-devel(这些是安装Qmail必须的组件)

也可选安装perl-Time-HiRes perl-Digest-SHA1 perl-HTML-Parser perl-HTML-Tagset(这些是SpamAssassin需要的组件)

安装完RD9后可以用rpm -q software 来验证是否安装了这些组件。下面开始安装Mysql Apache2 PHP

################################
# Install mysql
################################
groupadd mysql
useradd -g mysql mysql

cd /usr/local
tar -xvzf /usr/local/src/mysql-standard-4.0.21-pc-linux-i686.tar.gz
ln -s mysql-standard-4.0.21-pc-linux-i686 mysql

cd mysql
scripts/mysql_install_db

cd ..
chown -R root.mysql mysql-standard-4.0.21-pc-linux-i686
chmod -R 640 mysql
chmod -R u+X,g+X mysql
chmod -R ug+x mysql/bin
chmod -R g+w mysql/data
chmod -R u+x mysql/scripts

cp /usr/local/mysql/support-files/my-medium.cnf /usr/local/mysql/data/my.cnf
chgrp mysql /usr/local/mysql/data/my.cnf

cd /usr/local/mysql
bin/safe_mysqld --user=mysql &

# Set the root password
/usr/local/mysql/bin/mysqladmin -u root password 'secret'

# Configure MySQL so it is running all the time from bootup onwards
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql
chmod 744 /etc/rc.d/init.d/mysql
chkconfig --add mysql

################################
# Install apache
################################
cd /usr/local/src
chown -R root.root httpd_2.0.51.tar.gz
tar -xvzf httpd_2.0.51.tar.gz

groupadd vchkpw
useradd -g vchkpw  vpopmail

cd /usr/local/src/httpd_2.0.51

./configure
--prefix=/usr/local/apache
--enable-module=so
--enable-module=rewrite
--enable-shared=rewrite
--server-uid=vpopmail
--server-gid=vchkpw

make
make install

################################
# Install php
################################
cd /usr/local/src
tar -xvzf php-4.3.7.tar.gz
chown -R root.root php-4.3.7.tar.gz

cd php-4.3.7
./configure
--with-mysql=/usr/local/mysql
--with-apxs2=/usr/local/apache/bin/apxs

make
make install

cp php.ini-dist /usr/local/lib/php.ini

vi /usr/local/lib/php.ini
######## Modify the /usr/local/lib/php.ini file and make sure it contains the following commands. ########
max_execution_time=60
memory_limit=10M
post_max_size=8M
upload_max_filesize=8M
file_uploads=On
log_errors=On
error_log=/usr/local/apache/logs/php_error_log
######## End ########

chown -R root.vchkpw /usr/local/lib/php
chmod -R g-w,o-rwx /usr/local/lib/php

vi /usr/local/apache/conf/httpd.conf
######## Modify the /usr/local/apache/conf/httpd.conf file and make sure it contains the following commands. ########
User vpopmail
Group vchkpw
ServerAdmin postmaster@xxx.com
ServerName mail.xxx.com
# Following line should be present already as it would be inserted by the PHP make
# Make sure you move it outside of the IfDefineSSL section if the make (incorrectly) put it there
LoadModule php4_module libexec/libphp4.so
# uncomment (or add) the following line
AddType application/x-httpd-php .php
# Add the index.php into this line so apache will use this file as a default in addition to index.html
DirectoryIndex index.php index.html
######## End ########

rm -Rf /usr/local/apache/htdocs/*
rm -f /usr/local/apache/index.html.*
rm -Rf /usr/local/apache/cgi-bin/*

cd /usr/local
chown -R root.root apache
chmod 755 apache
chmod -R 600 apache/*
chmod -R u+X apache

cd apache
chmod -R u+x bin
chgrp -R vchkpw cgi-bin
chmod -R u+x,g+x cgi-bin
chgrp -R vchkpw icons
chmod -R g+rX icons
chgrp -R vchkpw logs
chmod g+wX logs
chgrp -R vchkpw htdocs
chmod -R g+rX htdocs

# Run apache every time at bootup.
rm -rf /etc/rc.d/init.d/httpd

vi /etc/rc.d/init.d/httpd
######## Create the /etc/rc.d/init.d/httpd file with the following commands. ########
#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid


# Source function library.
./etc/rc.d/init.d/functions

# See how we were called.
case "" in
start)
echo -n "Starting httpd: "
daemon /usr/local/apache/bin/httpd
echo
touch /var/lock/subsys/httpd
;;
stop)
echo -n "Shutting down http: "
killproc httpd
echo
rm -f /var/lock/subsys/httpd
rm -f /var/run/httpd.pid
;;
status)
status httpd
;;
restart)
stop
start
;;
reload)
echo -n "Reloading httpd: "
killproc httpd -HUP
echo
;;
*)
echo "Usage: "
exit 1
esac

exit 0
######## End ########

chown root.root /etc/rc.d/init.d/httpd
chmod 744 /etc/rc.d/init.d/httpd
chkconfig --add httpd
到这里就安装完了,可以用ps -aux |grep software来验证这些服务是否都已经启动了

Apache2 可以用 /usr/local/apache/apachectl start(stop|status|restart..)来操作。

原文转自:http://www.ltesting.net