Red Hat 下 安装 Apache Mysql PHP

本文详细介绍如何从零开始搭建LAMP(Linux + Apache + MySQL + PHP)环境,包括各组件的安装配置过程,如Apache服务器、MySQL数据库及PHP解析器等,并介绍了如何安装额外组件如GD库、ZEND加速器及PHPMyAdmin。
摘要由CSDN通过智能技术生成

准备

 

ls  /usr/local/src   //  显示文件列表

 

ls  | wc -l    //  查看当前文件目录下文件的个数

 

gcc -v   // 查看编译工具是否存在

 

 

rpm -qa|grep -i  xxxx  // 查看系统中是否已经安装了某软件的相关软件包

 

 

rpm -e --nodeps xxxx // 卸载软件包

 

 

一  GD 的安装

 

1 libxml2-2.6.30.tar.gz

 

mkdir  /usr/local/src/

tar zxvf libxml2-2.6.30.tar.gz

cd libxml2-2.6.30

./configure --prefix=/usr/local/libxml2

make

make install

 

2 libmcrypt-2.5.8.tar.gz

 

mkdir /usr/local/libmcrypt

tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure --prefix=/usr/local/libmcrypt

make

make install

 

cd /usr/local/src/libmcrypt-2.5.8/libltdl

./configure --enable-ltdl-install

make

make install

 

3  zlib-1.2.3.tar.gz

 

mkdir /usr/local/zlib

tar zxvf  zlib-1.2.3.tar.gz

cd zlib-1.2.3

./configure --prefix=/usr/local/zlib

make

make install

 

4 libpng-1.2.31.tar.gz

 

mkdir /usr/local/libpng

tar zxvf libpng-1.2.31.tar.gz

cd libpng-1.2.31

./configure --prefix=/usr/local/libpng

make

make install

 

5 jpeg6

 

mkdir /usr/local/jpeg6

mkdir /usr/local/jpeg6/bin

mkdir /usr/local/jpeg6/lib

mkdir /usr/local/jpeg6/include

mkdir -p /usr/local/jpeg6/man/man1

 

tar zxvf jpegsrc.v6b.tar.gz

cd jpeg-6b 

./configure /

--enable-shared /

--enable-static

make

make install

 

6 freetype

 

mkdir /usr/local/freetype

tar zxvf freetype-2.3.5.tar.gz

cd freetype-2.3.5

./configure --prefix=/usr/local/freetype

make

make install

 

7 autoconf

 

tar zxvf autoconf-2.6.1.tar.gz

cd autoconf-2.6.1

./configue

make

make insatll

 

 

8 GD2

 

mkdir /usr/local/gd2

tar zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

./configure /

--prefix=/usr/local/gd2/  /

--with-zlib=/usr/local/zlib/ /

--with-jpeg=/usr/local/jpeg6/ /

--with-png=/usr/local/libpng/ /

--with-freetype=/usr/local/freetype/

make

make install

 

 

 

二 Apache 的安装

1 安装apache

 mkdir /usr/local/apache2

 tar zxvf httpd-2.2.9.tar.gz

 cd httpd-2.2.9

 ./configure /

 --prefix=/usr/local/apache2/ /

 --sysconfigdir=/etc/httpd /

 --with-z=/usr/local/zlib /

 --with-included-apr /

 --disable-userdir /

 --enable-so /

 --enable-deflate=shared /

 --enable-expires=shared /

 --enable-rewrite=shared /

 --enable-static-support

 

 make

 make install

 

 

  

 

 

2 编辑apache

gedit /etc/httpd/conf/httpd.conf

Directoryindex  加上index.php

 

servername localhost:80

 

 

/usr/local/apache2/bin/apachectl start stop restart

 

开机启动Apache

echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local

 

创建httpd 启动脚本

 

cp /usr/local/apache2/bin/apachectl    /etc/init.d/httpd

 

编辑httpd

 

gedit /etc/init.d/httpd

 

第三行加入

 

#chkconfig : 345  85  15

#description : start and stop the Apache HTTP Server

chmod +x /etc/rc.d/init.d/httpd

chkconfig --add httpd

 

修改乱码

 

httpd.conf 中 注释掉httpd-autoindex

httpd-autoindex.conf 中加入  IndexOptions charset=UFI-8

 

 

三 Mysql的安装配置

 

tar -zxvf mysql -5.1.45-linux-i686.....tar.gz

mv mysql-5.1.45 .......  /usr/local/Mysql

cd /usr/local/mysql

groupadd mysql

useradd -g mysql  mysql

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

chown -R mysql .

chgrp  -R mysql .

scripts/my_install_db --user=mysql

chown -R root .

chown -R mysql data

bin/mysql_safe --user=mysql&

bin/mysqladmin -u root -password 123456

bin/mysql -u root -p

 

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

chmod 700 /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig --level 345 mysqld on

service mysqld start stop restart reload force-reload status

 

 

三 PHP的安装

 

mkdir /usr/local/php

tar zxvf php-5.2.6.tar.gz

cd php-5.2.6

./configure /

--prefix=/usr/local/php /

--with-config-file-path=/usr/local/php/etc /

--with-apxs=/usr/apache2/bin/apxs /

--with-mysql=/usr/local/mysql /

--with-libxml-dir=/usr/local/libxml2 /

--with-png-dir=/usr/local/libpng /

--with-jpeg-dir=/usr/local/jpeg6 /

--with-freetype-dir=/usr/local/freetype /

--with-gd=/usr/local/gd2 /

--with-zlib-dir=/usr/local/zlib /

--with-mcrypt=/usr/local/libmcrypt /

--with-mysqli=/usr/local/mysql/bin/mysql_config /

--enable-soap /

--enable-mbstring=all /

--enable-sockets

 

make

make install

cp php.ini-disk  /usr/local/php/etc/php.ini

gedit /etc/httpd/httpd.conf

Addtype application/x-httpd-php .php

/usr/local/apache2/bin/apachectl stop

/usr/local/apache2/bin/apachectl start

vi  test.php

 

四  安装ZEND 加速器

./install.sh

 

五 安装PHPMYADMIN

 

tar zxvf phpmyadmin-xxx

cp -a phpmyadmin-xxx   /usr/local/apache2/htdocs/phpmyadmin

cd /usr/local/apache2/htdocs/phpmyadmin/

cp  config.sample.inc.php  config.inc.php

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值