lamp

1 架構
2 安裝
3 配置文件的位置
4 服務啓動關閉腳本,查看端口
5 此服務的使用方法
6 修改配置文件
7 排錯(從下到上,從內到外)
源碼編譯搭建LAMP架構
LAMP=Linux + Apache + MySQL + PHP
源碼安裝和RPM安裝對比
rpm:安裝、部署、管理比較方便,運行穩定;版本較低,功能和性能較差
源碼:安裝、部署、管理比較麻煩,運行相對不穩定;版本較新,功能和性能較高

需要源碼編譯安裝的軟件包
httpd-2.4.7.tar.gz apache主程序包
apr-1.4.6.tar.gz apache依賴包
apr-util-1.4.1.tar.gz apache依賴包
pcre-8.34.tar.gz apache依賴包
首先下載最新的源碼包
安裝之前請先安裝make 、gcc、openssl(安全認證)等編譯工具和開發包
wget -O /etc/yum,repos,d/centOS-Base.repo http://mirrors.aliyun.com/Centos-7.repo
sed -i 's/$releasever/7/g /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum list

http://httpd.apache.org/
http://apache.fayea.com//httpd/httpd-2.4.18.tar.gz
http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
http://iweb.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.zip

yum -y install make gcc openssl
安裝apr-1.4.6.tar.gz
[root@master ~/soft/lamp/LAMPutil/apr-1.4.6]tarxvfapr1.4.6.tar.gz[root@master /soft/lamp/LAMPutil/apr1.4.6]tar -xvf apr-1.4.6.tar.gz [root@master ~/soft/lamp/LAMPutil/apr-1.4.6]cd apr-1.4.6/
[root@master ~/soft/lamp/LAMPutil/apr-1.4.6]./configureprefix=/usr/local/apr[root@master /soft/lamp/LAMPutil/apr1.4.6]./configure --prefix=/usr/local/apr [root@master ~/soft/lamp/LAMPutil/apr-1.4.6]make && make install
[root@master ~/soft/lamp/LAMPutil/apr-1.4.6]makej4(4)[root@master /soft/lamp/LAMPutil/apr1.4.6]make -j 4 (4個內核同時進行編譯) [root@master ~/soft/lamp/LAMPutil/apr-1.4.6]echo ?0aprutil1.4.1.tar.gz[root@master /soft/lamp/LAMPutil]? 0 安裝apr-util-1.4.1.tar.gz [root@master ~/soft/lamp/LAMPutil]cd apr-util-1.4.1/
[root@master ~/soft/lamp/LAMPutil/apr-util-1.4.1]$./configure --prefix=/usr/local/apr-util/ \

–with-apr=/usr/local/apr/bin/apr-1-config
[root@master ~/soft/lamp/LAMPutil/apr-util-1.4.1]$make && make install

安裝pcre-8.34.tar.gz
unzip pcre-8.34.zip
[root@master ~/soft/lamp/LAMPutil/pcre-8.34]./configureprefix=/usr/local/pcre[root@master /soft/lamp/LAMPutil/pcre8.34]./configure --prefix=/usr/local/pcre [root@master ~/soft/lamp/LAMPutil/pcre-8.34]make && make install
[root@master ~/soft/lamp/LAMPutil/pcre-8.34]$echo $?
0

[root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]tarxvfhttpd2.4.7.tar.gz[root@master /soft/lamp/LAMPutil]tar -xvf httpd-2.4.7.tar.gz [root@master ~/soft/lamp/LAMPutil]cd httpd-2.4.7/
[root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]lsABOUTAPACHEap.dCHANGESdocsINSTALLMakefile.inosserveracinclude.m4buildCMakeLists.txtemacsstyleInstallBin.dspMakefile.winREADMEsrclibApacheapr2.dswBuildAll.dspconfig.layouthttpd.dspLAYOUTmodulesREADME.cmakesupportApache.dswBuildBin.dspconfigurehttpd.speclibhttpd.dspNOTICEREADME.platformstestapacheprobes.dbuildconfconfigure.inincludeLICENSENWGNUmakefileROADMAPVERSIONING[root@master /soft/lamp/LAMPutil/httpd2.4.7]ls ABOUT_APACHE ap.d CHANGES docs INSTALL Makefile.in os server acinclude.m4 build CMakeLists.txt emacs-style InstallBin.dsp Makefile.win README srclib Apache-apr2.dsw BuildAll.dsp config.layout httpd.dsp LAYOUT modules README.cmake support Apache.dsw BuildBin.dsp configure httpd.spec libhttpd.dsp NOTICE README.platforms test apache_probes.d buildconf configure.in include LICENSE NWGNUmakefile ROADMAP VERSIONING [root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]configure
[root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]$./configure --prefix=/usr/local/apache2/ \

–enable-so \ (開啓動態加載模塊)
–enable-rewrite \(支持網站地址重寫)
–enable-ssl \(支持ssl加密)
–with-apr=/usr/local/apr \(關聯)
–with-apr-util=/usr/local/apr-util/ \(關聯)
–with-pcre=/usr/local/pcre/(關聯)
[root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]./configureprefix=/usr/local/apache2/enablesoenablerewriteenablesslwithapr=/usr/local/aprwithaprutil=/usr/local/aprutil/withpcre=/usr/local/pcre/[root@master /soft/lamp/LAMPutil/httpd2.4.7]./configure --prefix=/usr/local/apache2/ --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/ [root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]echo ?0[root@master /soft/lamp/LAMPutil/httpd2.4.7]? 0 配置文件 [root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]ls /usr/local/apache2/conf/httpd.conf
/usr/local/apache2/conf/httpd.conf
網站根目錄
[root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]ls/usr/local/apache2/htdocs/index.html[root@master /soft/lamp/LAMPutil/httpd2.4.7]ls /usr/local/apache2/htdocs/ index.html 生成啓動腳本 [root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]cp /usr/local/apache2/bin/apachectl /etc/init.d/
[root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]chmod+x/etc/init.d/apachectl[root@master /soft/lamp/LAMPutil/httpd2.4.7]chmod +x /etc/init.d/apachectl [root@master ~/soft/lamp/LAMPutil/httpd-2.4.7]vim /etc/init.d/apachectl
#!/bin/sh

chkconfig: 2345 64 36

description: rm apache server

Licensed to the Apache Software Foundation (ASF) under one or more

contributor license agreements. See the NOTICE file distributed with

將服務添加到系統啓動列表中
[root@master ~]chkconfigaddapachectl[root@master ]chkconfig --add apachectl [root@master ~]chkconfig apachectl on
[root@master ~]chkconfiglistapachectlapachectl0:off1:off2:on3:on4:on5:on6:off[root@master ]chkconfig --list apachectl apachectl 0:off 1:off 2:on 3:on 4:on 5:on 6:off 啓動服務 [root@master ~]service apachectl start

在這裏插入圖片描述

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