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.www58058.com/52231

(0)
sjsirsjsir
上一篇 2016-10-16 20:37
下一篇 2016-10-16 21:49

相關推薦

  • 網卡別名與多網卡綁定

    網卡別名 一塊網卡可以配置多個ip地址,叫做網卡別名   對虛擬主機有用 格式形如:eth0:1  eth0:2 …… 實現方法:   在命令行中臨時設置: ifconfig 命令: ifconfig eth0:0 192.168.1.100/24 演示:   修改配置文件 在/etc/sysconfig/networ…

    Linux干貨 2016-09-05
  • 馬哥教育網絡班22期第5周課程作業

    1、顯示當前系統上root、fedora或user1用戶的默認shell; cat /etc/passwd | grep ^root | cut -d: -f7 2、找出/etc/rc.d/init.d/functions文件中某單詞后面跟一組小括號的行,形如:hello(); …

    Linux干貨 2016-12-05
  • 網絡班22期+第二周作業練習

    常用的文件管理命令: ls,顯示文件或目錄 -l:顯示文件或目錄的包括權限、屬主、屬組大小創建日期等詳細信息 [root@centos7 ~]# ls -l total 16 -rw-r–r–. 1 root root   64 Aug&nbsp…

    Linux干貨 2016-09-05
  • Linux文件管理及bash腳本特性

    馬哥教育網絡班23期+第2周課程練習 Linux文件管理及bash腳本特性 概述,經過前三天的學習,想必我們已經對Linux 有了一個初步的了解,接下來這講我們要講述一下Linux至關重要的文件管理和bash腳本特性等知識要點 一、Linux 文件管理 1.1 原理概述   文件管理對于Linux系統來說至關重要,因為Linux 的哲學思想就是一切…

    Linux干貨 2016-09-19
  • Linux文件及目錄管理

    Linux 文件管理 1、Linux上的文件管理類命令都有哪些,其常用的使用方法及其相關示例演示 目錄管理類命令:mkdir,rmdir mkdir [OPTION]… DIRECTORY… -p:自動按需創建父目錄; -v顯示詳細過程; -m MODE直接給定權限; rmdir 移除空目錄 rmdir&nbs…

    Linux干貨 2016-10-09
  • Linux 基礎知識(二)

    一、Linux文件管理類命令的使用方法及其相關示例演示? 1、文件管理 2、文件查看 二、Bash特性詳解 1、命令行展開 (1)在/tmp目錄下創建:a_c,a_d,b_c,b_d 方法一:mkdir -pv {a,b}_{c,d} (2)在/tmp目錄下創建mylinux目錄,其結構如下:         方法一:…

    Linux干貨 2016-09-26
欧美性久久久久