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
分享到:
相关推荐
CentOs5.5+mysql+nginx+php5.3.3安全安装手册.doc
在进行CentOS 5.5的安装之前,首先需要设置计算机的BIOS启动顺序为光驱启动。设置完成后,将安装光盘放入光驱并重新启动计算机。 **步骤详解:** 1. **启动计算机**:启动计算机后,在启动画面中按回车键继续。 2....
在本文中,我们将深入探讨如何在CentOS 5.4操作系统上使用Postfix和Extmail搭建一个完整的邮件系统。CentOS 5.4是一个基于RHEL(Red Hat Enterprise Linux)的稳定版本,它为服务器环境提供了可靠的基础。Postfix是...
根据你的Web服务器(如Apache或Nginx)配置Extmail的访问路径。 9. 修改权限: 确保Web服务器用户可以读取和写入Extmail的工作目录。 10. 启动Extmail: 通过Web浏览器访问Extmail的URL,首次登录后进行管理员...
Centos52+postfix+extmail Centos5.2 安装邮件系统(postfix+courier-imap+maildrop+courier-authlib+extmail+extman+slockd)
在一个实验环境中,通常需要四台CentOS 5.5(32位)服务器:一台作为LVS主节点(lvsmaster)、一台作为备份节点(lvsbackup),以及两台web服务器(web1和web2)。这些服务器需要配置相同的网络环境,包括IP地址、...
### CentOS 5.5上安装Apache+Php+Mysql+phpMyAdmin+Zend知识点解析 #### 1. CentOS系统简介 - **版本信息**:CentOS 5.5基于Red Hat Enterprise Linux 5.3.0,包含了最新的稳定版本的核心组件如Kernel 2.6.18、...
在本文中,我们将详细介绍如何在 CentOS 5.5 操作系统上使用 YUM 工具安装 Apache、PHP 和 MySQL,创建一个完整的 LAMP (Linux, Apache, MySQL, PHP) 服务器环境。 首先,确保您已经安装了 CentOS 5.5。这个版本...
### CentOS 5.3安装Postfix+Extmail邮件服务器知识点详解 #### 一、环境准备与配置 在开始安装Postfix+Extmail邮件服务器之前,首先需要确保CentOS 5.3系统的环境已经准备好,并进行必要的配置。 ##### 1.1 设置...
"CentOS5.5 DRBD+Heartbeat+NFS 详细配置过程" 本文将详细讲解 CentOS 5.5 下的 DRBD、Heartbeat 和 NFS 的配置过程。这个配置过程主要是为了实现高可用性和数据存储的解决方案。 首先需要安装 CentOS 5.5,並在 ...
在CentOS5.5中,Apache Web服务器的主要配置文件位于`/etc/httpd/conf/`目录下。其中最重要的配置文件是`httpd.conf`,它包含了Web服务器的所有基本设置。 ##### 2.2 网页路径设置 网页文件通常被放置在特定的目录...
### CentOS 5.5 使用 YUM 安装 Apache+PHP5+MySQL #### 一、概览 在本文档中,我们将详细介绍如何在 CentOS 5.5 版本上使用 YUM 包管理器安装并配置一个完整的 LAMP(Linux + Apache + MySQL + PHP)环境。LAMP 是...
【CentOS 5.5 快速搭建Apache+PHP5+MySQL Web服务器】 在Linux操作系统领域,LAMP架构(Linux, Apache, MySQL, PHP)是非常常见的用于构建Web服务器的组合。本文将详细介绍如何在CentOS 5.5系统上快速安装和配置这...
在探讨“CentOS 5.5 32位下载地址”的相关知识点时,我们首先要理解CentOS系统的基本概念,以及其版本与架构的区别,再深入分析下载资源的重要性及获取方式。 ### CentOS概述 CentOS(Community ENTerprise ...
- **配置Web界面**:安装Apache Web服务器并配置虚拟主机,使Extmail Web界面可访问。 - **配置安全策略**:启用Cyrus SASL进行身份验证,配置SpamAssassin和ClamAV进行垃圾邮件和病毒过滤。 ### 六、测试与维护 ...
本文主要介绍了如何在CentOS操作系统上搭建一个包含PHP5.5、Redis、XDebug、Nginx和MySQL的开发环境。以下是该教程中涉及的关键知识点的详细说明: 1. CentOS系统环境准备: - CentOS系统作为服务器操作系统广泛...
在CentOS 5.5操作系统中,安装Nginx、PHP和MySQL的组合是一个常见的任务,这个过程可以分为几个关键步骤。以下是一个详细的指南,涵盖了从安装基础环境到配置服务的整个过程。 首先,我们需要确保系统中安装了必要...
这个教程自己已经在centos5.5上一个个试...该文档包括apache的安装,php的安装和mysql的详细安装,先上传这个文档,后续继续上传centos5.5+nginx+php+mysql文档、负载均衡和mysql主主配置,希望能给大家一点帮助,谢谢
### Centos 5.5 +Freeradius+mysql 安装指导 #### 1. 知识点概述 - **CentOS 5.5**:一款基于Red Hat Enterprise Linux (RHEL)并依照开放源代码规定发布的服务器操作系统,适用于小型企业和个人用户。 - **Free...