`

RedHat linux AS 5下安装Apache2.2.6_MYSQL5.0.27_PHP5.2.6

阅读更多


1、删除系统自带老版本:
删除apache+php+mysql,判断是不是rpm安装如:

  1. rpm -q php
复制代码

返回php版本,则是rpm安装,用 rpm -e php --nodeps 即可彻底删除系统自带的php
如果不返回PHP版本则是二进制安装,直接删除目录就可以!同理apache mysql也一样!

2、安装Apache
下载地址:http://httpd.apache.org/

  1. # tar xzvf httpd-2.2.4.tar.gz
  2. # cd httpd-2.2.4
  3. # ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-cgi --enable-rewrite --enable-deflate --with-mpm=worker
  4. # make
  5. # make install
复制代码

3、安装Mysql
下载地址:

  1. # chmod 755 mysql-5.0.45-linux-i686-glibc23.tar.gz   //设置mysql-5.0.45-linux-i686-glibc23.tar.gz属性为755
  2. # tar xzvf mysql-5.0.45-linux-i686-glibc23.tar.gz //解压
  3. # cp -r mysql-5.0.45-linux-i686-glibc23 /usr/local       //
  4. # mv mysql-5.0.45-linux-i686-glibc23 mysql       //
  5. # cd mysql       //
  6. # groupadd mysql // 建立mysql组
  7. # useradd mysql -g mysql  //建立mysql用户并且加入到mysql组中
  8. # cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
  9. 在 support-files目录下有4个模版文件,我们选择其中一个座位Mysql的配置文件,覆盖/etc/my.cnf(系统默认的配置,其中设置了性能参数和Mysql的一些路径参数)
  10. # cd /usr/local/mysql 进入mysql目录
  11. # ./scripts/mysql_install_db --user=mysql //初试化表并且规定用mysql用户来访问。初始化表以后就开始给mysql和root用户设定访问权限
  12. # chown -R root .  //设定root能访问/usr/local/mysql   
  13. # chown -R mysql data //设定mysql用户能访问/usr/local/mysql/data   里面存的是mysql的数据库文件.这个目录是在/etc/my.cnf中有配置,在mysql_install_db时产生。   
  14. # chown -R mysql data/    //设定mysql用户能访问/usr/local/mysql/data/mysql下的所有文件
  15. # chgrp -R mysql . //设定mysql组能够访问/usr/local/mysql
  16. # /usr/local/mysql/bin/mysqld_safe --user=mysql &   运行mysql 如果没有问题的话,应该会出现类似这样的提示:
  17.                                                   [1] 42264
  18.                                                     # Starting mysqld daemon with databases from /usr/local/mysql/var
  19.                                                   如果出现 mysql ended这样的语句,表示Mysql没有正常启动,你可以到log中查找问题,Log文件的通常在/etc/my.cnf中配置。大多数问题是权限设置不正确引起的。
  20. # /usr/local/mysql/bin/mysqladmin -u root password yourpassword   //默认安装密码为空,为了安全你必须马上修改.
  21. # cp support-files/mysql.server /etc/rc.d/init.d/mysqld 设置使mysql每次启动都能自动运行
  22. # chmod 700 /etc/init.d/mysqld
  23. # chkconfig --add mysqld
  24. # chkconfig --level 345 mysqld on
  25. # service mysqld start //启动mysqld服务
  26. # netstat -atln //查看3306端口是否打开。要注意在防火墙中开放该端口。
复制代码

4、安装PHP
(1). 安装zlib (安装libpng和gd前需要先安装zlib),

  1. # tar zxvf zlib-1.2.3.tar.gz
  2. # cd zlib-1.2.3
  3. # ./configure
  4. # make;make install
复制代码

(2). 安装libpng,

  1. # tar zxvf libpng-1.2.12.tar.gz
  2. # cd libpng-1.2.12
  3. # ./configure
  4. # make;make install
复制代码

(3). 安装freetype,

  1. # tar zxvf freetype-2.2.1.tar.gz
  2. # cd freetype-2.1.10
  3. # ./configure --prefix=/usr/local/freetype
  4. # make;make install
复制代码

(4). 安装jpeg,

  1. # tar zxvf jpegsrc.v6b.tar.gz
  2. # cd jpeg-6b
  3. # mkdir /usr/local/jpeg
  4. # mkdir /usr/local/jpeg/bin
  5. # mkdir /usr/local/jpeg/lib
  6. # mkdir /usr/local/jpeg/include
  7. # mkdir /usr/local/jpeg/man
  8. # mkdir /usr/local/jpeg/man/man1
  9. # ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
  10. # make;make install
复制代码

(5). 安装gd,

  1. # tar zxvf gd-2.0.35.tar.gz
  2. # cd gd-2.0.35
  3. # ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png --with-zlib
  4. //编译过程中会看到如下信息
  5. ** Configuration summary for gd 2.0.33:

  6.    Support for PNG library:          yes
  7.    Support for JPEG library:         yes
  8.    Support for Freetype 2.x library: yes
  9.    Support for Fontconfig library:   no
  10.    Support for Xpm library:          no
  11.    Support for pthreads:             yes
  12. //可以看到png 、 jpeg 、 freetype都已经安装上了
  13. # make
  14. # make install
复制代码

(6). 正式安装php

  1. # tar zxvf php-5.2.3.tar.gz
  2. # cd php-5.2.3
  3. # ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd --with-zlib --with-libpng --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --enable-sockets --with-iconv --enable-mbstring --enable-track-vars --enable-force-cgi-redirect --with-config-file-path=/usr/local/php5/etc
  4. # make
  5. # make install
复制代码

(7).整合php和apache

  1. cp php.ini-dist /usr/local/php5/etc/php.ini
  2. vi /usr/local/php5/etc/php.ini
复制代码

将extension=php_mysql.dll前面的#去掉
注意在/usr/local/apache2/conf/httpd.conf加上下代码使apache执行PHP

  1. AddType application/x-httpd-php .php
  2. AddType application/x-httpd-php3 .php3
  3. AddType application/x-httpd-php4 .php4
  4. AddType application/x-httpd-php-source .phps
复制代码

(8). 安装ZendOptimizer,

  1. # tar zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
  2. # cd ZendOptimizer-3.0.1-linux-glibc21-i386
  3. # ./install.sh

解决MySQL不允许从远程访问的方法

 

/*------------------------1--------------------------*/
修改my.ini中的ip(如果有 localhost 修改为 ip)

/*------------------------2--------------------------*/

./mysql -u root -p123
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;

/*------------------------3--------------------------*/

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION
//赋予任何主机访问数据的权限
mysql>FLUSH PRIVILEGES
//修改生效
mysql>EXIT
//退出MySQL服务器

 

 

查看Mysql操作日志

 

mysql的操作日志在Mysql的Data的主目录下,命名类似:{mysql_data}/{server_name}-bin.00000X
这样的日志是不能直接看的,可以通过mysqlbinlog命令转换成我们识别的格式
mysqlbinlog localhost-bin.000202 > new_file_name.log

[hx@localhost data]$ mysqlbinlog
mysqlbinlog Ver 3.0 for pc-linux-gnu at i686
By Monty and Sasha, for your professional use
This software comes with NO WARRANTY: This is free software,
and you are welcome to modify and redistribute it under the GPL license

Dumps a MySQL binary log in a format usable for viewing or for piping to
the mysql command line client

Usage: mysqlbinlog [options] log-files
-d, --database=name List entries for just this database (local log only).
-D, --disable-log-bin
                      Disable binary log. This is useful, if you enabled
                      --to-last-log and are sending the output to the same
                      MySQL server. This way you could avoid an endless loop.
                      You would also like to use it when restoring after a
                      crash to avoid duplication of the statements you already
                      have. NOTE: you will need a SUPER privilege to use this
                      option.
-f, --force-read    Force reading unknown binlog events.
-?, --help          Display this help and exit.
-h, --host=name     Get the binlog from server.
-o, --offset=#      Skip the first N entries.
-p, --password[=name]
                      Password to connect to remote server.
-P, --port=#        Use port to connect to the remote server.
-j, --position=#    Deprecated. Use --start-position instead.
--protocol=name     The protocol of connection (tcp,socket,pipe,memory).
-r, --result-file=name
                      Direct output to a given file.
-R, --read-from-remote-server
                      Read binary logs from a MySQL server
--open_files_limit=#
                      Used to reserve file descriptors for usage by this
                      program
-s, --short-form    Just show the queries, no extra info.
-S, --socket=name   Socket file to use for connection.
--start-datetime=name
                      Start reading the binlog at first event having a datetime
                      equal or posterior to the argument; the argument must be
                      a date and time in the local time zone, in any format
                      accepted by the MySQL server for DATETIME and TIMESTAMP
                      types, for example: 2004-12-25 11:25:56 (you should
                      probably use quotes for your shell to set it properly).
--stop-datetime=name
                      Stop reading the binlog at first event having a datetime
                      equal or posterior to the argument; the argument must be
                      a date and time in the local time zone, in any format
                      accepted by the MySQL server for DATETIME and TIMESTAMP
                      types, for example: 2004-12-25 11:25:56 (you should
                      probably use quotes for your shell to set it properly).
--start-position=# Start reading the binlog at position N. Applies to the
                      first binlog passed on the command line.
--stop-position=#   Stop reading the binlog at position N. Applies to the
                      last binlog passed on the command line.
-t, --to-last-log   Requires -R. Will not stop at the end of the requested
                      binlog but rather continue printing until the end of the
                      last binlog of the MySQL server. If you send the output
                      to the same MySQL server, that may lead to an endless
                      loop.
-u, --user=name     Connect to the remote server as username.
-l, --local-load=name
                      Prepare local temporary files for LOAD DATA INFILE in the
                      specified directory.
-V, --version       Print version and exit.

Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- -----------------------------
database                          (No default value)
disable-log-bin                   FALSE
force-read                        FALSE
host                              (No default value)
offset                            0
port                              3306
position                          4
read-from-remote-server           FALSE
open_files_limit                  64
short-form                        FALSE
socket                            (No default value)
start-datetime                    (No default value)
stop-datetime                     (No default value)
start-position                    4
stop-position                     18446744073709551615
to-last-log                       FALSE
user                              (No default value)
local-load                        (No default value)

分享到:
评论

相关推荐

    在RedHat_AS5.0下搭建Apache+MySQL+PHP+Tomcat+JSP平台

    在Red Hat AS5.0操作系统下搭建Apache+MySQL+PHP+Tomcat+JSP平台是一项常见的Web服务配置任务,这个组合常被称为LAMP(Linux + Apache + MySQL + PHP)加上JSP支持,提供了强大的Web应用环境。以下是详细的搭建步骤...

    Linux下安装配置 Apache2.2.x+MySql5.x+PHP5.x 详解

    Linux 下安装配置 Apache2.2.x+MySql5.x+PHP5.x 详解 本篇文章详细介绍了在 Linux 操作系统下安装和配置 Apache2.2.x、MySql5.x 和 PHP5.x 的步骤,使用的操作系统为 Redhat AS5,内核版本为 Linux 2.6.18-8.el5,...

    在Redhat_Enterprise_Linux_AS_4_Update_4上安装Oracle_10g_RAC

    在Redhat_Enterprise_Linux_AS_4_Update_4上安装Oracle_10g_RAC

    Redhat AS5 安装手册

    NULL 博文链接:https://kdisk-sina-com.iteye.com/blog/706485

    基于Redhat_Enterprise_Linux_AS_5_的_XEN安装与配置

    ### 基于Redhat Enterprise Linux AS 5 的 Xen 安装与配置 #### 简介 Xen 是一种开源虚拟化技术,它通过在物理硬件之上添加一个额外的虚拟化层——虚拟硬件监控器(VMM),来实现对硬件资源的分割,从而能够支持在...

    RedHat linux 4.0 as 下 apache+mysql+php的基本配置

    本教程将详细讲解如何在Red Hat Linux 4.0 AS上配置Apache、MySQL和PHP。 首先,确保您已经准备了以下组件的源代码包: 1. MySQL: mysql-5.0.45.tar.gz 2. Apache: httpd-2.2.11.tar.gz 3. PHP: php-5.2.9.tar.gz ...

    Linux_RedHat下安装MySQL

    在Linux RedHat环境下安装MySQL是一项基础且重要的任务,尤其对于那些需要在服务器上部署数据库服务的开发者和系统管理员来说。MySQL是一种广泛使用的开源关系型数据库管理系统(RDBMS),它以其高效、稳定和易于...

    Redhat_Enterprise_Linux_5_3_Server_x64_DVD

    Redhat_Enterprise_Linux_5_3_Server_x64_DVD

    RedHat_Linux6.3下Oracle_11g安装图解教程

    本教程将指导读者在RedHat_Linux6.3环境下安装Oracle_11g数据库。安装过程可以分为四个步骤:安装Linux操作系统、配置Linux系统下的Oracle安装环境、安装Oracle软件和数据库、测试运行安装的Oracle系统。 一、安装...

    Apache_OpenOffice_4.1.7_Linux_x86_install-rpm_zh-CN.tar.gz

    在Linux环境中安装Apache OpenOffice 4.1.7的步骤通常包括解压下载的".tar.gz"文件,然后使用RPM命令进行安装。例如,用户可能需要执行以下命令: 1. 解压文件:`tar -zxvf Apache_OpenOffice_4.1.7_Linux_x86_...

    基于Redhat_Enterprise_Linux_AS_5.5_的_XEN安装与配置

    ### 基于Redhat Enterprise Linux AS 5.5 的 Xen 安装与配置 #### 简介 Xen 是一种开源的虚拟化技术,它可以在一台物理服务器上运行多个独立的操作系统实例,这些实例被称为“域”(Domains)。Redhat Enterprise ...

    Redhat_Linux_下安装Oracle_9i图文教程.doc

    Redhat_Linux_下安装Oracle_9i图文教程

    Linux AS4下安装安装mysql

    以下是在RedHat Linux AS4上安装MySQL 5.0.27的详细步骤和解决常见问题的方法。 首先,你需要从官方网站下载MySQL的源码包,解压缩后进入安装目录。在这个例子中,我们假设源码包已解压至当前目录。执行以下命令来...

    linux下Apache+PHP+MySQL配置攻略redhat7.2

    ### Linux下Apache+PHP+MySQL配置攻略(Red Hat 7.2) #### 一、系统要求 本配置攻略适用于Red Hat 7.2版本。如果你正在使用的操作系统版本与此不同,请根据实际情况调整步骤。 #### 二、服务器端软件要求 1. **...

    linux redhat5下安装oracle11g

    标题:Linux Redhat5 下安装 Oracle11g 描述:本文将根据作者的实际安装经验,提供一步步的安装指导,旨在帮助读者顺利地安装 Oracle 11g 在 Redhat 5 操作系统下。 标签:Linux Redhat5 Oracle 安装 VMware 安装...

    Linux_Redhat5下手工安装配置PHP+Mysql+Apche--LAMP环境搭建(转)

    ### Linux Redhat5下手工安装配置PHP+MySQL+Apache -- LAMP环境搭建 本文将详细介绍如何在Redhat5系统上手动搭建LAMP(Linux + Apache + MySQL + PHP)环境。LAMP是一种流行的开源Web服务器软件堆栈组合,适用于...

Global site tag (gtag.js) - Google Analytics