httpd-2.4.1 安装笔记

参考 Apache遇到的问题:APR not found

#./configure --prefix……检查编辑环境时出现:

checking for APR... no
configure: error: APR not found .  Please read the documentation.

可以用./configure –help | grep apr 查看帮助。
--with-included-apr     Use bundled copies of APR/APR-Util
--with-apr=PATH         prefix for installed APR or the full path to apr-config
--with-apr-util=PATH    prefix for installed APU or the full path to
安装APR(Apache Portable Runtime )
下载:http://apr.apache.org/download.cgi

#cd /tmp/52lamp/ //源码存放位置
#tar -zxvf apr-1.4.2.tar.gz //unzip -o apr-1.4.2.zip
#cd apr-1.4.2
#./configure
#make
#make install

再次检查编译环境出现

checking for APR-util... no
configure: error: APR-util not found .  Please read the documentation.

#./configure –help | grep apr-util
--with-apr-util=PATH    prefix for installed APU or the full path to

下载:http://download.chinaunix.net/download/0001000/472.shtml
#tar -zxvf apr-util-1.3.9.tar.gz
#cd apr-util-1.3.9
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install

./configure仍提示APR-util not found,增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util后出现
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

#./configure –help | grep pcre
--with-pcre=PATH        Use external PCRE library

下载:http://sourceforge.net/projects/pcre
#unzip -o pcre-8.10.zip
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install

继续安装Apache/httpd,./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了

注意:Apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。

#echo $?
0

#make
#make install

复制Apache启动文件
#cp /usr/local/httpd/bin/apachectl /sbin/

启动Apache
#apachectl start

设置Apache开机自启动
#vi /etc/rc.d/rc.local
增加一行 /sbin/apachectl start

或者将httpd服务添加到ntsysv服务管理工具
#apachectl stop //关闭Apache以免不必要的麻烦
#cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
#vi /etc/rc.d/init.d/httpd
修改为
#!/bin/sh
#
#chkconfig: 345 85 15 //#不能省略,注意空格
#description: httpd for 52lamp 20101016 21:54 //任意字符串
#
......

第二行中345的含义:
#       0 - operation completed successfully
#       1 -
#       2 - usage error
#       3 - httpd could not be started
#       4 - httpd could not be stopped
#       5 - httpd could not be started during a restart

修改有关权限
#cd /etc/rc.d/init.d/
#chmod a+x httpd
#chkconfig --add httpd

#ntsysv
httpd已经在列表中,按F1可以看到刚才编写的服务描述httpd for 52lamp 20101016 21:54。

#apachectl start
#ps -e |grep httpd
23247 ?        00:00:00 httpd
23248 ?        00:00:00 httpd
23249 ?        00:00:00 httpd
23251 ?        00:00:00 httpd
23252 ?        00:00:00 httpd

在浏览器中输入127.0.0.1,看起来一切正常;但是局域网内其他电脑不能访问!

#service iptables stop

如果不想关闭防火墙,放开80端口即可。

#vi /etc/sysconfig/iptables
增加一行-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#service iptables restart //重启防火墙

现在一切OK

 

 

=========================================

linux apache 全面安装

一、安装所需软件
a.编译相关
安装前请确认机器上已安装有gcc、gcc++、ncurses-devel、flex、bison、autoconf如没有安装可使用
yum install gcc
yum install gcc-c++
yum install ncurses-devel
yum install flex
yum install bison
yum install autoconf

b.软件相关
curl-7.15.0.tar.gz
freetype-2.2.1.tar.gz
httpd-2.0.58.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.12.tar.tar
libxml2-2.6.26.tar.gz(此软件也为选装,但要使用,必须于php之前安装,不然要重编php)
mysql-5.0.22.tar.gz
php-5.1.4.tar.gz
zlib-1.2.3.tar.gz

(以下软件选装)
ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
eaccelerator-0.9.5-rc1.tar.bz2

ffmpeg安装使用
ffmpeg-0.4.9-p20050226.tbz2
ffmpeg-php-0.5.0.tbz2
lame-3.97.tar.gz
libogg-1.1.3.tar.gz
libvorbis-1.1.2.tar.gz

subversion-1.4.0.tar.gz
subversion-deps-1.4.0.tar.gz


二、开始安装
1.安装freetype
tar -zxvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
./configure --prefix=/usr/server/freetype2
make && make install
make clean

2.安装zlib(此软件很多软件都要使用到,为方便使用默认路径)
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make && make install
make clean

3.安装curl
tar -zxvf curl-7.15.0.tar.gz
cd curl-7.15.0
./configure --prefix=/usr/server/curl --with-zlib=/usr/server/zlib
make && make install
make clean

4.安装jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/server/jpeg --enable-static --enable-shared
mkdir -p /usr/server/jpeg/{bin,include,lib,man/man1} #此处建立目录,jpeg安装时不能自动建立目录
make && make install
make clean

5.安装libpng-1.2.12.tar.tar
tar -zxvf libpng-1.2.12.tar.tar
cd libpng-1.2.12
cd scripts
cp ./makefile.linux ../makefile
cd ..
./configure --prefix=/usr/server/libpng
make && make install
make clean

6.安装libxml2-2.6.26.tar.gz
tar -zxvf libxml2-2.6.26.tar.gz
cd libxml2-2.6.26
./configure --prefix=/usr/server/libxml2
make && make install
make clean

7.安装httpd-2.0.58.tar.gz
说明:
--enable-mods-shared=most 编译出默认所有so文件
--enable-proxy 编译出代理so,不加的话apache默认是没有这个so的,就算加了上一个选项
--with-mpm=worker 以多线程方式运行(因PHP本身对多线程支持不好,建议不使用此选项)

tar -zxvf httpd-2.0.58.tar.gz
cd httpd-2.0.58
./buildconf
./configure --with-mpm=worker --enable-cache --enable-disk-cache--enable-mem-cache --enable-file-cache --enable-nonportable-atomics--enable-mods-shared=most --prefix=/usr/server/httpd --enable-proxy
make && make install
make clean

以上命令也可这样:

./configure --prefix=/usr/local/apache

make

make install

8.安装mysql-5.0

.22.tar.gz
说明:
--sysconfdir=/usr/server/conf 指定my.cnf路径

tar -zxvf mysql-5.0.22.tar.gz 
cd mysql-5.0.22
./configure --prefix=/usr/server/mysql --with-embedded-server--without-debug --enable-assembler --with-charset=utf8--with-extra-charsets=all--with-unix-socket-path=/usr/server/mysql/tmp/mysql.sock--with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static--sysconfdir=/usr/server/conf
make && make install
make clean
mkdir /usr/server/mysql/tmp
mkdir /usr/server/mysql/var
groupadd mysql
useradd -g mysql mysql
cd /usr/server
chmod 750 mysql -R
chgrp mysql mysql -R
chown mysql mysql/var -R
chown mysql mysql/tmp -R

9.安装php-5.1.4.tar.gz
说明:
--with-gd=shared 使用PHP内置的GD库,此GD库比使用GD软件多出10个函数,具体可查看另一篇文章

tar -zxvf php-5.1.4.tar.gz
cd php-5.1.4
./configure --prefix=/usr/server/php/--with-apxs2=/usr/server/httpd/bin/apxs--with-config-file-path=/usr/server/conf --with-mysql=/usr/server/mysql--with-curl=/usr/server/curl --with-freetype=/usr/server/freetype--with-gd=shared --enable-mbstring=all --enable-mbstr-enc-trans--enable-mbregex --enable-track-var --with-dom --enable-sockets--with-iconv --with-ttf --with-xmlrpc --with-jpeg-dir=/usr/server/jpeg--enable-soap --with-libxml-dir=/usr/server/libxml--with-png-dir=/usr/local --with-zlib-dir=/usr/local --enable-shared--enable-module=so
make && make install
make clean


以下为选择安装的软件

10.安装ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
tar -zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc21-i386
./install
根据提示进行设置即可

11.安装eaccelerator-0.9.5-rc1.tar.bz2
tar -jxvf eaccelerator-0.9.5-rc1.tar.bz2
cd eaccelerator-0.9.5-rc1
/usr/server/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/server/php/bin/php-config --prefix=/usr/server/eaccelerator
make && make install
make clean

要使用此软件需要在php.ini里增加以下内容
增加后,将以PHP扩展模块的方式运行
[eaccelerator]
extension=eaccelerator.so
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

以下安装ffmpeg,使PHP可以对视频进行操作

12.安装lame,ffmpeg支持软件,支持mp3
tar -zxvf lame-3.97.tar.gz
cd lame-3.97
./configure
make && make install
make clean

13.安装libogg,ffmpeg支持软件,支持ogg
tar -zxvf libogg-1.1.3.tar.gz
cd libogg-1.1.3
./configure
make && make install
make clean

14.安装libvorbis,ffmpeg支持软件
tar -zxvf libvorbis-1.1.2.tar.gz
cd libvorbis-1.1.2
./configure
make && make install
make clean

15.安装ffmpeg
tar -xjf ffmpeg-0.4.9-p20050226.tbz2
cd ffmpeg-0.4.9
./configure --enable-mp3lame --enable-libogg --enable-vorbis --disable-mmx --enable-shared
echo '#define HAVE_LRINTF 1 '>>config.h #补丁
make && make install
make clean
设置连接,不然ffmpeg可能不能正常使用
ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

16.安装ffmpeg-php
tar -xjf ffmpeg-php-0.5.0.tbz2
cd ffmpeg-php-0.5.0
./configure --with-php-config=/usr/server/php/bin/php-config
make && make install
make clean
安装后,在php的模块目录中会产生一个ffmpeg.so文件,手动加载到php.ini中即可


以下进行版本控制安装

17.安装subversion(软件解压后,只会产生一个目录,其中deps只是一些必要的插件)
tar -zxvf subversion-1.4.0.tar.gz
tar -zxvf subversion-deps-1.4.0.tar.gz
cd subversion-1.4.0
./configure --with-apxs=/usr/server/httpd/bin/apxs
make && make install
make clean
安装后,建立软件库,并进行设置后即可使用svn://进行连接
如果要使用http进行项目浏览,刚在httpd.conf里进行如下设置
其中,/var/www/svn/passwd 使用htpasswd产生的密码
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic 
AuthName "Subversion repositories" 
AuthUserFile /var/www/svn/passwd
Require valid-user
</Location>


至此所有东西都安装完成,php.ini和my.cnf文件放到/usr/server/conf目录里,httpd.conf在其默认目录中,注意,如果安装了Zend,则php.ini将会移动到Zend下的etc目录中,/usr/server/conf/php.ini只是一个ln连接符

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yown/archive/2007/08/14/1742625.aspx

 

=========================================

 

#wget http://mirror.bit.edu.cn/apache//apr/apr-1.4.6.tar.bz2

#wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.4.1.tar.bz2

#tar jxvf apr-util-1.4.1.tar.bz2

#tar jxvf apr-1.4.6.tar.bz2

#cp -R apr-1.4.6 /root/httpd-2.4.1/srclib/apr

#cp -R apr-util-1.4.1 /root/httpd-2.4.1/srclib/apr-util

#wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.zip

#unzip pcre-8.32.zip

#mv pcre-8.32 /root/httpd-2.4.1/srclib/pcre-832

#cd srclib

#cd pcre-8.32  ./configure --prefix=/usr/local/pcre

#cd httpd-2.4.1  ./configure --with-pcre=/usr/local/pcre

#cd /usr/local/apache2/bin/ 

      # ./apachectl start

 

 

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

 

改为

Allow from all

 

<VirtualHost *:80>
<Directory "/usr/local/apache2/htdocs/***">
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

ServerAdmin webmaster@***.com
DocumentRoot "/usr/local/apache2/htdocs/***"
ServerName www.***.com
ErrorLog "logs/www.***.com-error_log"
CustomLog "logs/www.***.com-access_log" common
</VirtualHost>

 

安装libxml2-2.6.26.tar.gz
tar -zxvf libxml2-2.6.26.tar.gz
cd libxml2-2.6.26
./configure --prefix=/usr/server/libxml2
make && make install
make clean

 

#wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz 

#tar -zxvf ncurses-5.6.tar.gz

#./configure -prefix=/usr -with-shared -without-debug

#./configure --prefix=/usr/local/mysql --with-embedded-server --without-debug --enable-assembler --with-charset=utf8 --with-extra-charsets=all --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static--sysconfdir=/usr/local/conf

 

#./configure --prefix=/usr/server/php/ --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/server/conf --with-freetype=/usr/server/freetype--with-gd=shared --enable-mbstring=all --enable-mbstr-enc-trans--enable-mbregex --enable-track-var --with-dom --enable-sockets--with-iconv --with-ttf --with-xmlrpc --with-jpeg-dir=/usr/server/jpeg--enable-soap --with-libxml-dir=/usr/server/libxml2 --with-png-dir=/usr/local

 

#添加MIME映射,让apache把PHP文件当成代码文件来执行
AddType application/x-httpd-php .php .phtml

posted on 2013-02-26 21:05  upwifi  阅读(11299)  评论(0编辑  收藏  举报

导航