LAMP搭建

1、LAMP(web应用软件)php

Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组经常使用来搭建动态网站或者服务器的开源软件,自己都是各自独立的程序,可是由于常被放在一块儿使用,拥有了愈来愈高的兼容度,共同组成了一个强大的Web应用程序平台。随着开源潮流的蓬勃发展,开放源代码的LAMP已经与J2EE.Net商业软件造成三足鼎立之势,而且该软件开发的项目在软件方面的投资成本较低,所以受到整个IT界的关注。从网站的流量上来讲,70%以上的访问流量是LAMP来提供的,LAMP是最强大的网站解决方案.html


2、LAMP定义mysql

LAMP指的Linux(操做系统)、ApacheHTTP 服务器,MySQL(有时也指MariaDB,数据库软件) 和PHP(有时也是指PerlPython) 的第一个字母,通常用来创建web应用平台。linux

虽然这些开放源代码程序自己并非专门设计成同另几个程序一块儿工做的,但因为它们的免费和开源,这个组合开始流行(大多数Linux发行版本捆绑了这些软件)。当一块儿使用的时候,它们表现的像一个具备活力的解决方案包。其余的方案包有苹果的WebObjects(最初是应用服务器),Java/J2EE和微软的.NET架构。程序员

LAMP包的脚本组件中包括了CGIweb接口,它在90年代初期变得流行。这个技术容许网页浏览器的用户在服务器上执行一个程序,而且和接受静态的内容同样接受动态的内容。程序员使用脚本语言来建立这些程序由于它们能很容易有效的操做文本流,甚至当这些文本流并不是源自程序自身时也是。正是因为这个缘由系统设计者常常称这些脚本语言为胶水语言web



3、LAMP搭建步奏:
sql

1.mysql安装数据库

cd /usr/local/srcapache

wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gzvim

tar zxvf mysql-5.1.73-linux-x86_64-glibc23.tar.gz 解压

chown -R mysql /data/mysql更改

(编译参数文件)cat /usr/local/mysql/bin/mysqlbug |grep -i config

初始化 ./scripts/mysql_install_db  

--user=mysql 

--datadir=/data/mysql

cd support-files/

cp my-large.cnf  /etc/my.cnf

cp mysql.server /etc/init.d/mysqld

 vim /etc/init.d/mysqld

修改 basedir=/usr/local/mysql

     datadir=/data/mysql

chkconfig --add mysqld 加入到系统服务项

chkconfig  mysqld on 

service mysqld start(/etc/init.d/mysqld start)

2.Apache编译安装

cd /usr/local/src

wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.bz2

tar jxf httpd-2.2.31.tar.bz2

cd /httpd-2.2.31 

cat /usr/local/apache/build/config.nice (下面的在这个文件)

vim INSTALL(安装步骤在这个文件里)

 ./configure \

--prefix=/usr/local/apache

--with-included-apr

--enable-so--enable

-deflate=shared 

--enable-expires=shared 

--enable-rewrite=shared 

--with-pcre

为了不make错误:yum install -y zlib-devel和yum install -y pcre pcre-devel apr apr-devel

make

echo $?

make install

echo $?

ls /usr/local/apache

启动:/usr/local/apache/bin/apachectl start

ps aux |grep httpd

netstat -lnp

列出模块/usr/local/apache/bin/apachectl -M

动态加载(用的时候加载)ls /usr/local/apache/modules/

静态加载(启动httpd服务时候就加载进去了)ls /usr/local/apache/bin/httpd

/usr/local/apache/bin/apachectl -t配置语法是否是有错

列出静态模块/usr/local/apache/bin/apachectl -l

3.安装php(最后安装)

cd /usr/local/src

wget http://mirrors.sohu.com/php/php-5.4.36.tar.bz2

tar jxf php-5.4.36.tar.bz2

cd php-5.4.36


 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6

make

make install

/usr/local/php/bin/php -m(静态模块)

/usr/local/php/bin/php -i(配置文件)

/usr/local/apache/bin/apachectl -M

 vim /usr/local/apache/conf/httpd.conf

 找到AddType加入AddType application/x-httpd-php .php

 找到index.html加入index.php

/usr/local/apache/bin/apachectl -t(检测)

/usr/local/apache/bin/apachectl graceful(从新加载)