1,apache
a)apache官网下载 .tar.gz 结尾的文件,并且通过ftp传送到liunx下自建的目录里面。
b)解压 tar -zxvf httpd-2.0.54.tar.gz,并mv将其重命名为 apach(随意)
c) ./configure --prefix=/usr/local/http2
--enable-modules=all
--enable-mods-shared=all
--enable-so
运行是出错。
........................
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/httpd-2.2.11/srclib/apr':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
configure failed for srclib/apr查看了一下原来是错误开始于srclib/apr文件,检查gcc编译器时提示没发现并且在系统环境变量$PATH中没有合适的c编译器,以是使用yum -y install gcc来安装gcc编译器/或者用rpm包安装,就可继续安装了
再运行,发现
checking whether to enable mod_deflate... checking dependencies
checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures缺少zlib,yum install zlib-devel –y
make && make install
等待安装
完毕后
cd /usr/local/apache/bin/conf 备份配置文件 cp –a httpd.conf httpd.conf.back
chkconfig --list httpd //查看httpd服务是否已存在
chkconfig httpd off //关闭系统自带了httpd的服务,如果存在httpd服务
service httpd status //查看自带httpd服务状态
接着启动apache
/usr/local/apache/bin/apachect1 –k start
发现无法启动
httpd: apr_sockaddr_info_get() failed for web154
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName解决:将apache的配置文件
ServerName localhost:80再次启动。ok#ps aux | grep httpd //linux下查看apache进程用wget http://127.0.0.1 后无法链接,检查后是防火墙80端口没有开。通过 setup 配置下80端口tcp协议在启动还是没有启动,检查 apache 的错误日志发现[Thu Sep 25 16:49:57 2014] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "web154"
Configuration Failed在 /etc/hosts 下追加一行 127.0.0.1 web154 localhost重启,okcp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache //拷贝apache启动脚本vi /etc/rc.d/init.d/apache // 这里是编辑apache启动脚本在开头的#!/bin/sh 下面加上
#chkconfig: 2345 85 15chkconfig --add apache //添加apache服务
chkconfig --list apache //列出apache服务
ps -aux | grep httpd //查看是否存在httpd服务
至此,apache安装ok