月度归档:2009年10月

LAMP环境搭建示例脚本

LAMP环境搭建示例脚本

2009年03月11日 星期三 20:42

# 需要程序包为:

# 程序包路径请置于/root

# gd-2.0.35.tar.gz

# jpeg-6b.tar.gz

# libmcrypt-2.5.8.tar.bz2

# zlib-1.2.3.tar.gz

# mysql-5.1.32.tar.gz

# httpd-2.2.9.tar.gz

# php-5.2.9.tar.gz

# libpng-1.2.10.tar.bz2

# freetype-2.1.10.tar.bz2

# gettext-0.17.tar.gz

#

#/bin/bash

# 定义工作目录

# 检查组件

rpm -qa|grep gcc

echo Please Check The GCC!

sleep 15

# 检查是否缺失必须文件

path=/root/

file=”gd-2.0.35.tar.gz jpeg-6b.tar.gz libmcrypt-2.5.8.tar.bz2 zlib-1.2.3.tar.gz mysql-5.1.32.tar.gz httpd-2.2.9.tar.gz php-5.2.9.tar.gz libpng-1.2.10.tar.bz2 freetype-2.1.10.tar.bz2 gettext-0.17.tar.gz”

for i in $file;

do

if [ -f “$path$i” ];

    then

      echo $i …………………….. yes

    else

      echo $i ……………………… no

fi

done

echo Please Check the file !

sleep 300

# 开始安装

# 安装jpeg

cd ~

rm -rf jpeg-6b

mkdir -p /usr/local/man/man1/cjpeg.1

tar -zxvf jpeg-6b.tar.gz

cd jpeg-6b

./configure –enable-shared –enable-static

make

make install

# 安装libmcrypt

cd ~

rm -rf libmcrypt-2.5.8

tar -jxvf libmcrypt-2.5.8.tar.bz2

cd libmcrypt-2.5.8

./configure

make

make install

# 安装libpng

cd ~

rm -rf libpng-1.2.10

tar -jxvf libpng-1.2.10.tar.bz2

cd libpng-1.2.10

./configure

make

make install

# 安装freetype

cd ~

rm -rf freetype-2.1.10

tar -jxvf freetype-2.1.10.tar.bz2

cd freetype-2.1.10

./configure

make

make install

# 安装gettext

cd ~

rm -rf gettext-0.17

tar -zxvf gettext-0.17.tar.gz

cd gettext-0.17

./configure

make

make install

# 安装 zlib

cd ~

rm -rf zlib-1.2.3

tar -zxvf zlib-1.2.3.tar.gz

cd zlib-1.2.3

./configure

make

make install

# 安装GD库

cd ~

rm -rf gd-2.0.35

tar -zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

./configure

make

make install

# Mysql客户端安装

cd ~

rm -rf mysql-5.1.32

tar zxvf mysql-5.1.32.tar.gz

cd mysql-5.1.32

./configure –prefix=/usr/local/mysql –enable-thread-safe-clinet

make

make install

# 安装Apache

cd ~

rm -rf httpd-2.2.9

tar -zxvf httpd-2.2.9.tar.gz

cd httpd-2.2.9

./configure –prefix=/usr/local/apache –with-apxs2=/usr/local/apache/bin/apxs –with-config-file-path=/usr/local/lib –enable-track-vars –with-xml –with-mysql=/usr/local/mysql/ –with-gd –with-iconv –with-zlib –with-png –with-jpeg –with-freetype –with-mpm=worker –enable-deflate –enable-headers

make

make install

# PHP安装

cd ~

rm -rf php-5.2.9

tar -zxvf php-5.2.9.tar.gz

cd php-5.2.9

./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-config-file-path=/usr/local/lib –with-mysql=/usr/local/mysql/ –with-gd –with-iconv –with-zlib –with-freetype-dir –with-mcrypt –with-freetype-dir –with-libxml-dir –with-png-dir –with-jpeg-dir

make

make install

cp php.ini-dist /usr/local/lib/php.ini

# 关闭 SELINUX

/usr/sbin/setenforce 0

chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libphp5.so

# 启用 SELINUX

/usr/sbin/setenforce 1

# 停止防火墙服务

service iptables stop

/usr/local/apache/bin/apachectl restart

# 拷贝配置文件

echo /usr/local/apache/bin/apachectl start >>/etc/init.d/rc.local