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

相关推荐

  • M25 Linux 学习,FHS标准

    FHS FHS(英文:Filesystem Hierarchy Standard 中文:文件系统层次结构标准),多数Linux版本采用这种文件组织形式,FHS定义了系统中每个区域的用途、所需要的最小构成的文件和目录同时还给出了例外处理与矛盾处理。 FHS定义了两层规范,第一层是, / 下面的各个目录应该要放什么文件数据,例如/etc应该要放置设置文件,/bi…

    2017-07-15
  • linux上的组管理

    上一次我们谈了CentOS上的用户管理,现在我们再来谈下CentOS上的用户组管理。 groupadd创建一个新的组 用法如下: groupadd [选项] groupname 常用选项: -f 强制添加一个组(这个组可能已经存在系统中) -g 指定组的id; -r 创建系统工作组(系统工作组的组ID小于500) -K 覆盖配置文件/ect/log…

    Linux干货 2017-04-09
  • 管理分区和文件系统及挂载设备

    管理分区 列出块设备 lsblk       分区工具fdisk fdisk -l /dev/sdX 查看硬盘分区信息 CentOS7: fdisk -l /dev/sda 默认开启dos及扇区显示模式    开启dos及柱面显示模式:fdisk -c=dos -u=cylinders -l /dev/sda…

    2017-08-26
  • Linux用户和组管理

    使用对象:Linux初学者   Linux系统中用户和组管理是很重要的一部分内容。许多初学者在学习或刚接触到用户管理的时候会觉得很难理解,命令多、选项多、配置文件也多,用命令可以修改,用配置文件也可以修改,三两下就被绕进去了。其实完全没必要晕,只要了解了用户管理的方式,就会很容易理解命令选项与配置文件之间的关系。下面我们就来了解下用户管理命令与配置…

    Linux干货 2016-10-23
  • 无痛之ext3升ext4[原创]

    一台文件存储服务器单目录下子目录已经突破31998数限制,造成无法继续创建子目录,服务器系统环境为CentOS5.4 内核版本为2.6.18。解决方案只能是升级到ext4文件系统,首先到https://ext4.wiki.kernel.org/index.php/Ext4_Howto查了一下资料,文中的第一句便是“Ext4 was released as a…

    Linux干货 2015-03-27