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内核

    实验前准备:在https://www.kernel.org/下载内核 这里我们下载的是:linux-4.14.10.tar.xz du -sh /app/linux.tar/ 此命令可查看内核文件大小 编译完成后/lib/modules下会生成4.14.10版的内核 1,tar xvf linux-4.14.10.tar.xz -C /app/解压缩准备好的…

    2018-01-03
  • DevOps如何重构IT战略

    翻译: 至尊宝 原文: http://www.citeworld.com/article/2897738/development/how-devops-can-redefine-your-it-strategy.html?page=2   DevOps究竟是昙花一现还是你一直在寻找的竞争优势?我们咨询了一些专家,对于这种趋势他们的想法是什…

    Python干货 2015-03-26
  • 数据库简介和简单操作

    数据库 数据库是数据的汇集,它以一定的形式存储在存储介质上 数据库的发展史 萌芽阶段:文件系统,使用磁盘文件来存储数据 初级阶段:第一代数据库,出现了网状模型、层次模型的数据库 中级阶段:第二代数据库,关系型数据库和结构化查询语言 高级阶段:新一代数据库,“关系-对象”型数据库 数据库管理系统和文件管理系统 文件管理系统的缺点是: 编写应用程序不方便 数据冗…

    2017-12-04
  • 笔记整理:权限管理1-基础权限管理&默认权限

    权限管理: 权限的分配根据owner和group来进行分配的   对于文件,各个权限的意义: r:可以使用工具查看内容 w:往里写 x:运行,提请内核发起一个进程 对于目录,各个权限的意义: r:用ls 查看目录列表   w:可以创建或删除目录中的文件   x:可以使用ls -l查看文件列表,也可cd进去   管理命令…

    Linux干货 2016-08-05
  • 作业——2016-10-17

    1 生产环境发现一台服务器系统时间产生偏差,造成服务异常,请帮忙校正。     将系统时间同步到硬件时间的命令是hwclock -s 2 生产有一个数据同步脚本需要执行很长时间,怎样做到无人值守,在管理工具退出的情况下,脚本依然能正常运行。     screen -S work  进去后开始做工作,暂时离开时…

    Linux干货 2016-10-18
  • 计算机基础

    计算机系统 计算机系统由两大部分组成硬件系统(Hartware)和软件系统(Software) 硬件系统:主要由中央处理器、存储器、输入输出控制系统和各种外部设备组成。中央处理器是对信息进行高速运算处理的主要部件,其处理速度可达每秒几亿次以上操作。存储器用于存储程序、数据和文件,常由快速的主存储器(容量可达数百兆字节,甚至数G字节)和慢速海量辅助存储器(容量…

    Linux干货 2017-05-20