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

########################
#组件;apache,php,mysql,gd2(画图),soap(OA认证需要)....
########################

下载安装包(sam在各官网原版下载)
MainPath=/usr/local/soft
mkdir ${MainPath}
cd ${MainPath}
wget http://10.130.73.48/lamp.tar.gz
tar -zxf lamp.tar.gz

一、安装mysql
通过凯莉系统安装(https://www.360docs.net/doc/d112281919.html,)
注意:编译php时使用的mysql路径是凯莉默认安装的路径,如果自行安装的mysql,要修改编译php对应的mysql路径。

二、安装apache
mkdir /usr/local/apache2
cd ${MainPath};tar -zxf httpd-2.2.21.tar.gz
cd httpd-2.2.21/
./configure --prefix=/usr/local/apache2 --enable-module=so --enable-rewrite
make
make install
make clean

三、安装libxml2
mkdir -p /usr/local/modules/libxml
cd ${MainPath};tar -zxf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8/
./configure --prefix=/usr/local/modules/libxml
make
make install
make clean
cp /usr/local/modules/libxml/bin/xml2-config /usr/bin/xml2-config

四、安装zlib
mkdir /usr/local/modules/zlib
cd ${MainPath};tar -zxf zlib-1.2.5.tar.gz
cd zlib-1.2.5/
./configure --prefix=/usr/local/modules/zlib
make
make install
make clean

五、安装jpeg
mkdir -p /usr/local/modules/jpeg
mkdir -p /usr/local/modules/jpeg/bin
mkdir -p /usr/local/modules/jpeg/lib
mkdir -p /usr/local/modules/jpeg/include
mkdir -p /usr/local/modules/jpeg/man
mkdir -p /usr/local/modules/jpeg/man1
mkdir -p /usr/local/modules/jpeg/man/man1

cd ${MainPath};tar -zxf jpegsrc.v6b.tar.gz
cd 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 value
collect2: ld returned 1 exit status
make[2]: *** [https://www.360docs.net/doc/d112281919.html,] Error 1
修补办法(接上面步骤):
vi Makefile
找到 CFLAGS= -O2 -I$(srcdir)
在后面加入-fPIC,即变成CFLAGS= -O2 -I$(srcdir) -fPIC(configure后改),然后继续:
cp /usr/bin/libtool ./
make
make install-lib
make install
make clean


六、安装libpng
mkdir /usr/local/modules/libpng
cd ${MainPath};tar -zxf libpng-1.5.4.tar.gz
cd libpng-1.5.4/
./configure --prefix=/usr/local/modules/libpng
make
make install
make clean

七、安装freetype
mkdir /usr/local/modules/freetype
cd ${MainPath};tar -zxf freetype-2.4.6.tar.gz
cd freetype-2.4.6/
./configure --prefix=/usr/local/modules/freetype
make
make install
make clean

八、安装gd2
mkdir /usr/local/modules/gd2
cd ${MainPath};tar -zxf gd-2.0.35.tar.gz
cd gd/2.0.35/

chmod 640 gd_png.c
vi 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/ --wit

h-png=/usr/local/modules/libpng/ --with-jpeg=/usr/local/modules/jpeg/ --with-xml2=/usr/local/modules/libxml/ --with-freetype=/usr/local/modules/freetype/
make
make install
make clean

九、安装libmcrypt
mkdir /usr/local/modules/libmcrypt
cd ${MainPath};tar -zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7/
./configure --prefix=/usr/local/modules/libmcrypt
make
make install
make clean

十、安装mhash
mkdir /usr/local/modules/mhash
cd ${MainPath};tar -zxf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure --prefix=/usr/local/modules/mhash
make
make install
make clean

十一、安装mcrypt
mkdir /usr/local/modules/mcrypt
cd ${MainPath};tar -zxf mcrypt-2.6.8.tar.gz
cd 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/libmcrypt
make
make install
make clean

十二、安装curl
mkdir /usr/local/modules/curl
cd ${MainPath};tar -zxf curl-7.22.0.tar.gz
cd curl-7.22.0/
./configure --prefix=/usr/local/modules/curl
make
make install
make clean

十三、安装php5
mkdir /usr/local/php5
cd ${MainPath};tar -zxf php-5.3.8.tar.gz
cd 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/curl
make
make install
make clean

十四、安装后的配置
#创建空的php.ini文件,以后需要增加模块或者对php参数做额外配置时使用
touch /usr/local/php5/etc/php.ini
#创建网站主目录
mkdir /data/website
echo "" >/data/website/index.php
#修改apache参数
cp /usr/local/apache2/conf/httpd.conf /usr/local/apache2/conf/httpd.conf.bak.new
#绑定内网端口,172.17.148.115需要修改为你的内网IP
sed -i 's/^Listen 80/Listen 172.17.148.115:80/g' /usr/local/apache2/conf/httpd.conf
sed -i 's/^#ServerName https://www.360docs.net/doc/d112281919.html,:80/ServerName localhost/g' /usr/local/apache2/conf/httpd.conf
sed -i 's/\/usr\/local\/apache2\/htdocs/\/data\/website/g' /usr/local/apache2/conf/httpd.conf
sed -i 's/Options Indexes FollowSymLinks/Options FollowSymLinks/g' /usr/local/apache2/conf/httpd.conf
sed -i 's/DirectoryIndex index.html/DirectoryIndex index.html index.htm index.php/g' /usr/local/apache2/conf/httpd.conf
sed -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


到这一步,安装配置已经全部完成!
通过浏览器打开https://www.360docs.net/doc/d112281919.html,,尽情享受LAMP的强大吧!

相关文档
最新文档