centos5.5 apache2.2.15 +extmail



CentOS下添加Apache自启动及系统服务

说明:
Apache安装路径为:/usr/local/apache
Linux的启动级别为5,版本为CentOS5Apache安装完后,发现Apache无法自动启动,查看/etc/rc.d/rc5.d/下,应该没有S打头,httpd结尾的链接文件。
1、将apachectl文件拷贝到/etc/rc.d/init.d 中,然后在/etc/rc.d/rc5.d/下加入链接即可。
命令如下:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd //如果有其他的版本的Apache存在,也可以直接覆盖掉
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd      //建立链接(85的意义后面介绍)
此时Apache就可以自动启动了。
2、运行chkconfig --list,发现没有linux服务列表中httpd,通过chkconfig --add httpd来添加,但是提示:httpd服务不支持 chkconfig。需要编辑/etc/rc.d/init.d/httpd,添加以下注释信息:
# chkconfig: 345 85 15
# descrīption: Apache
第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)。
保存后执行:chkconfig --add httpd,成功添加。
在rc3.d、rc4.d、rc5.d路径中会出现S85httpd的链接文件,其他运行级别路径中会出现K61httpd的链接文件。
3、运行chkconfig --list,httpd在其中。

http://hi.baidu.com/aboutstudy/blog/item/c6662d5423adeb53d0090651.html/cmtid/6e015d3489a25bbad0a2d311

CentOS5.5+Apache2.2.15+Mysql5.1.48+PHP5.2.13 编译安装
CentOS5.5+Apache2.2.15+Mysql5.1.48+PHP5.2.13 编译安装

httpd-2.2.15.tar.gz mysql-5.1.48.tar.gz php-5.2.13.tar.gz
请从各自的官方下载 PHP官方有发布新的5.3.2在centos5.5的gcc环境下编译会错误,所以选择比较稳定的5.2.13版本 1.yum update 检查系统更新
2.yum install gcc gcc-c++ 软件编译环境
3.yum erase httpd 卸载系统自带的httpd (apache2.2.3)
4.yum install zlib-devel libtool ncurses-devel libxml2-devel
(zlib-devel 安装apache需要,否则出错 .libtool安装mysql时候需要.同时附带了autoconf automake imake 编译mysql 5.1.48时候会出错 需要autoconf重新配置一下)
5.编译apache2.2.15

./configure –prefix=/usr/local/apache2 –enable-rewrite=shared –enable-track-vars –enable-cgi –enable-so –enable-mods-shared=all –with-config-file-path=/usr/local/apache2/conf –with-mpm=worker –enable-speling
make
make install
make clean
6.编译httpd.conf . 去掉#ServerName xxxxxx.com 前面的# 没有ServerName启动httpd服务会出错. 给LoadModule unique_id_module modules/mod_unique_id.so前面加上注释以取消加载.默认的centos5.5加载这个会启动不了httpd .
7.运行 grep -v “#” /usr/local/apache2/bin/apachectl > /etc/init.d/httpd
8.运行 chmod +x /etc/init.d/httpd (赋予httpd可以运行的权限)
9.编译/etc/init.d/httpd 在起始位置添加

#!/bin/sh
# chkconfig: 8854 85 15
# description: Apache is a World Wide Web server.
10.运行 chkconfig –add httpd
chkconfig –level 35 httpd on
11.编译mysql 5.1.48
groupadd mysql
useradd -g mysql mysql
在源码文件夹目录运行

autoreconf –force –install
./configure –prefix=/usr/local/mysql –with-charset=utf8 –with-extra-charsets=all –enable-thread-safe-client –enable-assembler –with-readline –with-big-tables –with-plugins=all –with-tcp-port=3310 –with-unix-socket-path=/var/tmp/mysql.sock –with-mysqld-ldflags=-all-static –with-client-ldflags=-all-static
make
make install
make clean
以下命令在mysql安装目录下运行

cd /usr/local/mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db –user=mysql
chown -R root .
chown -R mysql var
12.编译安装php-5.2.13 需要先安装如下包

curl-7.16.1.tar.gz freetype-2.3.12.tar.gz jpegsrc.v8b.tar.gz libpng-1.4.2.tar.gz gd-2.0.35.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz
可在如下地址下载需要的软件包

http://freakshare.net/files/jmoegk3h/centos5-apache2-mysql5-php5.zip.html
http://www.missupload.com/l9byv002i59z/centos5-apache2-mysql5-php5.zip.html
http://cid-39f70fff71231d5a.office.live.com/browse.aspx/PHP/CentOS5

直接./configure 编译安装curl-7.16.1.tar.gz freetype-2.3.12.tar.gz jpegsrc.v8b.tar.gz libpng-1.4.2.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz
安装gd的时候需要./configure –with-png=/usr/local/lib –with-freetype=/usr/local/lib –with-jpeg=/usr/local/lib
最后编译安装 mcrypt-2.6.8.tar.gz 需要指定LD_LIBRARY_PATH路径
LD_LIBRARY_PATH=/usr/local/lib ./configure
编译php开始

./configure –prefix=/usr/local/php5 –with-gd=/usr/local/lib –with-jpeg-dir=/usr/local/lib –with-zlib –with-png-dir=/usr/local/lib –with-freetype-dir=/usr/local/lib –with-mysql=/usr/local/mysql –with-pdo-mysql=/usr/local/mysql –with-iconv –enable-mbstring –with-pear –with-apxs2=/usr/local/apache2/bin/apxs –with-libxml-dir=/usr/lib –with-curl –with-mcrypt=/usr/local/lib –with-mhash=/usr/local/lib –with-config-file-path=/etc –enable-zip –with-config-file-path=/usr/local/php5/etc
make
make install
make clean
cp php.ini-dist /usr/local/php5/etc/php.ini
打开php.ini把dll后缀改为so
13.编译httpd.conf
添加下面的代码到相应的位置
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
index.php
如果启用了SELinux的话还需要执行如下命令
setenforce 0
chcon -t texrel_shlib_t /usr/local/apache2/modules/libphp5.so
service httpd restart
setenforce 1

重新启动之后就可以了
14.关于Zend 直接运行解压包里的pl文件安装即可..
http://www.wuleilei.net/1161.html


http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/index.html
http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/install.html#customize

猜你喜欢

转载自coolwasp.iteye.com/blog/753162
今日推荐