LAMP的簡單編譯安裝

【二進制安裝MariaDB】

1.展開程序

      #tar xf mariadb-5.5.32-linux-x86_64.tar.gz -C /usr/local/

2.進入解壓後的文件夾

      # cd /usr/local/mariadb-5.5.32-linux-x86_64/

3.創建數據存放目錄

      #mkdir -pv /mydata/data

4.創建安全登陸的用戶和組

      #groupadd -r mysql

      #useradd -g mysql -r mysql

5.改變數據目錄的屬主屬組

      #chown -R mysql:mysql /mydata/data/

6.給解壓目錄創建軟鏈接

      #cd /usr/local

      # ln -sv mariadb-5.5.32-linux-x86_64/ mysql

7.進入mysql目錄下,並修改所有文件的屬主屬組

      #cd mysql/

      #chown -R root:mysql *

8.複製並修改mysql的配置文件

      #mkdir /etc/mysql

      # cp support-files/my-large.cnf /etc/mysql/my.cnf

      #vim /etc/mysql/my.cnf//在[mysqld]下修改並填寫

          [mysqld]

          thread_concurrency = 2

          datadir = /mydata/data

9.初始化數據庫

      #scripts/mysql_install_db --user=mysql --datadir=/mydata/data

10.複製啓動腳本文件到/etc/rc.d/init.d下

      # cp support-files/mysql.server /etc/rc.d/init.d/mysqld

11.添加服務

      # chkconfig --add mysqld

12.簡單啓動服務

      # service mysqld start

wKioL1P0oYiR1AeBAAF_SaLyl18526.jpg

13.填寫命令所在的PATH路徑,並查看man文檔

      # vim /etc/profile.d/mysql.sh

          export PATH=/usr/local/mysql/bin:$PATH

      # source /etc/profile.d/mysql.sh 

      #man mysqld

===============================================

【HTTPD編譯安裝】

1、解決依賴關係

    (1) 編譯安裝apr

      # tar xf apr-1.5.0.tar.bz2

      # cd apr-1.5.0

      #vim configure

          把RM='$RM'改爲RM='$RM  -f'

      # ./configure --prefix=/usr/local/apr

      # make && make install

      # cd ..

    (2) 編譯安裝apr-util

      # tar xf apr-util-1.5.3.tar.bz2

      # cd apr-util-1.5.3

      # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

      # make && make install

      # cd ..

    (3) httpd-2.4.9編譯過程也要依賴於pcre-devel軟件包,需要事先安裝。此軟件包系統光盤自帶,因此,找到並安裝即可。

      #yum -y install pcre-devel

2、編譯安裝httpd-2.4.9

      # tar xf httpd-2.4.9.tar.bz2

      # cd httpd-2.4.9

      # ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --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

      # make && make install

3.修改httpd的主配置文件,設置其Pid文件的路徑

      #cd /etc/httpd24

      #cp httpd.conf httpd.conf.bak

      #vim /etc/httpd24/httpd.conf

          PidFile  "/var/run/httpd.pid"

4、提供SysV服務腳本/etc/rc.d/init.d/httpd24

      #vim /etc/rc.d/init.d/httpd24

           詳細內容請參考/etc/rc.d/init.d/httpd腳本

5、賦予權限,添加服務,啓動服務

      # chmod +x /etc/rc.d/init.d/httpd24

      # chkconfig --add httpd24

      # service httpd24 start

-------------------------------------------------------------------------------------------

wKioL1P0ob_CV_X9AACNoMlobdk498.jpg

================================================================================

【PHP編譯安裝】

  1. 解決依賴關係

      #yum -y groupinstall "Desktop Platform Development"

      #yum -y install bzip2-devel libmcrypt-devel

      #yum install openssl-devel

2.編譯安裝php

      #tar xf php-5.4.26.tar.bz2

      #cd php-5.4.26

      #./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2  --enable-maintainer-zts

      #make & make install

3.爲php提供配置文件

      #cp php.ini-production /etc/php.ini

4.編輯apache的主配置文件,以使apache支持php

      #cd /etc/httpd24

      #vim httpd.conf

          AddType application/x-httpd-php .php

          AddType application/x-httpd-php-source .phps


          DirectoryIndex index.php index.html

5.重啓httpd服務

      #service httpd24 restart

6.測試是否支持php

      #cd /usr/local/apache/htdocs/

      #vim index.html

          <?php

                phpinfo();

          ?>

      #mv index.html index.php

      #service httpd24 restart

-------------------------------------------------------------------------------------------

wKioL1P0odnhlXqCAAKOdsQQH3s705.jpg

===========================================================================================




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章