amwdnuff 发表于 2009-5-20 14:36

Red Hat Linux 9下部署LAMP环境

系统环境:
# uname -a
Linux RedHat9 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

# gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# perl -v

This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2002, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

# python
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
on linux2
Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.


检测完环境开始安装

安装MySQL之前先检查下系统中是否已经存在MySQL,这点很重要,有则先卸载:
# rpm -qa|grep mysql

推荐使用RPM方式安装MySQL:
# rpm -ivh MySQL-shared-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-devel-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-client-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-shared-compat-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-embedded-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-debuginfo-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-server-5.1.34-0.glibc23.i386.rpm--nodeps

设置mysql密码为root
# mysqladmin -u root password 'root'

安装libiconv-1.13.tar.gz库
# tar zxvf libiconv-1.13.tar.gz
# cd libiconv-1.13
# ./configure --prefix=/usr/local/libiconv
# make && make install

安装freetype-2.3.5.tar.gz库
# tar zxvf freetype-2.3.5.tar.gz
# cd freetype-2.3.5
# ./configure
# make && make install

安装libpng-1.2.33.tar.gz库
# tar zxvf libpng-1.2.33.tar.gz
# cd libpng-1.2.33
# cp scripts/makefile.linux makefile
# make && make install

安装jpegsrc.v6b.tar.gz库
# tar zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}
# ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
# make && make install && make install-lib

安装libxml2-2.6.31.tar.gz库
# tar zxvf libxml2-2.6.31.tar.gz
# cd libxml2-2.6.31
# ./configure
# make && make install

安装libmcrypt-2.5.8.tar.gz库
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make && make install
# /sbin/ldconfig
# cd libltdl
# ./configure --enable-ltdl-install
# make && make install

安装mhash-0.9.9.tar.gz库
# tar zxvf mhash-0.9.9.tar.gz
# cd mhash-0.9.9
# ./configure
# make && make install

安装mcrypt-2.6.7.tar.gz库
# tar zxvf mcrypt-2.6.7.tar.gz
# cd mcrypt-2.6.7
# cp /usr/local/lib/libmcrypt*.* /usr/lib
# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
# ./configure
# make && make install

安装curl-7.19.0.tar.gz库
# tar zxvf curl-7.19.0.tar.gz
# cd curl-7.19.0
# ./configure
# make && make install

安装zlib-1.2.3.tar.gz库
# tar zxvf zlib-1.2.3.tar.gz
# cd zlib/1.2.3/
# ./configure
# make && make install

安装gd-2.0.33.tar.tar库
# tar zxvf gd-2.0.33.tar.tar
# cd gd-2.0.33
# ./configure --with-libiconv-prefix --with-png --with-freetype --with-jpeg-dir=/usr/local/jpeg/
# make && make install

安装apache
# tar zxvf httpd-2.2.11.tar.gz
# cd httpd-2.2.11
# ./configure --prefix=/usr/local/apache --enable-so
# make && make install

设置linux启动时同时启动apache服务
# echo \"/usr/local/apache/bin/apachectl start\" >> /etc/rc.d/rc.local

安装php-5.2.9.tar.gz
# tar zxvf php-5.2.9.tar.gz
# cd php-5.2.9
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-jpeg-dir=/usr/local/jpeg/ --with-libxml-dir --with-curl --with-gd --with-zlib-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --with-ttf --with-mcrypt --with-mhash --with-libmcrypt --with-mysql --enable-track-vars --enable-ftp --enable-soap --enable-mbstring=all
# make && make install
# cp php.ini-dist /usr/local/php/lib/php.ini

编辑/usr/local/php/lib/php.ini文件
# vi /usr/local/php/lib/php.ini
将“ ;default_charset = \"iso-8859-1\" ”改为“ default_charset = \"utf-8\" ”;将“ ;session.save_path = \"/tmp\" ”改为“ session.save_path = \"/tmp\" ”。

编辑apache配置文件httpd.conf
# vi /usr/local/apache/conf/httpd.conf
要改的有如下几处:

找到LoadModule php5_module modules/libphp5.so,将前面的#号去掉;

找到#AddType application/x-gzip .gz .tgz
在下面加二行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

还有找到<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改为<IfModule dir_module>
DirectoryIndex index.html index.php index.htm index.phtml
</IfModule>


找到DocumentRoot \"/usr/local/apache/htdocs\" 和 <Directory \"/usr/local/apache/htdocs\">
把/usr/local/apache/htdocs改为你存放网页文件的路径,比如DocumentRoot \"/www\"和<Directory \"/www\">

在/www目录下建立php测试文件如下:
# vi /www/test.php
内容如下
<?php
phpinfo();
?>
然后在浏览器中输入:http://xxx.xxx.xxx.xxx/test.php将会看见php和系统的相关信息。

chuanyuan 发表于 2009-5-20 16:03

太复杂了~~晕啊

amwdnuff 发表于 2009-5-20 14:36

Red Hat Linux 9下部署LAMP环境

系统环境:
# uname -a
Linux RedHat9 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

# gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# perl -v

This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2002, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl&#39; or `perldoc perl&#39;.If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

# python
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
on linux2
Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.


检测完环境开始安装

安装MySQL之前先检查下系统中是否已经存在MySQL,这点很重要,有则先卸载:
# rpm -qa|grep mysql

推荐使用RPM方式安装MySQL:
# rpm -ivh MySQL-shared-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-devel-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-client-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-shared-compat-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-embedded-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-debuginfo-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-server-5.1.34-0.glibc23.i386.rpm--nodeps

设置mysql密码为root
# mysqladmin -u root password &#39;root&#39;

安装libiconv-1.13.tar.gz库
# tar zxvf libiconv-1.13.tar.gz
# cd libiconv-1.13
# ./configure --prefix=/usr/local/libiconv
# make && make install

安装freetype-2.3.5.tar.gz库
# tar zxvf freetype-2.3.5.tar.gz
# cd freetype-2.3.5
# ./configure
# make && make install

安装libpng-1.2.33.tar.gz库
# tar zxvf libpng-1.2.33.tar.gz
# cd libpng-1.2.33
# cp scripts/makefile.linux makefile
# make && make install

安装jpegsrc.v6b.tar.gz库
# tar zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}
# ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
# make && make install && make install-lib

安装libxml2-2.6.31.tar.gz库
# tar zxvf libxml2-2.6.31.tar.gz
# cd libxml2-2.6.31
# ./configure
# make && make install

安装libmcrypt-2.5.8.tar.gz库
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make && make install
# /sbin/ldconfig
# cd libltdl
# ./configure --enable-ltdl-install
# make && make install

安装mhash-0.9.9.tar.gz库
# tar zxvf mhash-0.9.9.tar.gz
# cd mhash-0.9.9
# ./configure
# make && make install

安装mcrypt-2.6.7.tar.gz库
# tar zxvf mcrypt-2.6.7.tar.gz
# cd mcrypt-2.6.7
# cp /usr/local/lib/libmcrypt*.* /usr/lib
# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
# ./configure
# make && make install

安装curl-7.19.0.tar.gz库
# tar zxvf curl-7.19.0.tar.gz
# cd curl-7.19.0
# ./configure
# make && make install

安装zlib-1.2.3.tar.gz库
# tar zxvf zlib-1.2.3.tar.gz
# cd zlib/1.2.3/
# ./configure
# make && make install

安装gd-2.0.33.tar.tar库
# tar zxvf gd-2.0.33.tar.tar
# cd gd-2.0.33
# ./configure --with-libiconv-prefix --with-png --with-freetype --with-jpeg-dir=/usr/local/jpeg/
# make && make install

安装apache
# tar zxvf httpd-2.2.11.tar.gz
# cd httpd-2.2.11
# ./configure --prefix=/usr/local/apache --enable-so
# make && make install

设置linux启动时同时启动apache服务
# echo \"/usr/local/apache/bin/apachectl start\" >> /etc/rc.d/rc.local

安装php-5.2.9.tar.gz
# tar zxvf php-5.2.9.tar.gz
# cd php-5.2.9
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-jpeg-dir=/usr/local/jpeg/ --with-libxml-dir --with-curl --with-gd --with-zlib-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --with-ttf --with-mcrypt --with-mhash --with-libmcrypt --with-mysql --enable-track-vars --enable-ftp --enable-soap --enable-mbstring=all
# make && make install
# cp php.ini-dist /usr/local/php/lib/php.ini

编辑/usr/local/php/lib/php.ini文件
# vi /usr/local/php/lib/php.ini
将“ ;default_charset = \"iso-8859-1\" ”改为“ default_charset = \"utf-8\" ”;将“ ;session.save_path = \"/tmp\" ”改为“ session.save_path = \"/tmp\" ”。

编辑apache配置文件httpd.conf
# vi /usr/local/apache/conf/httpd.conf
要改的有如下几处:

找到LoadModule php5_module modules/libphp5.so,将前面的#号去掉;

找到#AddType application/x-gzip .gz .tgz
在下面加二行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

还有找到<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改为<IfModule dir_module>
DirectoryIndex index.html index.php index.htm index.phtml
</IfModule>


找到DocumentRoot \"/usr/local/apache/htdocs\" 和 <Directory \"/usr/local/apache/htdocs\">
把/usr/local/apache/htdocs改为你存放网页文件的路径,比如DocumentRoot \"/www\"和<Directory \"/www\">

在/www目录下建立php测试文件如下:
# vi /www/test.php
内容如下
<?php
phpinfo();
?>
然后在浏览器中输入:http://xxx.xxx.xxx.xxx/test.php将会看见php和系统的相关信息。

amwdnuff 发表于 2009-5-20 14:36

Red Hat Linux 9下部署LAMP环境

系统环境:
# uname -a
Linux RedHat9 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

# gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# perl -v

This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2002, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl&#39; or `perldoc perl&#39;.If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

# python
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
on linux2
Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.


检测完环境开始安装

安装MySQL之前先检查下系统中是否已经存在MySQL,这点很重要,有则先卸载:
# rpm -qa|grep mysql

推荐使用RPM方式安装MySQL:
# rpm -ivh MySQL-shared-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-devel-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-client-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-shared-compat-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-embedded-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-debuginfo-5.1.34-0.glibc23.i386.rpm
# rpm -ivh MySQL-server-5.1.34-0.glibc23.i386.rpm--nodeps

设置mysql密码为root
# mysqladmin -u root password &#39;root&#39;

安装libiconv-1.13.tar.gz库
# tar zxvf libiconv-1.13.tar.gz
# cd libiconv-1.13
# ./configure --prefix=/usr/local/libiconv
# make && make install

安装freetype-2.3.5.tar.gz库
# tar zxvf freetype-2.3.5.tar.gz
# cd freetype-2.3.5
# ./configure
# make && make install

安装libpng-1.2.33.tar.gz库
# tar zxvf libpng-1.2.33.tar.gz
# cd libpng-1.2.33
# cp scripts/makefile.linux makefile
# make && make install

安装jpegsrc.v6b.tar.gz库
# tar zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}
# ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
# make && make install && make install-lib

安装libxml2-2.6.31.tar.gz库
# tar zxvf libxml2-2.6.31.tar.gz
# cd libxml2-2.6.31
# ./configure
# make && make install

安装libmcrypt-2.5.8.tar.gz库
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make && make install
# /sbin/ldconfig
# cd libltdl
# ./configure --enable-ltdl-install
# make && make install

安装mhash-0.9.9.tar.gz库
# tar zxvf mhash-0.9.9.tar.gz
# cd mhash-0.9.9
# ./configure
# make && make install

安装mcrypt-2.6.7.tar.gz库
# tar zxvf mcrypt-2.6.7.tar.gz
# cd mcrypt-2.6.7
# cp /usr/local/lib/libmcrypt*.* /usr/lib
# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
# ./configure
# make && make install

安装curl-7.19.0.tar.gz库
# tar zxvf curl-7.19.0.tar.gz
# cd curl-7.19.0
# ./configure
# make && make install

安装zlib-1.2.3.tar.gz库
# tar zxvf zlib-1.2.3.tar.gz
# cd zlib/1.2.3/
# ./configure
# make && make install

安装gd-2.0.33.tar.tar库
# tar zxvf gd-2.0.33.tar.tar
# cd gd-2.0.33
# ./configure --with-libiconv-prefix --with-png --with-freetype --with-jpeg-dir=/usr/local/jpeg/
# make && make install

安装apache
# tar zxvf httpd-2.2.11.tar.gz
# cd httpd-2.2.11
# ./configure --prefix=/usr/local/apache --enable-so
# make && make install

设置linux启动时同时启动apache服务
# echo \"/usr/local/apache/bin/apachectl start\" >> /etc/rc.d/rc.local

安装php-5.2.9.tar.gz
# tar zxvf php-5.2.9.tar.gz
# cd php-5.2.9
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-jpeg-dir=/usr/local/jpeg/ --with-libxml-dir --with-curl --with-gd --with-zlib-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --with-ttf --with-mcrypt --with-mhash --with-libmcrypt --with-mysql --enable-track-vars --enable-ftp --enable-soap --enable-mbstring=all
# make && make install
# cp php.ini-dist /usr/local/php/lib/php.ini

编辑/usr/local/php/lib/php.ini文件
# vi /usr/local/php/lib/php.ini
将“ ;default_charset = \"iso-8859-1\" ”改为“ default_charset = \"utf-8\" ”;将“ ;session.save_path = \"/tmp\" ”改为“ session.save_path = \"/tmp\" ”。

编辑apache配置文件httpd.conf
# vi /usr/local/apache/conf/httpd.conf
要改的有如下几处:

找到LoadModule php5_module modules/libphp5.so,将前面的#号去掉;

找到#AddType application/x-gzip .gz .tgz
在下面加二行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

还有找到<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改为<IfModule dir_module>
DirectoryIndex index.html index.php index.htm index.phtml
</IfModule>


找到DocumentRoot \"/usr/local/apache/htdocs\" 和 <Directory \"/usr/local/apache/htdocs\">
把/usr/local/apache/htdocs改为你存放网页文件的路径,比如DocumentRoot \"/www\"和<Directory \"/www\">

在/www目录下建立php测试文件如下:
# vi /www/test.php
内容如下
<?php
phpinfo();
?>
然后在浏览器中输入:http://xxx.xxx.xxx.xxx/test.php将会看见php和系统的相关信息。
页: [1]
查看完整版本: Red Hat Linux 9下部署LAMP环境