感触万千的前言:
我不是系统工程师,也不是php程序员,用这个东西基本上从头开始整,其中艰辛不言自明。。
每个装过ganglia的程序员你都伤不起。。
一、安装apache2 + php5 +mysql5
前期准备
一定要记得找个好的源能省你好多事
wget之前别忘了看一下代理
1、安装mysql-devel
server、client、devel、share
sudo yum –y install mysql-devel
sudo /etc/init.d/mysqld start
mysqladmin -u root password ‘123456’
mysql –u root -p
GRANT ALL PRIVILEGES ON *.* TO 'cdh'@'%' IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
2、安装apache(注意php5.3.6和apache2.2.17的版本号)
sudo yum –y install apr-util-devel apr-devel apr-util
wget http://labs.renren.com/apache-mirror/httpd/httpd-2.2.17.tar.gz
tar –zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17.tar.gz
./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite
make
sudo make install
3、安装PHP5(注意php5.3.6和apache2.2.17的版本号)
#安装php5的依赖
sudo yum –y install freetype-devel libjpeg-turbo-devel libpng-devel gd-devel libxml2-devel
wget http://cn.php.net/get/php-5.3.6.tar.gz/from/this/mirror
tar –zxvf php-5.3.6.tar.gz
cd php-5.3.6
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --with-mysql=/usr
make
sudo make install
#将php5的库复制到apache的modules里
sudo cp –p .libs/libphp5.so /usr/local/apache2/modules
sudo chown cdh:cdh /usr/local/apache2/modules/libphp5.so
#复制php5配置文件
sudo cp php.ini-development /usr/local/php/lib/php/php.ini
4、修改http.conf 兼容php5
sudo vim /usr/local/apache2/conf/httpd.conf
#AddType application/x-tar .tgz 下加一行
AddType application/x-httpd-php .php
#LoadModule php5_module modules/libphp5.so
把上面的#号去掉
DirectoryIndex index.html index.html.var
在后面加 index.php
# don't use Group #-1 on these systems!
把下面的用户名和组改为
User apache
Group apache
#ServerName
把#去掉,后面的IP改成你的IP
DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改为你存放网页文件的路径
AddDefaultCharset iso8859-1
把后面的iso8859-1改为gb2312 或者是干脆off
更详细的请参考http://article.21e.cn
5、声明apache系统服务
sudo vim /etc/rc.d/init.d/httpd
#修改httpd启动脚本如下
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
sudo chmod 755 /etc/rc.d/init.d/httpd
sudo chkconfig --add httpd
sudo chkconfig --level 35 httpd on