一、 安装前需要准备的包
apache httpd-2.2.9.tar.Gz
tar zxvf php-5.2.4.tar.bz2
tar zxvf gd-2.0.34.tar.bz2
tar zxvf libxml2-2.6.30.tar.gz
tar zxvf openssl-0.9.8e.tar.gz
tar zxvf libmcrypt-2.5.8.tar.bz2
tar zxvf ZendOptimizer-3.3.0-linux-glibc21-i386.tar.gz
[root@shangluo httpd-2.2.9]# tar zxvf httpd-2.2.9.tar.gz (解压文件)
[root@shangluo httpd-2.2.9]# cd httpd-2.2.9(进入到解压完的文件)
以下加入proxy 和proxy-ajp. 可以用proxy链接tomcat
2008年9月21日星期日,最新的httpd-2.2.9的编译方法
./configure --prefix=/usr/local/apache --enable-rewrite=shared --enable-proxy=shared --enable-proxy-ajp=shared --enable-mods-shared=all --enable-so --enbale-dav
[root@shangluo httpd-2.2.9]# make WITH_AUTH_MODULES=yes WITH_DAV_MODULES=yes WITH_LDAP_MODULES=yes WITH_MISC_MODULES=yes WIHT_PROXY_MODULES=yes WITH_SSL_MODULES=yes WITH_SUEXEC_MODULES=yes WITH_PROXY_MODULES="proxy proxy_http proxy_ajp proxy_balancer" (安装)
[root@shangluo httpd-2.2.9]# make install (开始安装)
【如果在进行编译时(即:make),出现如下错误时:
……/usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object
/usr/local/lib/libz.a: could not read symbols: Bad value
则在安装zlib-1.2.3.tar.gz时,该进行如下的步骤操作:
# cd zlib-1.2.3 //进入zlib目录
# CFLAGS="-O3 -fPIC" ./configure //使用64位元的方法进行编译
# make
# make install
# make clean
】
[root@shangluo httpd-2.2.9]# tar zxvf gd-2.0.34.tar.gz (解压文件)
[root@localhost ~]#cd gd-2.0.34
[root@localhost gd-2.0.34]# ./configure --prefix=/usr/local/gd2
[root@localhost gd-2.0.34]#make
[root@localhost gd-2.0.34]#make install
[root@localhost gd-2.0.34]#cd ..
[root@shangluo httpd-2.2.9]# tar zxvf libxml2-2.6.30.tar.gz (解压文件)
[root@localhost ~]#cd libxml2-2.6.30
[root@localhost libxml2-2.6.30]#./configure --prefix=/usr/local/libxml2
[root@localhost libxml2-2.6.30]#.make
[root@localhost libxml2-2.6.30]#.make install
[root@localhost libxml2-2.6.30]#.cd ..
[root@shangluo httpd-2.2.9]# tar zxvf openssl-0.9.8e.tar.gz (解压文件)
[root@localhost ~]#cd openssl-0.9.8e
[root@localhost openssl-0.9.8e]#./config --prefix=/usr/local/openssl
[root@localhost openssl-0.9.8e]#make
[root@localhost openssl-0.9.8e]#make install
[root@localhost openssl-0.9.8e]#cd ..
[root@shangluo httpd-2.2.9]#gzip libmcrypt-2.5.8.tar.gz
[root@shangluo httpd-2.2.9]# tar zxvf libmcrypt-2.5.8.tar.gz
[root@localhost ~]#cd libmcrypt-2.5.8
[root@localhost libmcrypt-2.5.8]#./configure--prefix=/usr/local/libmcrypt
[root@localhost libmcrypt-2.5.8]#mkdir –p
/usr/local/freetype/include/freetype2/freetype/internal
[root@localhost libmcrypt-2.5.8]#make
[root@localhost libmcrypt-2.5.8]#make install
[root@localhost libmcrypt-2.5.8]#cd ..
安装jpeg
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b/
# ./configure
# make
# make install-lib
libpng:
# tar -zxf libpng-1.2.8-config.tar.gz
# cd libpng-1.2.8-config
# ./configure
# make
# make install
freetype:
# tar -zxf freetype-2.1.9.tar.gz
# cd freetype-2.1.9
# ./configure
# make
# make install
[root@shangluo httpd-2.2.9]# tar zxvf php-5.2.4.tar.gz (解压文件)
[root@localhost ~]#cd php-5.2.4
Oracle支持的php安装
[root@shangluo php-5.2.6]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-oci8=/home/oracle/10g --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-jpeg-dir --with-png-dir --with-bz2 --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt=/usr/local/libmcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --disable-cgi --disable-cli
Mysql 支持的php 安装
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql/
--with-curl=/usr/local/curl --enable-ftp
--with-libxml-dir=/usr/local/libxml2
--with-expat-dir=/usr/lib --enable-soap
--with-xsl=/usr/local/libxslt --enable-xslt
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-zlib-dir=/usr/local/lib/
--with-png=/usr/local/lib/
--with-freetype-dir=/usr/local/freetype/
[root@shangluo php-5.2.6]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-jpeg-dir --with-png-dir --with-bz2 --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-openssl=/usr/local/openssl --with-mcrypt=/usr/local/libmcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --disable-cgi --disable-cli
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-zlib --with-libxml-dir=/usr/local/libxml2/ --with-gd=/usr/local/gd2/ --with-freetype-dir --with-jpeg-dir --with-png-dir -with-ttf --enable-mbstring --with-mysql=/usr/local/mysql/ --enable-gd-native-ttf --with-config-file-path=/usr/local/php/etc
# make 编译
# make install 安装
第105行 修改为/var/www 访问apache的目录
第167行 加index.htm index.php
第273行下面添加
<Directory "/var/www">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
第310行添加一句:AddType application/x-httpd-php .php
修改vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
删除27行后面的所有东西 影响apache的启动
1, 首先先把php软件包中的php.ini-dist 复制到 /usr/local/php/etc/php.ini (改名后)
[root@localhost ~]#cd php-5.2.4
在 /usr/local/php下是没有etc这个目录 所以需手工创建
[root@localhost php-5.2.4]#mkdir /usr/local/php/etc
[root@localhost php-5.2.4]#cp php.ini-dist /usr/local/php/etc/php.ini zend安装需要这个文件
[root@localhost php-5.2.4]#cd ..
2,安装zend软件包
[root@localhost ~]#cd ZendOptimizer-3.3.0-linux-glibc21-i386
[root@localhost ZendOptimizer-3.3.0-linux-glibc21-i386]# ./install.sh
在安装时显示到php.ini的对话框的时候 要把路径改为/usr/local/php/etc
下一步就行了 安装完会自动重起apache 。。。
添加mysql用户及用户组
# groupadd mysql
# useradd -g mysql mysql
修改mysql目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
生成mysql系统数据库
# /usr/local/mysql/bin/mysql_install_db --user=mysql&
启动mysql服务
# /usr/local/mysql/bin/mysqld_safe --user=mysql&
如出现 Starting mysqld daemon with databases from /usr/local/mysql/data
代表正常启动mysql服务了, 按Ctrl + C 跳出
修改 mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password "123456"
12月04新增部分
mysql -u root -p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
2
mysql
1d:/mysql/bin/>mysql -h localhost -u root
//MySQL
2mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION
//
myusermypasswordmysql
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WI