6上编译安装apache2,LAMP环境配置安装注意安装步
分类:电脑系统

在centos6.6上安装apache2.4+php5.6+mysql5.6

(一)安装gcc

  glibc-devel
        glibc-headers  ==>依赖项
           kernel-headers  ==>依赖项
      libgomp
   gcc-c++
      libstdc++-devel  ==>依赖项

 

(二)安装zlib压缩库

zlib-1.2.5.tar.gz
shell> cd /home/shuhua/tar
shell> tar –zxvf zlib-1.2.5.tar.gz
shell> cd zlib-1.2.5
shell> ./configure //这个配置编译命令不要加目录参数
shell>make && make install

关于wget的安装

将之前装系统的.iso文件挂载到光驱

 

由于我在/home/jinnan/下建立了一个cdrom文件夹

 

Shell>#mount /dev/cdrom  /home/jinnan/cdrom

 

Shell># cd /home/jinnan/cdrom

 

Shell># ls

 

Shell># cd Packages

 

Shell>#ls | grep wget

 

Shell># rpm -ivh wget-1.12-5.el6.x86_64.rpm

 

测试wget能否下载文件

 

Shell># wget

 

 

依赖软件查询:

 

 

关于lamp环境安装的需要软件的下载地址:

freetype:   

 

libxml2:    

 

jpegsrc:     

 

libpng:     

 

zlib:         

 

libgd:         

 

php:         

 

apache:         

 

apr / apr-util:     

 

pcre:        

 

cmake:         

 

mysql:国内镜像站下载:

           台湾镜像站:

           官方下载:   

 

怎样从Mysql官网下载mysql.tar.gz版本的安装包:

【如果压缩包为.tar.bz2,那么解压命令为 tar jxvf  ****.tar.bz2】

 

(三)安装apache

shell> cd /home/shuhua/tar
shell> tar -jxvf httpd-2.2.19.tar.bz2
shell> cd httpd-2.2.19
shell>./configure --prefix=/usr/local/http2  
      --enable-modules=all 
      --enable-rewrite 
      --enable-mods-shared=all 
      --enable-so
shell> make && make install

#启动Apache

shell> /usr/local/http2/bin/apachectl start

#测试apache

浏览器打开:

看到 "it works!",即为成功

配置虚拟主机

1)配置host文件

打开C:/windows/system32/drivers/etc/hosts 文件

增加域名记录

如:

192.168.1.246 www.ec1.com

192.168.1.246 www.ec2.com

2) 增加虚拟主机

vi /usr/local/http2/conf/httpd.conf
取消#Include conf/extra/httpd-vhosts.conf
这一行前面的#号
保存退出

增加虚拟主机记录

 vi /usr/local/http2/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>

           ServerAdmin webmaster@dummy-host.example.com

           DocumentRoot "/usr/local/http2/htdocs/ec1"

           ServerName www.ec1.com

           ServerAlias www.dummy-host.example.com

           ErrorLog "logs/dummy-host.example.com-error_log"

           CustomLog "logs/dummy-host.example.com-access_log" common

</VirtualHost>

<VirtualHost *:80>

           ServerAdmin webmaster@dummy-host2.example.com

            DocumentRoot "/usr/local/http2/htdocs/ec2"

           ServerName www.ec2.com

           ErrorLog "logs/dummy-host2.example.com-error_log"

           CustomLog "logs/dummy-host2.example.com-access_log" common

</VirtualHost>

3)

      shell> cd /usr/local/http2/htdocs
      shell> mkdir ec1 ec2
      shell> echo this is ec1.com > ec1/index.html
      shell> echo this is ec2.com > ec2/index.html

4)重启apache

/usr/local/http2/bin/apachectl restart

5)浏览器打开www.ec1.com,和www.ec2.com

看到不同的网站内容,虚拟主机创建完毕!

安装图形库,为编译PHP做准备

libxml2-2.7.2.tar.gz

jpegsrc.v8b.tar.gz

libpng-1.4.3.tar.gz     

freetype-2.4.1.tar.gz

gd-2.0.35.tar.gz

 

(四)             安装libxml2

   shell> cd /home/shuhua/tar

shell> tar zxvf libxml2-2.7.2.tar.gz

shell> cd libxml2-2.7.2

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

shell> make && make install

 

(五)             安装jpeg8

   shell> cd /home/shuhua/tar

shell> tar -zxvf jpegsrc.v8b.tar.gz

shell> cd jpeg-8b

shell>./configure --prefix=/usr/local/jpeg

--enable-shared --enable-static

shell> make && make install

 

(六)             安装libpng

   shell> cd /home/shuhua/tar

shell> tar zxvf libpng-1.4.3.tar.gz

shell> cd libpng-1.4.3

shell>./configure  #和zlib一样不要带参数,让它默认安装到相应目录

shell> make && make install

 

(七)             安装freetype

   shell> cd /home/shuhua/tar

shell> tar zxvf freetype-2.4.1.tar.gz

shell> cd freetype-2.4.1

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

shell> make && make install

 

(八)             安装GD库

      shell> cd /home/shuhua/tar

shell> tar -zvxf gd-2.0.35.tar.gz

shell> mkdir -p /usr/local/gd

shell> cd gd-2.0.35

shell>./configure --prefix=/usr/local/gd 

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

         --with-png --with-zlib

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

shell> make && make install

 

(九)             安装 php5

       shell> cd /home/shuhua/tar

shell> tar -jxvf php-5.3.6.tar.bz

shell> cd php-5.3.6

shell>./configure --prefix=/usr/local/php

         --with-apxs2=/usr/local/http2/bin/apxs

         --with-mysql=mysqlnd

         --with-pdo-mysql=mysqlnd

         --with-mysqli=mysqlnd

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

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

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

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

         --with-png-dir

         --enable-mbstring=all

         --enable-mbregex

         --enable-shared

shell> make && make install

shell> cp php.ini-development /usr/local/php/lib/php.ini

 

       配置Apache使其支持php

       vi /usr/local/http2/conf/httpd.conf

1)        在httpd.conf(Apache主配置文件)中增加:

AddType application/x-httpd-php .php  

 

2)        找到下面这段话:

<IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

在index.html 前面添加index.php

 

3)        建立php测试网页

vi /usr/local/apache2/htdocs/index.php 

输入如下内容:

<?php

phpinfo();

?>

 

4)        重启apache

shell> /usr/local/http2/bin/apachectl restart

 

5)        再次浏览器查看

如果看到php信息,工作就完成了!

 

(十)             安装MySQL

1)        编译安装MySQL

shell> cd /home/shuhua/tar

shell> tar -xzvf mysql-5.1.30.tar.gz

shell> cd mysql-5.1.58

shell> ./configure --prefix=/usr/local/mysql  

      --with-charset=utf8      

      --with-extra-charsets=gbk,gb2312,binary

shell> mount .....挂载光盘
   shell> rpm -ivh libtermcap-devel-2.0.8-46....

shell> make && make install

 

2)        配置并初始化MySQL

   shell> groupadd mysql

shell> useradd  -g mysql mysql

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

shell> cd /usr/local/mysql

shell> chown -R mysql.mysql . 

shell> bin/mysql_install_db --user=mysql

--datadir=/usr/local/mysql/var

shell> chown -R root .

shell> chown -R mysql var

shell> bin/mysqld_safe --user=mysql & 

 

3)        测试数据库

shell> bin/mysql –uroot

mysql> show databases;

 

4)        接上步,修改mysql密码(可不做此步,默认无密码)

mysql>UPDATE user SET

password=PASSWORD('new_password')    

WHERE user='root';

mysql>flush privileges;

 

安装gcc:

安装gcc的时候gcc的几个依赖关系如下,lib【是library的缩写】,比如libppl,ppl代表的是包名或软件名

gcc

         cloog-ppl

                   ppl(libppl.so.7/libppl_c.so.2)

         cpp

                   mpfr(libmpfr.so.1)

gcc-c++

         libstdc++-devel

================================================================

 

 

apr安装【apr-1.6.2.tar.gz】

 

shell>#tar zxvf apr-1.6.2.tar.gz

 

shell>#cd apr-1.6.2

 

shell>#./configure --prefix=/usr/local/apr1.6

 

shell>#make && make install

 

安装apr-util:【 apr-util-1.5.4.tar.gz】

 

shell>#tar zxvf apr-util-1.5.4.tar.gz

 

shell>#cd apr-util-1.5.4

 

 

shell>#./configure --prefix=/usr/local/apr-util1.4

         --with-apr=/usr/local/apr1.6/

 

shell>#make && make install

 

=============================================================

安装pcre:【 pcre-8.34.tar.gz】

 

 shell>#./configure --prefix=/usr/local/pcre

 

 shell>#make && make install

 

==========================================================

安装apache2.4【httpd-2.4.27.tar.gz】

 

 shell>#tar zxvf httpd-2.4.27.tar.gz

 

 shell>#cd httpd-2.4.27

 

shell>#./configure --prefix=/usr/local/apache2.4

         --with-apr=/usr/local/apr1.6

         --with-apr-util=/usr/local/apr-util1.4

         --with-pcre=/usr/local/pcre

         --enable-modules=all

         --enable-mods-shared=all

         --enable-so

         --enable-rewrite

 

安装zlib【zlib-1.2.11.tar.gz】

shell>#tar zxvf zlib-1.2.11.tar.gz

 

shell>#cd zlib-1.2.11

 

shell>#./configure

shell>#make && make install

============================================================

 

安装libxml2【libxml2-2.7.3.tar.gz】

 

shell>#tar zxvf libxml2-2.7.3.tar.gz

 

shell>#cd libxml2-2.7.3

 

shell>#./configure --prefix=/usr/local/libxml2 

         --without-zlib

 

shell>#make && make install

=========================================================

安装jpeg【jpegsrc.v9b.tar.gz】

 

shell>#tar zxvf jpegsrc.v9b.tar.gz

 

shell>#cd jpegsrc.v9b

 

shell>#./configure --prefix=/usr/local/jpeg

         --enable-shared --enable-static

 

make && make install

==================================================

本文由威尼斯手机娱乐官网发布于电脑系统,转载请注明出处:6上编译安装apache2,LAMP环境配置安装注意安装步

上一篇:没有了 下一篇:Linux安装JDK完整步骤
猜你喜欢
热门排行
精彩图文