lamp的搭建

方法一编译安装amp:

  1.系统环境:CentOS 6,7

      CentOS6:apr,apr-util的版本为1.3.9,不适合httpd-2.4

  1.    CentOS7:apr,apr-util的版本为1.4+
    2.开发环境需要安装:
       Development Tools,Server Platform Development
       #yum -y groupinstall "Development Tools" "Server Platform Development"
    3.确定使用各程序的版本:
       httpd:2.2,2.4 (建议使用2.4版本httpd)
       php:5.3.x,5.4.x,5.6.x(建议安装版本为5.4.x)
       mysql:5.1,5.5,5.6,5.7,5.8,7.0(建议安装5.7)
       mariadb:5.x 10.x (建议安装5.x)
    4.httpd+php编译安装:
       php的编译选项:
        Modules:–with-apxs
        httpd MPM:
        prefork:
        worker, event:专用选项–enable-maintainer-zts
        ftm:–enable-fpm
    编译安装实例:
       CentOS7:httpd-2.4,mariadb,php-5.4
         安装的次序是:httpd mariadb php(因为php有一些安装依赖于httpd和mariadb的文件)
         安装之前的准备:
         yum -y install pcre-devel openssl-devel libevent-devel apr-devel apr-util-devel
         (1)安装httpd:
            # tar xf httpd-2.4.10.tar
            # cd httpd-2.4.10
            # ./configure –prefix=/usr/local/apache2 –sysconfdir=/etc/httpd –enable-so –enable-ssl –enable-cgi –enable-rewrite –enable-modules=most –enable-mpms-shared=all –with-mpm=prefork –with-pcre –with-zlib –with-apr=/usr –with-apr-util=/usr
            # make -j #
            # make install
            # echo 'export PATH=/usr/local/apache2/bin:$PATH' > /etc/profile.d/httpd.sh
            # . /etc/profile.d/httpd.sh
            # apachectl start
          (2)安装MariaDB:mariadb的源码包编译:项目构建的工具为cmake,而非流行的make
            通用二进制格式包的安装配置步骤:
            # useradd -r mysql
            # tar xf mariadb-VERSION-linux-x86_64.tar.gz -C /usr/local
            # cd /usr/local
            # ln -sv mariadb-VERSION-linux-x86_64
            # cd mysql
            # chown -R root:mysql ./*
            # mkdir -pv /mydata/data
            # chown -R mysql:mysql /mydata/data
            # scripts/mysql_install_db  –user=mysql  –datadir=/mydata/data –skip_name_resolve
          # cp support-files/my-large.cnf  /etc/my.cnf
            # vim /etc/my.cnf
               [mysqld]
               datadir=/mydata/data
               skip_name_resolve = ON
               innodb_file_per_table = ON
            #cp support-files/mysql.server /etc/rc.d/init.d/mysqld
            #chkconfig –add mysqld
        (3)安装php5
            编译安装php:下载php的安装包
                ①作为httpd的模块进行安装:
                 # ./configure –prefix=/usr/local/php5 –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-openssl –enable-mbstring –enable-xml –enable-sockets –with-freetype-dir –with-gd –with-libxml-dir=/usr –with-zlib –with-jpeg-dir –with-png-dir –with-mcrypt –with-apxs2=/usr/local/apache2/bin/apxs –with-config-file-path=/etc/php.ini –with-config-file-scan-dir=/etc/php.d/
                 #make -j # && make install
                ②安装为fpm:
                 # ./configure –prefix=/usr/local/php5 –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-openssl –enable-mbstring –enable-xml –enable-sockets –with-freetype-dir –with-gd –with-libxml-dir=/usr –with-zlib –with-jpeg-dir –with-png-dir –with-mcrypt –enable-fpm –with-config-file-path=/etc/php.ini –with-config-file-scan-dir=/etc/php.d/
                 # make -j # && make install
            复制配置文件:
                 cp php.ini-production /etc/php.ini
            注意:编译php为httpd的模块后, 整合php至httpd:
                  编译/etc/httpd.conf,添加:  
                    DirectoryIndex index.php index.html
                    AddType application/x-httpd-php .php

方法二直接安装amp:

           搭建LAMP环境:
               yum install -y httpd mariadb-server php php-mysql
           配置MariaDB数据库:
               vim /etc/my.cnf
                   [mysqld]下面添加:
                       skip_name_resolve = ON
                       innode_file_per_table = ON
           启动数据库:
               systemctl start mariadb.service
           启动http服务:
               systemctl start httpd.service 

原创文章,作者:sjsir,如若转载,请注明出处:http://www.178linux.com/52231

(0)
sjsirsjsir
上一篇 2016-10-16 20:37
下一篇 2016-10-16 21:49

相关推荐

  • 玩转linux之启动篇

        想要玩转linux,首先明白其启动流程,这里简单说明一下: CentOS 6启动流程:    POST –> Boot Sequence(BIOS) –> Boot Loader –> Kernel(ramdisk) –> roo…

    Linux干货 2016-09-26
  • NFS(Network File System)介绍与应用(双httpd + php-fpm + nfs + mysql 搭建discuz论坛)

    NFS相关介绍 一、NFS简介     1. NFS(Network File System): NFS是一个文件共享协议, 也是是在类Unix系统中在内核中实现的文件系统。      2. 起源: 最早是由SUN公司研发,非常古老,只是实现文件共享,安全控制方面比较简…

    Linux干货 2015-07-21
  • N26 – 第二周作业

    1、文件管理类命令和常用使用方法 2、bash命令执行后返回值,和目录展开:     命令执行返回值,存储在“$?”这个特殊变量内。可以使用echo显示或在shell脚本中引用。其中0表示正常执行完成,1-255表示不同的错误类型。     目录展开的特殊符号:  &n…

    Linux干货 2016-12-30
  • bash特性

    一、命令历史     概念:shell进程能够将之前执行过的命令保存记录下来     存储位置:         1、命令历史的文件             使用以下环境变量查看相关参数:     &…

    Linux干货 2016-09-19
  • 磁盘配额的限制

    用一个块新的分区当做硬盘进行磁盘的配额限制实验 堆一块新的硬盘进行三步骤 分区,格式化,挂载 以/dev/sdb为例  (1) 分区: fdisk /dev/sdb sdb 8:16 0 200G 0 disk └─sdb1 8:17 0 10G 0 part (2) 格式化: mkfs.ext4 /dev/sdb1 /dev/sdb1: UUID…

    Linux干货 2017-04-30
  • vim编辑器

    在使用Linux的管理过程中有很多的工作就是要修改或设置某些重要软件的配置文件,这些配置文件都是以ASCLL的纯文本格式存在的,所以能够学好一个文本编辑器就至关重要了,vim作为高级版的vi编辑器不仅可以用不同的颜色来高亮显示某些重要关键字或字符还能进行如shell脚本的编写,c程序的编辑等功能。 vim编辑器和nano编辑器是一个全屏的编辑器。vim打开文…

    Linux干货 2016-12-20