学Linux做程序开发也好,做系统管理也好,做网络管理员也好,做系统运维也好,不会LAMP和LNMP,那就等于连皮毛都不会!本篇是文字版的LAMP集成安装,下次连载我们要介绍LNMP的文字版安装。有喜欢的持续关注了。
【示例15-33】
安装MySQL
[root@CentOSsoft]# tar xvf mysql-5.1.49.tar.gz
[root@CentOSsoft]# cd mysql-5.1.49
[root@CentOSsoft]# useradd mysql
[root@CentOSsoft]# groupadd mysql
[root@CentOSsoft]# cd mysql-5.1.49
[root@CentOSmysql-5.1.49]# ./configure --prefix=/usr/local/mysql/ --enable-local-infile--with-extra-charsets=all --with-plugins=innobase
[root@CentOSmysql-5.1.49]# make
[root@CentOSmysql-5.1.49]# make install
安装SSL
解压源码包
[root@CentOSsoft]# tar xvf openssl-1.0.0c.tar.gz
[root@CentOSsoft]# cd openssl-1.0.0c
配置编译选项
[root@CentOSopenssl-1.0.0c]# ./config --prefix=/usr/local/ssl --shared
编译
[root@CentOSopenssl-1.0.0c]# make
[root@CentOSopenssl-1.0.0c]# make install
将动态库路径加入系统路径中
[root@CentOSopenssl-1.0.0c]# echo /usr/local/ssl/lib/ >>/etc/ld.so.conf
加载动态库以便系统共享
[root@CentOSopenssl-1.0.0c]# ldconfig
安装curl,以便可以在PHP中使用curl相关的功能
[root@CentOSsoft]# tar xvf curl-7.15.1.tar.gz
[root@CentOSsoft]# cd curl-7.15.1
[root@CentOScurl-7.15.1]# chmod -R a+x .
[root@CentOScurl-7.15.1]# ./configure --prefix=/usr/local/curl --enable-shared
[root@CentOScurl-7.15.1]# make
[root@CentOScurl-7.15.1]# make install
安装libxml
[root@CentOSsoft]# tar xvf libxml2-2.7.7.tar.gz
[root@CentOSsoft]# cd libxml2-2.7.7
[root@CentOSsoft]# chmod -R a+x .
[root@CentOSsoft]# ./configure --prefix=/usr/local/libxml2 --enable-shared
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
[root@CentOSsoft]# cd /data/soft
安装zlib
[root@CentOSsoft]# tar xvf zlib-1.2.3.tar.gz
[root@CentOSsoft]# cd zlib-1.2.3/
[root@CentOSsoft]# ./configure --prefix=/usr/local/zlib --enable-shared
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
[root@CentOSsoft]#
[root@CentOSsoft]# cd /data/soft
安装freetype
[root@CentOSsoft]# tar xvf freetype-2.1.10.tar.gz
[root@CentOSsoft]# cd freetype-2.1.10/
[root@CentOSsoft]# ./configure --prefix=/usr/local/freetype --enable-shared
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
[root@CentOSsoft]#
[root@CentOSsoft]# cd /data/soft
安装libpng
[root@CentOSsoft]# tar xvflibpng-1.2.8-config.tar.gz
[root@CentOSsoft]# cd libpng-1.2.8-config/
[root@CentOSsoft]# ./configure --prefix=/usr/local/libpng --enable-shared
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
[root@CentOSsoft]#
[root@CentOSsoft]# cd /data/soft
安装jpeg支持
[root@CentOSsoft]# tar xvf jpegsrc.v6b.tar.gz
[root@CentOSsoft]# cd jpeg-6b/
[root@CentOSsoft]# cp /usr/bin/libtool .
[root@CentOSsoft]# ./configure --enable-shared
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
[root@CentOSsoft]#
[root@CentOSsoft]# cd /data/soft
安装gd库支持
[root@CentOSsoft]# tar xvf gd-2.0.33.tar.gz
[root@CentOSsoft]# cd gd-2.0.33/
[root@CentOSsoft]# ./configure-prefix=/usr/local/gd -with-jpeg-with-png -with-zlib=/usr/local/zlib -with-freetype=/usr/local/freetype
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
[root@CentOSsoft]# cd /data/soft
安装PHP
[root@CentOSsoft]# tar xvf php-5.2.17.tar.gz
[root@CentOSsoft]# cd php-5.2.17
[root@CentOSsoft]# './configure' '--prefix=/usr/local/php' '--with-config-file-scan-dir=/etc/php.d' '--with-apxs2=/usr/local/apache2/bin/apxs''--with-mysql=/usr/local/mysql' '--enable-mbstring' '--enable-sockets''--enable-soap' '--enable-ftp' '--enable-xml' '--with-iconv' '--with-curl''--with-openssl' '--with-gd=yes' '--with-freetype-dir=/usr/local/freetype''--with-jpeg-dir=/usr/local/jpeg' '--with-png-dir=/usr/local/libpng''--with-zlib=yes' '--enable-pcntl' '--enable-cgi' '--with-gmp''--with-libxml-dir=/usr/local/libxml2' '--with-curl=/usr/local/curl'
[root@CentOSsoft]#
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
[root@CentOSsoft]# cd /data/soft
安装APC
[root@CentOSsoft]# tar xvf APC-3.1.9.tgz
[root@CentOSsoft]# cd APC-3.1.9
[root@CentOSsoft]# /usr/local/php/bin/phpize
[root@CentOSsoft]# ./configure --with-apxs=/usr/local/apache2/bin/apxs --enable-apc --enable-shared --with-php-config=/usr/local/php/bin/php-config
[root@CentOSsoft]# make
[root@CentOSsoft]# make install
设置环境变量
[root@CentOSsoft]# echo "export PATH=/usr/local/php/bin:\$PATH:.">>/etc/profile
经过以上的步骤,Apache、MySQL和PHP环境需要的软件已经安装完毕。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用@来通知其他用户。