LAMP安装详细步骤(带安装包,suse10 64位环境通过)

来源:互联网 发布:原创文章软件 编辑:程序博客网 时间:2024/05/16 15:50
#########################组件;apache,php,mysql,gd2(画图),soap(OA认证需要)....########################下载安装包(sam在各官网原版下载)MainPath=/usr/local/softmkdir ${MainPath}cd ${MainPath}wget http://10.130.73.48/lamp.tar.gztar -zxf lamp.tar.gz一、安装mysql通过凯莉系统安装(http://db.ied.com)注意:编译php时使用的mysql路径是凯莉默认安装的路径,如果自行安装的mysql,要修改编译php对应的mysql路径。二、安装apachemkdir /usr/local/apache2cd ${MainPath};tar -zxf httpd-2.2.21.tar.gzcd httpd-2.2.21/./configure --prefix=/usr/local/apache2 --enable-module=so --enable-rewritemakemake installmake clean三、安装libxml2mkdir -p /usr/local/modules/libxmlcd ${MainPath};tar -zxf libxml2-2.7.8.tar.gzcd libxml2-2.7.8/./configure --prefix=/usr/local/modules/libxmlmakemake installmake cleancp /usr/local/modules/libxml/bin/xml2-config /usr/bin/xml2-config四、安装zlibmkdir /usr/local/modules/zlibcd ${MainPath};tar -zxf zlib-1.2.5.tar.gzcd zlib-1.2.5/./configure --prefix=/usr/local/modules/zlibmakemake installmake clean五、安装jpegmkdir -p /usr/local/modules/jpegmkdir -p /usr/local/modules/jpeg/binmkdir -p /usr/local/modules/jpeg/libmkdir -p /usr/local/modules/jpeg/includemkdir -p /usr/local/modules/jpeg/manmkdir -p /usr/local/modules/jpeg/man1mkdir -p /usr/local/modules/jpeg/man/man1cd ${MainPath};tar -zxf jpegsrc.v6b.tar.gzcd jpeg-6b/./configure --prefix=/usr/local/modules/jpeg --enable-shared --enable-static如果你的机器是64位,并且在安装gd时候出现下面错误:/usr/bin/ld: /server/apache2/modlib/jpeg6//lib/libjpeg.a(compress.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC/server/apache2/modlib/jpeg6//lib/libjpeg.a: could not read symbols: Bad valuecollect2: ld returned 1 exit statusmake[2]: *** [libgd.la] Error 1修补办法(接上面步骤):vi Makefile找到 CFLAGS= -O2 -I$(srcdir)在后面加入-fPIC,即变成CFLAGS= -O2 -I$(srcdir) -fPIC(configure后改),然后继续:cp /usr/bin/libtool ./makemake install-libmake installmake clean六、安装libpngmkdir /usr/local/modules/libpngcd ${MainPath};tar -zxf libpng-1.5.4.tar.gzcd libpng-1.5.4/./configure --prefix=/usr/local/modules/libpngmakemake installmake clean七、安装freetypemkdir /usr/local/modules/freetypecd ${MainPath};tar -zxf freetype-2.4.6.tar.gzcd freetype-2.4.6/./configure --prefix=/usr/local/modules/freetypemakemake installmake clean八、安装gd2mkdir /usr/local/modules/gd2cd ${MainPath};tar -zxf gd-2.0.35.tar.gzcd gd/2.0.35/chmod 640 gd_png.cvi gd_png.c将#include "png.h"修改为#include "/usr/local/modules/libpng/include/png.h"(注意是libpng路径)./configure --prefix=/usr/local/modules/gd2 --with-zlib=/usr/local/modules/zlib/ --with-png=/usr/local/modules/libpng/ --with-jpeg=/usr/local/modules/jpeg/ --with-xml2=/usr/local/modules/libxml/ --with-freetype=/usr/local/modules/freetype/makemake installmake clean九、安装libmcryptmkdir /usr/local/modules/libmcryptcd ${MainPath};tar -zxf libmcrypt-2.5.7.tar.gzcd libmcrypt-2.5.7/./configure --prefix=/usr/local/modules/libmcryptmakemake installmake clean十、安装mhashmkdir /usr/local/modules/mhashcd ${MainPath};tar -zxf mhash-0.9.9.9.tar.gzcd mhash-0.9.9.9/./configure --prefix=/usr/local/modules/mhashmakemake installmake clean十一、安装mcryptmkdir /usr/local/modules/mcryptcd ${MainPath};tar -zxf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8/LD_LIBRARY_PATH=/usr/local/modules/libmcrypt/lib:/usr/local/modules/mhash/lib ./configure --prefix=/usr/local/modules/mcrypt --with-libmcrypt-prefix=/usr/local/modules/libmcryptmakemake installmake clean十二、安装curlmkdir /usr/local/modules/curlcd ${MainPath};tar -zxf curl-7.22.0.tar.gzcd curl-7.22.0/./configure --prefix=/usr/local/modules/curlmakemake installmake clean十三、安装php5mkdir /usr/local/php5cd ${MainPath};tar -zxf php-5.3.8.tar.gzcd php-5.3.8/./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/modules/jpeg/ --with-png-dir=/usr/local/modules/libpng/ --with-libxml-dir=/usr/local/modules/libxml/ --with-gd=/usr/local/modules/gd2/ --with-freetype-dir=/usr/local/modules/freetype/ --with-zlib-dir=/usr/local/modules/zlib/ --with-mysql=/usr/local/mysql --enable-soap --enable-sockets --enable-mbstring --enable-gd-native-ttf --enable-calendar --with-config-file-path=/usr/local/php5/etc/ --with-mcrypt=/usr/local/modules/libmcrypt/ --with-curl=/usr/local/modules/curlmakemake installmake clean十四、安装后的配置#创建空的php.ini文件,以后需要增加模块或者对php参数做额外配置时使用touch /usr/local/php5/etc/php.ini#创建网站主目录mkdir /data/websiteecho "<?php phpinfo();?>" >/data/website/index.php#修改apache参数cp /usr/local/apache2/conf/httpd.conf /usr/local/apache2/conf/httpd.conf.bak.new#绑定内网端口,172.17.148.115需要修改为你的内网IPsed -i 's/^Listen 80/Listen 172.17.148.115:80/g' /usr/local/apache2/conf/httpd.confsed -i 's/^#ServerName www.example.com:80/ServerName localhost/g' /usr/local/apache2/conf/httpd.confsed -i 's/\/usr\/local\/apache2\/htdocs/\/data\/website/g' /usr/local/apache2/conf/httpd.confsed -i 's/Options Indexes FollowSymLinks/Options FollowSymLinks/g' /usr/local/apache2/conf/httpd.confsed -i 's/DirectoryIndex index.html/DirectoryIndex index.html index.htm index.php/g' /usr/local/apache2/conf/httpd.confsed -i "s/AddType application\/x-gzip .gz .tgz/AddType application\/x-gzip .gz .tgz\n    AddType application\/x-httpd-php .php/g" /usr/local/apache2/conf/httpd.conf拉起apache/usr/local/apache2/bin/apachectl -k start到这一步,安装配置已经全部完成!通过浏览器打开http://youdomain.com,尽情享受LAMP的强大吧!