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
下一篇 2016-10-16

相關推薦

  • 第三周作業

    1.列出當前系統上所有已經登錄的用戶的用戶名,注意:同一個用戶登錄多次,則只顯示一次即可。  2、取出最后登錄到當前系統的用戶的相關信息。  3、取出當前系統上被用戶當作其默認shell的最多的那個shell。  4、將/etc/passwd中的第三個字段數值最大的后10個用戶的信息全部改為大寫后保存至/tmp/max…

    Linux干貨 2016-12-21
  • Linux文件權限之facl

    1、什么是facl         facl(file access control list)文件訪問控制列表,主要目的是在原有的u,g,o之外,另一層讓普通用戶能控制賦權給另外的用戶或組的機制;       &nbs…

    Linux干貨 2016-09-19
  • 初來乍到

    坐上了去往北方的火車,我不知道自己為什么會顫抖,也許是耳朵里那首汪峰的《北京,北京》震撼到了我,接著滿腦子便是燈紅酒綠的大街道和浮華的高樓大廈,我幻想著有一天能在這樣的大城市中闖出一片天。夢醒了 ! 30個小時的路程確實是讓我滿腦子都是未來的自己。 對于我這個從來沒有見過世面的人來說,第一次來到北京這座一線大城市,內心充滿著無比的欣喜和激動,但更多的還是那份…

    Linux干貨 2018-03-26
  • 學習宣言

    紙上得來終覺淺,絕知此事要躬行博學之,審問之,慎思之

    Linux干貨 2016-10-24
  • 每天一個Linux命令

        程序管理:      程序的組成部分:二進制程序文件,庫文件,配置文件,幫助文件。                      二進制和庫文件可執行,庫文件不能獨立執行,只能被調用時執…

    Linux干貨 2017-04-08
  • 文件查找與壓縮-2

    1、tar [OPTION]… (1) 創建歸檔(打包而非壓縮) 其中-c是創建備份,-f是指定創建備份成的文件即是/PATH/TO/SOMEFILE.tar #tar -c -f /PATH/TO/SOMEFILE.tar  FILE… #tar cf / PATH/TO/SOMEFILE.tar FILE… …

    Linux干貨 2016-08-18
欧美性久久久久