Chinaunix首页 | 论坛 | 博客
  • 博客访问: 234663
  • 博文数量: 57
  • 博客积分: 1149
  • 博客等级: 少尉
  • 技术积分: 584
  • 用 户 组: 普通用户
  • 注册时间: 2011-10-29 11:35
文章分类

全部博文(57)

文章存档

2016年(1)

2014年(1)

2013年(2)

2012年(27)

2011年(26)

分类: LINUX

2011-11-01 13:40:56

Apache HttpdServer的最高版本为2.2.4,下载地址为:,我选择下载的是httpd-2.2.4.tar.bz2

tar xvf httpd-2.2.4.tar.bz2
cd httpd-2.2.4

[root@centos74 httpd-2.2.19]# cat config.nice 

#! /bin/sh

#

# Created by configure

 

"./configure" \

"--prefix=/usr/local/apache" \

"--enable-rewrite" \

"--enable-so" \

"--with-apr=/usr/local/apr/bin/apr-1-config" \

"--with-apr-util=/usr/local/apr/bin/apu-1-config" \

"$@"

之前直径安装好了apr和apu

make

make install

 /usr/local/apache/bin/apachectl start

 当你的apache 使用yum安装的时候,随后你安装php时候发现无法定位一个apxs的文件,你可以使用yum install http-devel  安装后就会发现apxs就在/usr/sbin 的下面,

mysql:

 

下载  二进制版本  mysql-5.5.10-linux2.6-i686.tar.gz

shell> groupadd mysql

shell> useradd -r -g mysql mysql

shell> cd /usr/local

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

shell> ln -s full-path-to-mysql-VERSION-OS mysql

shell> cd mysql

shell> chown -R mysql .

shell> chgrp -R mysql .

shell> scripts/mysql_install_db --user=mysql

shell> chown -R root .

shell> chown -R mysql data

# Next command is optional

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> bin/mysqld_safe --user=mysql &

# Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server

如果还是报错,掐掉进程重新打开一下

 添加yum源

 #rpm --import a

#vi /etc/yum.repos.d/utterramblings.repo

 

[utterramblings]

name=Jason's Utter Ramblings Repo

baseurl=

enabled=1

gpgcheck=1

gpgkey=

php:

 如果apache是yum安装的,php编译安装时候会找不到apxs。那么需要yum安装一个httpd-devel

tar xvf php-5.2.1.tar.gz
cd php

yum install libjpeg-devel libxml2-devel libpng-devel libXpm-devel freetype-devel libmcrypt-devel curl-devel

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mcrypt --enable-sockets --with-gd --enable-gd-native-ttf --with-zlib-dir --with-png-dir --with-xpm-dir --with-jpeg-dir --with-freetype-dir --enable-sysvsem --enable-sysvshm --with-openssl-dir --enable-mbstring=all(因为之前我们用RPM安装的,这里的mysql目录为/usr/local/mysql,而且需要安装cacti的一定要使用--enable-sockets,不然报错)

 

 

这类编译的时候可能会报错,configure: error: xml2-config not found. Please check your libxml2 installation.

rpm -ivh libxml2-2.6.23-1.2.i386.rpm 
/*提示我已经安装过了*/
rpm -ivh libxml2-devel-2.6.23-1.2.i386.rpm

确认上面的两个包已经安装上了,在DVD里面都有

 

还有一个报错:configure: error: Cannot find MySQL header files under /usr/share/mysql.
Note that the MySQL client library is not bundled anymore.

 

这是因为没有安装mysql-devel包导致的,安装就可以了

 make

make install

vi /usr/local/apache/conf/httpd.conf
添加以下几行:

AddType application/x-httpd-php .php                                           

AddType application/x-httpd-php-source .phps

LoadModule php5_module modules/libphp5.so

安装文件夹php-5.2.1内的文件php.ini-development,把它拷贝到/usr/local/php/lib/下,并命名为php.ini:
sudo cp php.ini-dist /usr/local/php/lib/php.ini
然后我们重启Apache服务器:
sudo /usr/local/apache/bin/apachectl restart
在website 下面建立一个test.php

内容为:

phpinfo()

?>

访问后可以看到配置信息,证明LAMP架设成功

 

这里可能会报错:

httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

是因为SELINUX

# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libphp5.so

# setenforce 1

 

 

 

在删除mysql的时候记得/var/lib/mysql  这个文件夹也要删除

这样就可以了

 

 

 

 

编译安装集成ldap+svn的apache  ./configure --prefix=/usr/local/apache --enable-rewrite --enable-so --enable-ldap --enable-authnz-ldap --with-included-apr  --with-ldap --with-ldap-include=/etc/openldap --with-apr-util=/root/lamp/httpd-2.2.19/srclib/apr-util/apu-1-config --with-apr=/root/lamp/httpd-2.2.19/srclib/apr/apr-1-config --enable-dav

阅读(1169) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~