編譯安裝LAMP+phpMyAdmin

來源:互聯網
上載者:User

標籤:防火牆   原始碼   selinux   mysql.httpd.php   


一、準備工作

    關閉防火牆、selinux,配置yum源,並移出系統已安裝的httpd,mysql,php

    650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/45/C5/wKiom1PrELvhQC2ZAAM-fNhJrDI080.jpg" title="1.png" alt="wKiom1PrELvhQC2ZAAM-fNhJrDI080.jpg" />


二、安裝apache

    ttpd-2.4.10需要較新版本的apr和apr-util,因此需要事先對其進行升級。升級方式有兩種,一種是通過原始碼編譯安裝,一種是直接升級rpm包。這裡使用源碼編譯示範。

    1、安裝apr    

            [[email protected] /]# tar xf apr-1.5.1.tar.bz2 -C /usr/src/

            [[email protected] /]# cd /usr/src/apr-1.5.1/

            [[email protected] apr-1.5.1]# ./configure --prefix=/usr/local/apr

            [[email protected] apr-1.5.1]# make && make install

    2、安裝apr-util

            

            [[email protected] /]# tar xf apr-util-1.5.3.tar.bz2 -C /usr/src/

            [[email protected] /]# cd /usr/src/apr-util-1.5.3/

            [[email protected] apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util

                                         --with-apr=/usr/local/apr/

            [[email protected] apr-util-1.5.3]# make && make install

    3、安裝httpd

             

            [[email protected] /]# tar xf httpd-2.4.10.tar.bz2  -C /usr/src/

            [[email protected] /]# cd /usr/src/httpd-2.4.10/

            [[email protected] httpd-2.4.10]# ./configure --prefix=/usr/local/apache 

            --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi 

            --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr 

            --with-apr-util=/usr/local/apr-util --enable-modules=most 

            --enable-mpms-shared=all --with-mpm=event

            [[email protected] httpd-2.4.10]# make && make install

    

補充:


(1)構建MPM為靜態模組

        在全部平台中,MPM都可以構建為靜態模組。在構建時選擇一種MPM,連結到伺服器中。如果要改變MPM,必須重新構建。為了使用指定的MPM,請在執行configure指令碼 時,使用參數 --with-mpm=NAME。NAME是指定的MPM名稱。編譯完成後,可以使用 ./httpd -l 來確定選擇的MPM。 此命令會列出編譯到伺服器程式中的所有模組,包括 MPM。


(2)構建 MPM 為動態模組


        在Unix或類似平台中,MPM可以構建為動態模組,與其它動態模組一樣在運行時載入。 構建 MPM 為動態模組允許通過修改LoadModule指令內容來改變MPM,而不用重新構建伺服器程式。在執行configure指令碼時,使用--enable-mpms-shared選項即可啟用此特性。當給出的參數為all時,所有此平台支援的MPM模組都會被安裝。還可以在參數中給出模組列表。預設MPM,可以自動選擇或者在執行configure指令碼時通過--with-mpm選項來指定,然後出現在產生的伺服器設定檔中。編輯LoadModule指令內容可以選擇不同的MPM。


4、修改httpd的主設定檔,設定其Pid檔案路徑


        [[email protected] ~]# vim /etc/httpd24/httpd.conf 

    650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/45/C8/wKioL1PrJAPA3XSiAAC8lcYgSlE895.jpg" title="2.png" alt="wKioL1PrJAPA3XSiAAC8lcYgSlE895.jpg" />

   

 提供服務指令碼

        [[email protected] ~]# vim /etc/rc.d/init.d/httpd24

        #!/bin/bash

        #

        # httpd        Startup script for the Apache HTTP Server

        #

        # chkconfig: - 85 15

        # description: Apache is a World Wide Web server.  It is used to serve \

        #        HTML files and CGI.

        # processname: httpd

        # config: /etc/httpd/conf/httpd.conf

        # config: /etc/sysconfig/httpd

        # pidfile: /var/run/httpd.pid

        

        # Source function library.

        . /etc/rc.d/init.d/functions

        

        if [ -f /etc/sysconfig/httpd ]; then

                . /etc/sysconfig/httpd

        fi

        

        # Start httpd in the C locale by default.

        HTTPD_LANG=${HTTPD_LANG-"C"}

        

        # This will prevent initlog from swallowing up a pass-phrase prompt if

        # mod_ssl needs a pass-phrase from the user.

        INITLOG_ARGS=""

        

        # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server

        # with the thread-based "worker" MPM; BE WARNED that some modules may not

        # work correctly with a thread-based MPM; notably PHP will refuse to start.

        

        # Path to the apachectl script, server binary, and short-form for messages.

        apachectl=/usr/local/apache/bin/apachectl

        httpd=${HTTPD-/usr/local/apache/bin/httpd}

        prog=httpd

        pidfile=${PIDFILE-/var/run/httpd.pid}

        lockfile=${LOCKFILE-/var/lock/subsys/httpd}

        RETVAL=0

        

        start() {

                echo -n $"Starting $prog: "

                LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS

                RETVAL=$?

                echo

                [ $RETVAL = 0 ] && touch ${lockfile}

                return $RETVAL

        }

        

        stop() {

          echo -n $"Stopping $prog: "

          killproc -p ${pidfile} -d 10 $httpd

          RETVAL=$?

          echo

          [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}

        }

        reload() {

            echo -n $"Reloading $prog: "

            if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then

                RETVAL=$?

                echo $"not reloading due to configuration syntax error"

                failure $"not reloading $httpd due to configuration syntax error"

            else

                killproc -p ${pidfile} $httpd -HUP

                RETVAL=$?

            fi

            echo

        }

        

        # See how we were called.

        case "$1" in

          start)

          start

          ;;

          stop)

          stop

          ;;

          status)

                status -p ${pidfile} $httpd

          RETVAL=$?

          ;;

          restart)

          stop

          start

          ;;

          condrestart)

          if [ -f ${pidfile} ] ; then

            stop

            start

          fi

          ;;

          reload)

                reload

          ;;

          graceful|help|configtest|fullstatus)

          $apachectl [email protected]

          RETVAL=$?

          ;;

          *)

          echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"

          exit 1

        esac

        

        exit $RETVAL

  賦權並開啟服務測試

    650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/45/C7/wKiom1PrJKiQ42R5AAGqCib8reQ862.jpg" title="3.png" alt="wKiom1PrJKiQ42R5AAGqCib8reQ862.jpg" />

         650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/45/C7/wKiom1PrJd7iG0SUAAC2PU-9DNM566.jpg" title="4.png" alt="wKiom1PrJd7iG0SUAAC2PU-9DNM566.jpg" />     


    三、在centos7上安裝mysql



























































本文出自 “斷了的軍刀” 部落格,請務必保留此出處http://90sec.blog.51cto.com/7404127/1539510

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.