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

相关推荐

  • CentOS 7 RPM包方式安装LAMP

    细节要求: (1) 三者分离于两台主机; (2) 一个虚拟主机用于提供phpMyAdmin;另一个虚拟主机用于提供wordpress; (3) 提供xcache加速; (4) 为phpMyAdmin提供https虚拟主机; 一、准备CentOS 7主机环境以及Repo仓库提供基于rpm安装包方式的程序包安装源 安装主机程序包规划: 主机1:web-serve…

    Linux干货 2017-02-16
  • 互联网的实现

    互联网的实现 全世界几十亿台电脑,连接在一起,两两通信。上海的某一块网卡送出信号,洛杉矶的另一块网卡就收到了,两者实际上根本就不知道对方的物理位置,这难道不是一件很神奇的事情吗? 互联网的**核心**是一些列协议,总称为“互联网协议”(Internet Protocol Suite)。它们对电脑如何连接和组网做出了详细的规定。 互联网协议入门 概述 五层模型…

    Linux干货 2017-05-05
  • python装饰器详解

    python之装饰器详解 一、装饰器定义 定义一个函数,可以接受一个函数作为参数,对该函数进行一些包装,不改变函数的本身。 二、装饰器四部曲(分解) 1、函数可赋值给变量。若赋值给变量的是调用后的函数,变量的值就是return的返回值。 切记:函数赋值给变量,只看return的值。分清楚函数是处于调用状态还是未被调用状态。若函数没有写return,默认ret…

    2017-02-08
  • 文件查询、yum安装等零散知识点总结

    归纳重要知识点:文件查询、Linux配置文件、文件的压缩与归档、yum安装包文件   这篇博客介绍以前遗落的重要知识点进行归纳总结,分为四大块:文件查询命令、全局与个人配置文件、文件的压缩与归档、yum命令安装程序包的相关条件与操作。下面结合个人理解与学习内容一一进行总结。     一.文件查询命令locate与find &nb…

    Linux干货 2016-08-26
  • 马哥教育网络班21期第4周课程练习

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 # cp -r /etc/skel/ /home/tuser1 # chmod -R go= /home/tuser1/ 2、编辑/etc/gr…

    Linux干货 2016-07-27
  • 第一周总结(linux系统初识和简单命令)

    一、linux操作系统初识         了解操作系统之前我们需要先了解一下计算机的硬件组成,因为操作系统都是运行在硬件之上。遵循冯诺依曼体系,计算机是由控制器、运算器、存储器、输入设备、输出设备五部分组成。对应到我们现在使用计算机上硬件分别为:        &nb…

    Linux干货 2016-12-26