CENTOS6 X64 LAMP+GD SHELL脚本
客户生产环境是centos6.5 x64位操作系统,需要往上面部署php网站,并开启GD库功能。为此,自己写了一个脚本,提高工作效率。
安装过程中,最为诡异的还是php.ini文件,编译完成后将php.ini-development拷到php配置目录下,gd库竟然不起作用,php网站的png验证码显示不正常,在网上查了很多资料,发现csdn论坛里有一个网友跟我出现了同样类似的问题,但是并没有解决办法
http://bbs.csdn.net/topics/300204068
把php.ini文件删除后,竟然神奇的成功了,恳请各位大神指点迷津。
脚本很原始,就是一个批处理文件。由于是自己用,所以就没有什么交互的东西,但是愿意给各位出现同样问题的网友分享一下。
!/bin/bash
install_dir=/usr/local
apache_dir=$install_dir/apache/
mysql_dir=$install_dir/mysql/
php_dir=$install_dir/php/
aprutil_dir=$install_dir/aprutil/
freetype_dir=$install_dir/freetype/
apr_dir=$install_dir/apr/
pcre_dir=$install_dir/pcre/
jpeg_dir=$install_dir/jpeg6/
gd_dir=$install_dir/gd2.1/
libxml2_dir=$install_dir/libxml2
zlib_dir=$install_dir/zlib/
if [ "$UID" -ne 0 ]
then
printf "Error: You must be root to run this script!\n"
exit 1
fi
echo '/dev/cdrom/mnt/iso9660defaults0 0' >> /etc/fstab ;
mount -a
rm -rf /etc/yum.repos.d/*
echo -e '[dvd]\nbaseurl=file:///mnt\ngpgcheck=0\nenabled=1' > /etc/yum.repos.d/my.repo
yum update
for src in gcc gcc-c++ gmake ncurses-devel gzip libXpm-devel libXext-deveb libXpm libXext libtool libtool-ltdl-devel
do
yum -y install $src ;
done
for file in $PWD/*.tar.gz
do
tar -zxf $file
done
#apache
cd apr-1*
./configure --prefix=$apr_dir;make;make install ;
cd ../
cd apr-u*
./configure --prefix=$aprutil_dir --with-apr=$apr_dir ;make;make install ;
cd ../
cd pcre*/
./configure --prefix=$pcre_dir ; make ; make install ;
cd ../
cd httpd-*
./configure --prefix=$apache_dir --enable-so --with-apr-util=$aprutil_dir --with-pcre=$pcre_dir -enable-rewrite ;make;make install ;
cd ../
cp $apache_dir/bin/apachectl /etc/rc.d/init.d/httpd
sed -i '1 i #chkconfig:345 66 33\n#description:Apache\n' /etc/rc.d/init.d/httpd
chkconfig --add httpd
chkconfig httpd --level 345 on
#mysql
cd mysql*
./configure --without-debug --with-mysqld-ldflags=--all-static --with-client-ldflags=--all-static --prefix=$mysql_dir ;make ;make install ;
groupadd mysql
useradd mysql -g mysql
chown -R mysql:mysql /usr/local/mysql/
$mysql_dir/bin/mysql_install_db --user=mysql
cp -pr support-files/my-medium.cnf /etc/init.d/my.cnf
cp -pr support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig mysqld --level 345 on
cd ../
#php(freetype,libpng,jpeg,gd,libxml2,php)
mkdir -p $jpeg_dir
mkdir -p $jpeg_dir/bin
mkdir -p $jpeg_dir/lib
mkdir -p $jpeg_dir/include
mkdir -p $jpeg_dir/man
mkdir -p $jpeg_dir/man1
mkdir -p $jpeg_dir/man/man1
cd jpeg*/
yes | cp -fr /usr/share/libtool/config.guess .
yes | cp -fr /usr/share/libtool/config.sub .
./configure --prefix=$jpeg_dir --enable-shared --enable-static ;
make ;
make install ;
cd ../
cd zlib*/
./configure;
sed -i 's/CFLAGS=-O3 -DUSE_MMAP/CFLAGS=-O3 -DUSE_MMAP -fPIC/g' Makefile
make;make install ;
cd ../
cd libpng*/
yes | cp -fr /usr/share/libtool/config.guess .
yes | cp -fr /usr/share/libtool/config.sub .
./configure --enable-shared --enable-static ;
make ;
make install ;
cd ../
cd freetype*/
mkdir -p /usr/local/freetype
./configure --prefix=$freetype_dir ;
make ;
make install ;
cd ../
cd libgd*/
mkdir -p /usr/local/lib/bin/
ln -s /usr/bin/libpng-config /usr/local/lib/bin/
./configure --prefix=/usr/local/gd2.1 --with-jpeg=$jpeg_dir --with-png=/usr/local/ --with-zlib=/usr/local/lib --with-freetype=/usr/local/freetype/
make ;
make install ;
cd ..
cd libxml2*
./configure --prefix=$libxml2_dir ;
make ;
make install ;
cd ../
cd php*
./configure --prefix=$php_dir --with-apxs2=$apache_dir/bin/apxs --with-config-file-path=$php_dir/etc --with-mysqli=$mysql_dir/bin/mysql_config --with-mysql=$mysql_dir --with-libxml-dir=$libxml2_dir --with-gd=$gd_dir --with-jpeg-dir=$jpeg_dir --with-png-dir=/usr/local/ --with-zlib-dir=/usr/lib --with-freetype-dir=$freetype_dir --enable-ftp --enable-soap --enable-sockets --enable-mbstring --with-xpm-dir=/usr/lib64 ;
make ;
make install ;
sed -i '378 i AddType application/x-httpd-php .php .phtml\nAddType application/x-httpd-php-source .phps' $apache_dir/conf/httpd.conf
sed -i 's/index.html/index.php index.html/' $apache_dir/conf/httpd.conf
iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 80 -j ACCEPT
iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 3306 -j ACCEPT
/etc/init.d/iptables save
安装包下载
http://pan.baidu.com/s/1hqH2HDE
转载于:https://blog.51cto.com/ansed/1622965
CENTOS6 X64 LAMP+GD SHELL脚本相关推荐
- Centos6.5下通过shell脚本快速安装samba服务器
使用方法如下: 上传脚本到linux服务器授权 脚本如下: #!/bin/sh yum -y install samba samba-client echo -e "thinkive\nth ...
- Centos 上面用Shell脚本一键安装LAMP环境
1)系统环境介绍 Centos 5.8 64位 Apache:httpd-2.4.4.tar.gz PHP: php-5.4.17.tar.gz Mysq ...
- Centos6.5 LAMP环境源码包安装与配置,附安装包百度网盘地址
Centos6.5 LAMP环境源码包安装与配置 http://pan.baidu.com/s/1nvNruzv 安装包百度网盘地址 LAMP是一种web网络应用和开发环境,是linux,Apache ...
- 源码部署Apache和shell脚本安装
一.Apache特点: 功能强大,配置简单,速度快,应用广泛,性能稳定,可做代理服务器及负载均衡来使用. 1.处理静态页面图片不及nginx 2.Apace.结合php来处理php.perl等,经典的 ...
- Shell脚本自动源码包安装LA/NMP架构详解(赠软件包+脚本)
脚本环境 1.linux centos 7 系统 2.光盘镜像文件已挂载 3.系统可连接外网 4.软件包下载链接 lamp 链接:https://pan.baidu.com/s/1x6PTj_aUN2 ...
- shell脚本编程100例
https://blog.csdn.net/yugemengjing/article/details/82469785 https://blog.csdn.net/yugemengjing/artic ...
- Shell脚本详解---一篇搞定
有道云分享链接 1.1 前言 1.1.1 为什么学Shell Shell脚本语言是实现Linux/UNIX系统管理及自动化运维所必备的重要工具, Linux/UNIX系统的底层及基础应用软件的核心大都 ...
- Linux入门(八)Shell脚本
目录 1.Shell基础 1.1 Shell概述 1.2 Shell脚本的执行方法 1.3 Bash的基本功能 1.3.1 历史命令与命令补全 1.3.2 命令别名与常用快捷键 1.3.3 输入输出重 ...
- 100个实用的 Linux Shell 脚本经典案例,收藏备用~
点击关注公众号,利用碎片时间学习 1)编写hello world脚本 #!/bin/bash # 编写hello world脚本 echo "Hello World!" 2)通过位 ...
最新文章
- Pass Infrastructure基础架构(上)
- python编程django遇到问题Passing a 3-tuple to include() is not supported.解决方案
- 【算法竞赛学习】气象海洋预测-Task4 模型建立之 TCNN+RNN
- .NET Core 2.0体验
- python u_对python 命令的-u参数详解
- 参加完阿里蚂蚁金服Java中间件6轮面试题!6点血泪总结~
- Java中所有锁介绍
- 操作系统 内存碎片 cache替换算法 虚拟地址逻辑地址线性地址物理地址
- win7中配置iis
- C++ STL 使用assign对list中的元素进行重置
- 假如我是一个项目总监/经理 From CSDN
- 电源大师课笔记 2.4
- 广州大学人工智能原理实验二:八数码问题
- qlv是什么格式?要怎么把qlv格式转换成mp4视频
- elementUI的input使用扫描枪,回显值后重新刷新页面
- 攻防世界——web新手题
- (八)二叉树—线索二叉树
- sku设计mysql_SKU数据库设计
- 20个VC开发小技巧
- C#使用TCP进行聊天通信(详细解析)
热门文章
- 根据表格中的数据长度自动调整表格宽度DBGrid
- 转 天才学生的天才回答
- NDoc修改手记(一)
- AndroidStudio安卓原生开发_Intent传过来的值会自动变化_太奇怪了_你碰见过嘛_Http并发引起的问题?_可通过静态变量传值的方式解决---Android原生开发工作笔记130
- Sharding-Proxy读写分离_Sharding-Sphere_分库分表_读写分离_工作笔记021
- 架构设计工作笔记004---架构中常见的概念积累--随时更新
- Git工作笔记002---CentOS安装gitLab社区版
- 人脸识别FAR值重新认识
- 将connection存放在Threadlocal里和数据库连接池的区别
- hibernate多对多映射关系实现