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

相关推荐

  • iptables基础实战练习

    (1) 放行ssh (端口:22) 1 iptables -A INPUT -d 192.168.42.153 -p tcp –dport 22 -j ACCEPT 2 iptables -A OUTPUT -s 192.168.42.153 -p tcp –sport 22 -j ACCEPT (2)修改默认规则链(关闭所有端口) 1 iptables…

    2017-09-10
  • vim

    VIM是什么? Vim是从VI发展出来的一个文本编辑器,拥有许多丰富的功能,便于编程开发,在程序员中被广泛使用,是类Unix系统用户最喜欢的功能强大的跨平台文本文件编辑工具。 为什么要用VIM? vi编辑器是所有类UNIX系统下标准的编辑器,他是我们使用Linux系统不能缺少的工具。对于所有类UNIX系统的任何版本,vi编辑器是完全相同的。而vim是从VI发…

    2017-06-07
  • 初入Linux世界 —马哥教育网络班N22_第三周课程练习

    一、列出当前系统上所有已经登录的用户的用户名,注意:同一个用户登录多次,则只显示一次即可。           [root@Alien ~]# who |cut -d ' ' -f1|sort -u       root 二、取出最后登录到当前系统的用户的相关…

    Linux干货 2016-09-19
  • N21 第八周 总有刁民想害朕

    1、请描述网桥、集线器、二层交换机、三层交换机、路由器的功能、使用场景与区别。 网桥将两个相似的网络连接起来,并对网络数据的流通进行管理。它工作于数据链路层,不但能扩展网络的距离或范围,而且可提高网络的性能、可靠性和安全性。 集线器的英文称为“Hub”。主要功能是对接收到的信号进行再生整形放大,以扩大网络的传输距离,同时把所有节点集中在以它为中心的节点上。它…

    Linux干货 2016-09-15
  • MBR分区结构

    MBR分区结构 一、硬盘主引导记录MBR由4个部分组成: 1、主引导程序(偏移地址0000H–0088H),它负责从活动分区中装载,并运行系统引导程序。 2、出错信息数据区,偏移地址0089H–00E1H为出错信息,00E2H–01BDH全为0字节。 3、分区表(DPT,Disk Partition Table):含4个分…

    2017-08-20
  • yum初步入门

                             yum工具是为提高RPM软件安装性而开发的一种软件包管理器,是由pyt…

    Linux干货 2015-04-01