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

相关推荐

  • 文件共享服务之SAMBA

    文件共享服务之SAMBA 文件共享服务之SAMBA 一、samba出现的意义 二、samba协议描述 三、samba为客户端的实现 四、samba为服务端的实现 五、使用图形界面配置SAMBA 一、samba出现的意义 首先nfs实现系统文件挂载linux与linux之间,linux到windows之间实现的并不是那么理想 FTP可以实现linux和wind…

    Linux干货 2016-04-19
  • Linux的常见文件类型

      在linux中,文件的类型和权限通常以【-rwxr-xr-x】来表示,文件以第一个字符来表示不同的文件类型,具体如下。   – :普通文件;颜色为灰白色   d :目录文件;颜色为蓝色   b :块设备文件;颜色为黄色   c :字符设备文件;颜色为黄色   p :管道文件;颜色为绿…

    Linux干货 2016-10-20
  • N22-第十周作业

    第十周    1、请详细描述CentOS系统的启动流程(详细到每个过程系统做了哪些事情)    POST–>BootSequence(BOIS)–>BootLoader(MBR)–>Kernel(ramfs或者ramdisk)–&gt…

    Linux干货 2016-11-07
  • ansible自动化运维工具使用详解

    一、ansible简介   1.ansible        ansible是新出现的自动化运维工具,基于Python研发。糅合了众多老牌运维工具的优点实现了批量操作系统配置、批量程序的部署、批量运行命令等功能。仅需在管理工作站上安装ansible程序配置被管控主机的IP信息,被…

    2016-04-30
  • Linux的文件系统的基础目录、帮助、部分命令介绍

    Linux的文件系统的基础目录、帮助、部分命令介绍 目录 linux基础目录 Linux获取帮助 相关控制命令,翻屏等 部分命令介绍 linux的基础目录 Bin: 共所有用户使用的基本命令,就是二进制程序 Sbin:系统的二进制程序。供管理员使用的 Boot:基本的加载器,引导加载器所依赖的各种静态文件 Dev:设备文件和特殊文件 其中设备分为两种类型,字…

    Linux干货 2016-10-29
  • ifcfg家族命令介绍

    ifcfg家族命令: ifconfig ifconfig [interface] add<地址>:设置网络设备IPv6的ip地址; del<地址>:删除网络设备IPv6的IP地址; down:关闭指定的网络设备;<硬件地址>:设置网络设备的类型与硬件地址; io_addr:设置网络设备的I/O地址; irq:设置…

    Linux干货 2016-07-29