#!/bin/sh
#this is a script about *nix installing apache,php with gd2.write by sery(sery@163.com),in 2009-12-03
#define some variables
http_prefix=/usr/local/apache2
php_prefix=/usr/local/php
#need root install
is_root=`id |awk ‘{print $1}’|awk -F’[=(]‘ ‘{print $2}’`
if [ $is_root != 0 ]
then
echo “please use root install this program!!!”
exit 1
fi
#Os is ?
Os_is=`uname`
if [ "$Os_is" = "FreeBSD" ]
then
## install apache
if [ ! -d "$http_prefix" ]
then
tar zxvf httpd-2.2.14.tar.gz
cd httpd-2.2.14
./configure –prefix=$http_prefix –enable-so –enable-write –with-mpm=worker
make
make install
cd ..
if [ ! -f "$http_prefix/htdocs/test.php" ]
then
cp test.php $http_prefix/htdocs
fi
rm -rf httpd-2.2.14
echo “apache install is ok!”
sleep 2
fi
#install mysql client
is_inst_mysql=`find /usr/local/bin -name mysql | wc -l`
if [ "$is_inst_mysql" = 0 ]
then
tar zxvf mysql-5.1.41.tar.gz
cd mysql-5.1.41
./configure –without-server –with-extra-charsets=gbk,gb2312,utf8 –enable-thread-safe-client
make
make install
cd ..
echo “/usr/local/lib”>>/etc/ld.so.conf
ldconfig
rm -rf mysql-5.1.41
echo “mysql client install ok!”
sleep 2
fi
#install gd2
if [ ! -d /usr/local/gd2 ]
then
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure –prefix=/usr/local/gd2
make
make install
cd ..
rm -rf gd-2.0.35
echo “gd2 install is ok!”
sleep 2
fi
#install php.apache must be installed in /usr/local/apache2
if [ ! -d /usr/local/php ]
then
tar zxvf php-5.2.11.tar.gz
cd php-5.2.11
./configure –prefix=$php_prefix –with-gd=/usr/local/gd2 –with-apxs2=$http_prefix/bin/apxs –enable-mbregex –enable-bcmath
–with-mysql –with-zlib-dir –enable-mbstring=all –with-freetype-dir –with-pdo-mysql
make
make install
cp php.ini-dist $php_prefix/lib/php.ini
cd ..
rm -rf php-5.2.11
echo “php with gd2 install is ok!”
sleep 2
fi
# setting apache configuration file
sed -f httpd.sed $http_prefix/conf/httpd.conf>$http_prefix/conf/httpd.conf.temp
cd $http_prefix/conf
mv httpd.conf httpd.conf.old
cat httpd.conf.temp>httpd.conf
$http_prefix/bin/apachectl -t
cd
echo “It is very ok!”
elif [ "$Os_is" = "Linux" ]
then
echo “this linux”
## install apache
if [ ! -d "$http_prefix" ]
then
tar zxvf httpd-2.2.14.tar.gz
cd httpd-2.2.14
./configure –prefix=$http_prefix –enable-so –enable-write –with-mpm=worker
make
make install
cd ..
if [ ! -f "$http_prefix/htdocs/test.php" ]
then
cp test.php $http_prefix/htdocs
fi
rm -rf httpd-2.2.14
echo “apache install is ok!”
sleep 2
fi
#install mysql client
is_inst_mysql=`find /usr/local/bin -name mysql | wc -l`
if [ "$is_inst_mysql" = 0 ]
then
tar zxvf mysql-5.1.41.tar.gz
cd mysql-5.1.41
./configure –without-server –with-extra-charsets=gbk,gb2312,utf8 –enable-thread-safe-client
make
make install
cd ..
echo “/usr/local/lib”>>/etc/ld.so.conf
ldconfig
rm -rf mysql-5.1.41
echo “mysql client install ok!”
sleep 2
fi
#install freetype
if [ ! -d /usr/local/freetype ]
then
tar zxvf freetype-2.3.10.tar.gz
cd freetype-2.3.10
./configure –prefix=/usr/local/freetype
make
make install
cd ..
rm -rf freetype-2.3.10
echo “freetype install is ok!”
sleep 2
fi
#install jpeg
if [ ! -d /usr/local/jpeg ]
then
tar zxvf jpegsrc.v7.tar.gz
cd jpeg-7
./configure –prefix=/usr/local/jpeg
make
make install
cd ..
rm -rf jpeg-7
echo “gpeg install is ok!”
fi
#install libpng
if [ ! -d /usr/local/libpng ]
then
tar zxvf libpng-1.2.41.tar.gz
cd libpng-1.2.41
./configure –prefix=/usr/local/libpng
make
make install
cd ..
rm -rf libpng-1.2.41
echo “libpng install is ok!”
sleep 5
fi
#link header file
if [ ! -f /usr/include/pngconf.h ]
then
ln -s /usr/local/libpng/include/pngconf.h /usr/include
fi
if [ ! -f /usr/include/png.h ]
then
ln -s /usr/local/libpng/include/png.h /usr/include
fi
#install gd2
if [ ! -d /usr/local/gd2 ]
then
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure –prefix=/usr/local/gd2 –with-freetype=/usr/local/freetype –with-png=/usr/local/libpng –with-jpeg=/usr/local/
jpeg
make
make install
cd ..
rm -rf gd-2.0.35
echo “gd2 install is ok!”
sleep 2
fi
#install php.apache must be installed in /usr/local/apache2
if [ ! -d /usr/local/php ]
then
tar zxvf php-5.2.11.tar.gz
cd php-5.2.11
./configure –prefix=$php_prefix –with-gd=/usr/local/gd2 –with-apxs2=$http_prefix/bin/apxs –enable-mbregex –enable-bcmath
–with-mysql –with-zlib-dir –enable-mbstring=all –with-pdo-mysql –with-freetype=/usr/local/freetype
make
make install
cp php.ini-dist $php_prefix/lib/php.ini
cd ..
rm -rf php-5.2.11
echo “php with gd2 install is ok!”
sleep 2
fi
# setting apache configuration file
sed -f httpd.sed $http_prefix/conf/httpd.conf>$http_prefix/conf/httpd.conf.temp
cd $http_prefix/conf
mv httpd.conf httpd.conf.old
cat httpd.conf.temp>httpd.conf
$http_prefix/bin/apachectl -t
cd
echo “It is very ok!”
else
echo “this is other os,please modify the script”
exit 1
fi
文件 httpd.sed内容:
/application\/x-compress .Z/a\
\ AddType application/x-httpd-php .php
说明:
1、除mysql客户端而外,其他的安装路径皆为 /usr/local(如/usr/local/apache2)
2、所有的版本皆为当前最稳定版
3、自动生成apache配置文件的php环境,不需要再手动添加 AddType …x-hhtpd-php .php 这样的行。
4、自动生成php测试脚本
修订:新增系统判断,安装gd2相关工具
使用的都是当前最新稳定版本
包下载处 http://221.202.126.2/apmg/apmg_install.tar.gz
下载后,tar zxvf apmg_install.tar.gz ; cd apmg_install; ./setup.sh 自动完成安装,时间大概10多分钟
安装apache+gd2(jpeg,png等)+mysql-client+php脚本
原创
©著作权归作者所有:来自51CTO博客作者乐园园的原创作品,请联系作者获取转载授权,否则将追究法律责任
安装apache+gd2(jpeg,png等)+mysql-client+php脚本
https://blog.51cto.com/yueyuanyuan/394404
安装apache+gd2(jpeg,png等)+mysql-client+php脚本
https://blog.51cto.com/yueyuanyuan/394404
举报文章
请选择举报类型
内容侵权
涉嫌营销
内容抄袭
违法信息
其他
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M
相关文章
-
Linux下Shell脚本部署Mysql服务的配置文件
Install Mysql Services#Mysql configuration file example.#cloud_nsd/conf/mysql.conf#
Shell Mysql Linux mysql 服务器 -
超好用,分享8个 Python 自动化脚本
每天你都可能会执行许多重复的任务,例如阅读新闻、发auti
python 自动化办公 数据 html json -
Centos 6 LMAP配置(Linux,MySql,Apache,Php)
Centos 6 LMAP配置安装apacheyum install apache-y安装mysqlyum install m
apache centos mysql php linux -
mac下安装apache+php+mysql
APACHE+PHP mac自带apache浏览器,启动 sudo apachectl start 访问 http://localhost 开启php vphp7_modul
PHP扩展 环境安装 mysql php apache -
CentOS7 安装 Apache PHP MariaDB FTP
安装 Apache PHP MariaDB FTP本教程需要一些 vi 的基础知识,因为所有修改配置文件的操作都是在 vi 文
centos 运维 ftp apache php -
shell脚本安装MySQL(Docker版)
bin/bash运维@小兵DATE:2021-06-26DESCRIBE:Docker方式安装MySQLSYSTEM:
mysql shell脚本安装MySQL shell docker json -
Mac apache和php
Mac apache和php 今天才知道,原来mac自带有apache和php服务。apache开启
apache php mac 配置文件
午托邦 6 年前
jianting060 2012-01-20
linguimou 2010-09-26