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
下一篇 2016-10-16

相关推荐

  • 虚拟化介绍、以及kvm

    什么是虚拟化? 在计算机领域中虚拟化,和我们平时说的虚拟化并没有什么两样,说白了就是一个虚拟出来的东西罢了,并不是真实存在的。 虚拟化的历史 虚拟化早在20实际60年代末,由IBM开发被命名为vmm(Virtual Machine Monitor)虚拟机监视器的软件,我们知道那时候工艺技术并不发达,电脑也不像现在这样属于每家每户的标配,IBM为了解决电脑使用…

    2017-03-08
  • Linux包管理:rpm/yum/编译安装

    rpm:安装,查询,升级,校验,卸载   Topic: 程序包 rpm管理 yum管理   程序包:   什么是程序包管理器: 将编译好的应用程序的各个组成文件打包成一个或几个程序包文件,从而更方便地实现程序包的安装、升级、卸载和查询等管理操作   程序包的组成清单: 文件清单 安装或卸载时运行的脚本 数据库(公共) …

    2017-09-14
  • 【社招】【小米-北京】大数据运维工程师

    【社招】【小米-北京】大数据运维工程师 【工作地点】北京市海淀区安宁庄东路72号科利源大厦 【薪酬福利】15k-30k  期权奖励、六险一金、水果花茶、班车、健身房、食堂 【投递方式】邮件主题“岗位+姓名”发送至lipengcheng3@xiaomi.com   工作职责: 1、负责大数据平台相关系统的运维保障,包括:Hadoo…

    Linux干货 2017-07-28
  • raid 5 软件实现

    raid 5        RAID 5是一种存储性能、数据安全和存储成本兼顾的存储解决方案。 RAID 5可以理解为是RAID 0和RAID 1的折中方案。RAID 5可以为系统提供数据安全保障,但保障程度要比Mirror低而磁盘空间利用率要比Mirror高。RAID 5具有和RAID 0相近似的…

    2017-05-02
  • 从案例出发——命令总结之find篇

    在这篇文章中你将看到以下内容:1、find命令的格式、语法、及实际应用 2、3个时间戳的意义  3、各种文件类型的解释  4、软硬链接的区别 5、exec和xargs的区别 6、几个逻辑判断符的意义  7、通配符的意义  8、find 命令下时间查找的特殊定义 首先,来看看以下题目:   &nbsp…

    Linux干货 2016-03-25
  • 【译文】如何正确设定MySQL程序的选项

    MySQL手册文档版本:5.6  章节:4.2 Using MySQL Programs  略去了部分windows下使用mysql的相关的说明 译者:古二娃 时间:2015-03-15 章节目录: 4.2 Using MySQL Programs 4.2.1 Invoking MySQL Programs …

    Linux干货 2015-03-10