一、简介
什么是LAMP
LAMP是一种Web网络应用和开发环境,是Linux, Apache, MySQL, Php/Perl的缩写,每一个字母代表了一个组件,每个组件就其本身而言都是在它所代表的方面功能非常强大的组件。
LAMP这个词的由来最早始于德国杂志“c't Magazine”,Michael Kunze在1990年最先把这些项目组合在一起创造了LAMP的缩写字。这些组件并不是开始就设计为一起使用的,但是,这些软件都是开源的,可以很方便的随时获得并免费使用,这就导致了这些组件经常在一起使用。这些组件的兼容性也在不断完善,为了改善不同组件之间的协作,已经创建了某些扩展功能,在一起的应用情形变得非常普便,因而成为目前最流行的web应用基础架构。
LAMP的组件
平台由四个组件组成,呈分层结构,每一层都提供了整个架构的一个关键部分:
Linux:Linux 处在最底层,提供操作系统。它的灵活性和可定制化的特点意味着它能够产生一种高度定制的平台,让其它组件在上面运行。其它组件运行于Linux 之上,但是并不一定局限于 Linux,也可以在 Microsoft Windows, Mac OS X 或 UNIX上运行。
Apache:Apache位于第二层,它是一个Web 服务平台,提供可让用户获得 Web 页面的机制。Apache 是一款功能强大、稳定、可支撑关键任务的Web服务器,Internet 上超过 50% 的网站都使用它作为 Web 服务器。
MySQL:MySQL 是最流行的开源关系数据库管理系统,是LAMP的数据存储端。在 Web 应用程序中,所有帐户信息、产品信息、客户信息、业务数据和其他类型的信息都存储于数据库中,通过 SQL 语言可以很容易地查询这些信息。
PHP/Perl:Perl是一种灵活的语言,特别是在处理文本要素的时候,这种灵活性使Perl很容易处理通过 CGI接口提供的数据,灵活地运用文本文件和简单数据库支持动态要素。PHP 是一种被广泛应用的开放源代码的多用途脚本语言,它可嵌入到 HTML中,尤其适合 web 开发。可以使用 PHP 编写能访问 MySQL 数据库中的数据和 Linux 提供的一些特性的动态内容。
二.安装
//系统环境
1.
shell> yum -y install gcc gcc-c++ make automake autoconf ncurses-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel pcre-devel libtool-libs freetype-devel gd zlib-devel file bison patch mlocate flex diffutils readline-devel glibc-devel glib2-devel bzip2-devel gettext-devel libcap-devel libmcrypt-devel
2.
shell> cd /home/soft
wget http://mirrors.axint.net/apache/apr/apr-util-1.4.1.tar.gz
wget http://mirrors.axint.net/apache/apr/apr-1.4.8.tar.gz
wget http://mirrors.axint.net/apache/apr/apr-iconv-1.2.1.tar.gz
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
5.apr
./configure --prefix
rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands
直接打开/usr/local/src/apr-1.4.6/configure 把 $RM “$cfgfile” 那行删除掉
$RM “$cfgfile” 大约在 42302 行
6.apr-util
tar zxf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config && make && make install
7.apr-iconv
cd /usr/local/src
tar zxf apr-iconv-1.2.1.tar.gz
cd apr-iconv-1.2.1
./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr/bin/apr-1-config && make && make install
//mysql
1.
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/dbdata -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_SSL=yes
//apache配置参数
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-apr-iconv=/usr/local/apr-iconv --with-ssl --enable-ssl --enable-so --enable-deflate=shared --enable-expires=shared --enable-headers=shared --enable-rewrite=shared --enable-static-support
//php配置参数
./configure
--prefix=/usr/local/php5 \ #php安装位置
--with-config-file-path=/usr/local/php5/etc #php.ini配置文件位置
--with-apxs2=/usr/local/apache2/bin/apxs #编译共享的apache2.0处理程序的模块
--with-mysql=/usr/local/mysql #添加mysql支持,mysql按转目录
--with-mysqli=/usr/local/mysql/bin/mysql_config
--with-mysql-sock=/usr/local/mysql/tmp/mysql.sock
--with-gd #GDBM支持
--with-iconv #iconv支持
--with-freetype-dir
--with-jpeg-dir
--with-png-dir
--with-zlib-dir
--with-libxml-dir
--enable-xml
--enable-bcmath
--enable-shmop
--enable-sysvsem
--enable-inline-optimization
--with-curlwrappers
--enable-mbregex
--enable-mbstring
--enable-ftp
--enable-gd-native-ttf
--with-openssl
--enable-pcntl
--enable-sockets
--with-xmlrpc
--enable-zip
--enable-soap
--without-pear
--with-gettext
--enable-session
--with-mcrypt