您现在的位置是:网站首页> 编程资料编程资料

Red Hat Enterprise Linux AS release 4 apache+MYsql+PHP的安装和优化_RedHat/Centos_操作系统_

2024-03-10 110人已围观

简介 Red Hat Enterprise Linux AS release 4 apache+MYsql+PHP的安装和优化_RedHat/Centos_操作系统_

软件版本:httpd-2.2.3.tar.gz
        mysql-5.0.18.tar.gz
        php-5.0.4.tar.gz
 
1安装mysql
         shell#tar xzvf mysql-5.0.15.tar.gz
              #解开安装
 
         shell#cd mysql-5.0.1
         shell#./configrue --prefix=/usr/local/mysql
         shell# make && make install
         shell#make install
               #进入安装目录,设置安装路径.编译并安装

         shell#groupadd mysql
         shell#useradd -g mysql mysql
              #新建名为mysql的组,并新建名为mysql的用户,并且默认属于mysql组
 
         shell#chgrp -R mysql /usr/local/mysql
              #改变/usr/local/mysql及下属文件与目录的属组
 
         shell#cp support-files/my-large.cnf /etc/my.cnf
              #copymy-large.cnf到 /etc中,替换原有的my.cnf
 
         shell#scripts/mysql_install_db
              #建立初始数据
 
         shell#chown -R mysql:mysql /usr/local/mysql/var
       &
 shell#cp support-files/mysql.server /etc/init.d/mysqld
              #copymysql.server到init.d目录中并重命名为mysqld,启动文件
 
         shell#chmod 755 /etc/init.d/mysqld
              #设置启动文件的权限有为755
 
         shell#chkconfig --add mysqld
         shell#chkconfig mysqld on
              #把此服务添加到系统启动中,add为添加至/etc/rc.d/init.d中,on默认在3\5级别服务默认启动
           
         shell#/etc/init.d/mysqld start
         shell#/usr/local/mysql/bin/mysqld_safe &
                  启动myhsql
        
 
 
         shell#/usr/local/mysql/bin/mysqladmin -u root password 123
              默认root用户密码为空,设置密码为123
 
         shell#/usr/local/mysql/bin/mysql -u root -p
               #输入上面设置的123后.以root身份登陆
         
         shell#./mysqladmin -u root -p password 456
               #修改mysql root用户密码为456,在提示框中要输入原密码,
 mysql> grant select on test.* to 'ttt' @'%' identified by'ttt' with grant option;
               #添加一个名称为ttt,密码为ttt的mysql账户,对test数据库有修改权限
     
         
2安装apache-2.2.3
         shell#tar xzvf httpd-2.2.3.tar.gz
         shell#cd httpd-2.2.3
         shell#./configure --prefix=/usr/local/apache --enable-so
         shell#make && make install
              #解包设置安装信息编译安装
        
         shell#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
              #把服务cp至启动文件中        
 
         shell#chmod 755 /etc/init.d/httpd
              #设置服务权限
 
 
3安装php
         shell#tar xvzf php-5.0.4.tar.gz
         shell#cd php-5.0.4
         shell#./configure --with-mysql=/usr/local/mysql --with-  apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/php
         shell#make && make instal
              #解包设置安装信息编译安装
 
         shell#echo
AddType application/x-httpd-php .php >> /usr/local/apache/conf/httpd.conf
         shell#echo AddType application/x-httpd-php .sulpx >> /usr/local/apache/conf/httpd.conf
        shell#echo AddType application/x-httpd-php-source .phps >> /usr/local/apache/conf/httpd.conf
        shell#echo DirectoryIndex index.php index.html index.htm index.html.var >> /usr/local/apache/conf/httpd.conf
             #在http.conf中加入对php的支持
 
shell#/usr/local/apache/bin/apachectl start
             #启动http
 
测试,在/usr/local/apache/htdocs 下建一文件名为test.php,内容为:,然后在打开IE输入本机IP地址查看,如显示php页面,则建立成功
 
 
网上文档:
#tar xzvf libpng-1.2.8-config.tar.gz
#tar xzvf freetype-2.1.9.tar.gz
#tar xzvf zlib-1.2.2.tar.gz
#tar xzvf gd-2.0.33.tar.gz
#tar xzvf httpd-2.0.54.tar.gz
#tar xzvf php-5.0.4.tar.gz
#tar xzvf mysql-5.0.15.tar.gz #########default setup/change my.cnf for onlyone please
cd mysql-5.0.18
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=gbk,gb2312,big5 && make && make install
groupadd mysql
useradd -g mysql mysql
chgrp -R mysql /usr/local/mysql
cp support-files/my-large.cnf /etc/my.cnf
scripts/mysql_install_db
chown -R mysql:mysql /usr/local/mysql/var
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
/usr/local/mysql/bin/mysqld_safe &
----------------------------- chkconfig --add mysqld
chkconfig mysqld on
------------------------------
#########support soft setup
cd /root/install/libpng-1.2.8-config
./configure && make && make install
cd /root/install/freetype-2.1.9
./configure --prefix=/usr/local/freetype-2.1.9 && make && make install
cd /root/install/zlib-1.2.2
./configure --prefix=/usr/local/zlib-1.2.2 && make && ; make install
cd /root/install/jpeg-6b
cp -R /root/install/jpeg-6b /usr/local/
mkdir -p /usr/local/man/man1
./configure --enable-shared --enable-static && make && make install
cd /root/install/gd-2.0.33
./configure --prefix=/usr/local/gd-2.0.33 --with-freetype=/usr/local/freetype-2.1.9 && make && make install #########apache setup
cd /root/install/httpd-2.2.3
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite && make && make install
#rm -f /etc/init.d/httpd
#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
#chmod 755 /etc/init.d/httpd
#########php setup
cd /root/install/php-5.0.4
./configure --with-mysql=/usr/local/mysql --enable-trans-sid --enable-track-vars --with-png-dir=/usr/local/bin --with-gd=/usr/local/gd-2.0.33 --with-jpeg-dir=/usr/local/jpeg-6b --with-extension_dir=/usr/local/lib/extension --with-freetype-dir=/usr/local/freetype-2.1.9 --with-zlib-dir=/usr/local/zlib-1.2.2 --with-apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-force-cgi-redirect --disable-cgi --with-gettext --with-gdbm && make && make install
sed -e 's/variables_order = "EGPCS"/variables_order = "ECPGS"/g' -e 's/register_globals = Off/register_globals = On/g' php.ini-dist > /usr/local/php/bin/php.ini
echo AddType application/x-httpd-php .php >> /usr/local/apache/conf/httpd.conf
echo AddType application/x-httpd-php .sulpx >> /usr/local/apache/conf/httpd.conf
echo AddType application/x-httpd-php-source .phps >> /usr/local/apache/conf/httpd.conf
echo DirectoryIndex index.php index.html index.htm index.html.var >> /usr/local/apache/conf/httpd.conf
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start
 
./configure --with-mysql=/usr/local/mysql --enable-trans-sid --enable-track-vars --with-png-dir=/usr/local/libpng-1.2.5 --with-gd=/usr/local/gd-2.0.33 --with-jpeg-dir=/usr/local/jpeg-6b --with-extension_dir=/usr/local/lib/extension --with-freetype-dir=/usr/local/freetype-2.1.9 --with-zlib-dir=/usr/local/zlib-1.2.2 --with-apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-force-cgi-redirect --disable-cgi --with-gettext --with-gdbm && make && make install             [LAMP平台]   LAMP这个词的由来最早始于德国杂志“c't Magazine”,Michael Kunze在1990年最先把这些项目组合在一起创造了LAMP的缩写字。这些组件虽然并不是开开始就设计为一起使用的,但是,这些开源软件都可以很方便的随时获得并免费获得。这就导致了这些组件经常在一起使用。在过去的几年里,这些组件的兼容性不断完善,在一起的应用情形变得非常普便。为了改善不同组件之间的协作,已经创建了某些扩展功能。目前,几乎在所有的Linux发布版中都默认包含了“LAMP stack”的产品。这些产品组成了一个强大的Web应用程序平台   LAMP 平台由四个组件组成,呈分层结构。每一层都提供了整个软件栈的一个关键部分:   Linux:Linux 处在最低层,提供操作系统。其他每个组件实际上也在 Linux 上运行。但是,并不一定局限于 Linux,如有必要,其他组件也可以在 Microsoft? Windows?、Mac OS X 或 UNIX? 上运行。   Apache:次低层是 Apache,它是一个 Web 服务器。Apache 提供可让用户获得 Web 页面的机制。Apache 是一款稳定的、支持关键任务的服务器,Internet 上超过 65% 的网站都使用它作为 Web 服务器。PHP 组件实际上是在 Apache 中,动态页面可以通过 Apache 和 PHP 创建。   MySQL:MySQL 提供 LAMP 系统的数据存储端。有了 MySQL,便可以获得一个非常强大的、适合运行大型复杂站点的数据库。在 Web 应用程序中,所有数据、产品、帐户和其他类型的信息都存放在这个数据库中,通过 SQL 语言可以很容易地查询这些信息。   PHP:PHP 是一门简单而有效的编程语言,它像是粘合剂,可以将 LAMP 系统所有其他的组件粘合在一起。您可以使用 PHP 编写能访问 MySQL 数据库中的数据和 Linux 提供的一些特性的动态内容。   [检测工具]   为了得到完整的调试结果,建议你采用 ApacheBench 或者 httperf之类的软件。如果你对非 LAMP 架构的服务器测试有兴趣的话,建议你采用微软的免费软件: Web Application Stress Tool(需要 NT 或者 2000)。 (其它
-六神源码网