欢迎来到福编程网,本站提供各种互联网专业知识!

RedHat AS4上安装配置Apache2.2.4+PHP5.2.3+MySQL5.0.45+openssl0.98e

发布时间:1970-01-01 作者:佚名 来源:互联网
系统环境:RedhatAS4所需软件包:mysql-5.0.41.tar.gzzlib-1.2.3.tar.gzopenssl-0.9.8e.tar.gz&nb

系统环境:Redhat AS4所需软件包:mysql-5.0.41.tar.gz

zlib-1.2.3.tar.gz openssl-0.9.8e.tar.gz httpd-2.2.4.tar.gz libpng-1.2.14.tar.gz freetype-2.1.10.tar.gz jpegsrc.v6b.tar.gz libxml2-2.6.19.tar.gz gd-2.0.33.tar.gz php-5.2.1.tar.gz

所用软件包都上传至服务器/root/web目录下 1.1.安装mysql-5.0.45

卸载系统自带的mysql rpm -qa|grep mysql rpm -e –nodeps mysql

groupadd mysql

useradd -g mysql mysql

tar zxvf mysql-5.0.41.tar.gz

cd mysql-5.0.45

#./configure –prefix=/usr/local/mysql –enable-thread-safe-client –enable-local-infile –with-charset=gbk –with-extra-charset=all –with-low-memory

#make

#make install

#cp support-files/my-medium.cnf /etc/my.cnf

#cd /usr/local/mysql

#chown -R mysql .

#chgrp -R mysql .

#bin/mysql_install_db –user=mysql

#chown -R root .

#chown -R mysql var

#bin/mysqld_safe –user=mysql &

#cd /root/web/mysql-5.0.45

#cp support-files/mysql.server /etc/rc.d/init.d/mysqld

#chmod 700 /etc/rc.d/init.d/mysqld

#chkconfig –add mysqld

#chkconfig –level 345 mysqld on 测试

#/usr/local/mysql/bin/mysqladmin ping

#/usr/local/mysql/bin/mysqladmin version

#/usr/local/mysql/bin/mysql 添加root密码

#/usr/local/mysql/bin/mysqladmin -uroot -p 添加/usr/local/mysql/bin到环境变量PATH中

#export PATH=$PATH:/usr/local/mysql/bin 2.安装zlib-1.2.3 #tar zxvf zlib-1.2.3.tar.gz

#cd zlib-1.2.3

#./configure –prefix=/usr/local/zlib

#make

#make install 3.安装openssl-0.9.8e #tar zxvf openssl-0.9.8e.tar.gz

#cd openssl-0.9.8e

#./config shared zlib

#make

#make test

#make install

mv /usr/bin/openssl /usr/bin/openssl.OFF

mv /usr/include/openssl /usr/include/openssl.OFF

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

ln -s /usr/local/ssl/include/openssl /usr/include/openssl 配置库文件搜索路径 #echo “/usr/local/ssl/lib” >> /etc/ld.so.conf

#ldconfig -v 4.安装httpd-2.2.4 #tar zxvf httpd-2.2.4.tar.gz

#cd httpd-2.2.4

#./configure –prefix=/usr/local/apache –sysconfdir=/etc/httpd –enable-so –enable-ssl –with-ssl=/usr/local/ssl –enable-track-vars –enable-rewrite –with-z-dir=/usr/local/zlib –enable-mods-shared=most

#make

#make install #echo “/usr/local/apache/bin/apachectl start” >> /etc/rc.local(系统启动时服务自动启动) 5.安装libpng-1.2.14 #tar zxvf libpng-1.2.14.tar.gz

# cd libpng-1.2.14

# cp scripts/makefile.linux makefile

# make (若是提示找不到zlib库文件或者头文件,多半是makefile文件里zlib的默认路径有误。可编辑makefile文件,找到zlib项并重新指定路径到/usr/local/zlib/lib和/usr/local/zlib/include)。

# make install 6.安装freetype-2.1.10 # tar -zvxf freetype-2.1.10.tar.gz

# cd freetype-2.1.10

# mkdir -p /usr/local/freetype

# ./configure –prefix=/usr/local/freetype

# make;make install 7.安装jpegsrc.v6b jpeg默认不会自建目录,因此需手动建立目录:

# mkdir -pv /usr/local/jpeg6/{,bin,lib,include,man/man1,man1} 安装

#tar zxvf jpegsrc.v6b.tar.gz

# ./configure –prefix=/usr/local/jpeg6/ –enable-shared –enable-static

# make

# make install

# make install-lib 8.安装libxml2-2.6.19 # tar -zxf libxml2-2.6.19.tar.gz

# cd libxml2-2.6.19

# mkdir -p /usr/local/libxml2

# ./configure –prefix=/usr/local/libxml2

# make; make install

#cp xml2-config /usr/bin 9.安装GD-2.0.33库 # tar -zvxf gd-2.0.33.tar.gz

# mkdir -p /usr/local/gd2

# cd gd-2.0.33

# ./configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg6/ –with-png=/usr/local/lib/ –with-zlib=/usr/local/zlib/ –with-freetype=/usr/local/freetype/

# make; make install 10.安装php-5.2.1 # tar -zvxf php-5.2.1.tar.gz

# mkdir -p /usr/local/php

# cd php-5.2.1

# ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-xml=/usr/local/libxml2 –with-png=/usr/local/lib –with-jpeg-dir=/usr/local/jpeg6 –with-zlib=/usr/local/zlib –with-freetype=/usr/local/freetype –with-gd=/usr/local/gd2 –enable-track-vars –enable-mbstring=all

# make

# make install

# cp php.ini-dist /usr/local/php/lib/php.ini 11.编辑apache配置文件httpd.conf

# vi /etc/httpd/httpd.conf

要改的有如下几处:

找到LoadModule php5_module modules/libphp5.so

前面的#号去掉(默认已去掉注释)

#AddType application/x-gzip .gz .tgz

下加二行

AddType application/x-httpd-php .php

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

还有找到DirectoryIndex index.html

加上 index.php 让它把index.php做为默认页 按照使用习惯,这里将网站根目录指定到/var/www:

找到DocumentRoot “/usr/local/apache/htdocs”

修改为:DocumentRoot “/var/www”(后文中我们还会注释掉此行,以启用虚拟主机) 找到

修改为: 12.测试PHP

# vi /var/www/index.php

添加:

phpinfo();

?>

重新启动apache服务器

# /usr/local/apache/bin/apachectl restart

浏览器里http://localhost/测试一下.

相关推荐