#!/bin/bash

 #description:mysql-5.5..tar apache2.4.23 php5.6.27

 function check_ok(){
if [ $? -eq ]
then
echo "-------------ok-------"
else
echo "please check error"
exit
fi
} function set_yum(){
echo "set yum repo"
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# yum clean all &>/dev/null
yum makecache &>/dev/null
check_ok
} function install_mysql(){
echo "mysql5.5.53 will be installed,please be patient"
wget -O /usr/local/src/mysql-5.5..tar http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.53.tar.gz
cd /usr/local/src
tar -zxf mysql-5.5..tar
check_ok
cd /usr/local/src/mysql-5.5.
useradd -u -s /sbin/nologin mysql
mkdir /data
yum install cmake -y
yum install ncurses-devel -y
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE= -DWITH_INNOBASE_STORAGE_ENGINE= -DWITH_MEMORY_STORAGE_ENGINE= -DWITH_READLINE= -DENABLED_LOCAL_INFILE= -DMYSQL_DATADIR=/data -DMYSQL_USER=mysql
check_ok
make -j && make install
check_ok
chown -R mysql:mysql /usr/local/mysql/
chown -R mysql:mysql /data cp support-files/my-large.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
sed -i 's/^basedir=$/basedir=\/usr\/local\/mysql/' /etc/init.d/mysqld
sed -i 's/^datadir=$/datadir=\/data/' /etc/init.d/mysqld
chkconfig mysqld on
chmod +x scripts/mysql_install_db
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data --user=mysql
service mysqld start iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
/etc/init.d/iptables save
check_ok
echo 'export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile
source /etc/profile
} function install_apache(){
echo "apache2.4.23 will be installed,please be patient"
cd /usr/local/src
wget http://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz
wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.5.4.tar.gz
check_ok
tar zxf apr-1.5..tar.gz
cd apr-1.5.
./configure --prefix=/usr/local/apr
check_ok
make && make install
check_ok cd /usr/local/src
tar zxf apr-util-1.5..tar.gz
cd apr-util-1.5.
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
check_ok
make && make install
check_ok cd /usr/local/src
wget http://ftp.exim.llorien.org/pcre/pcre-8.39.tar.gz
tar xvf pcre-8.39.tar.gz
cd pcre-8.39
./configure --prefix=/usr/local/pcre
make && make install
check_ok cd /usr/local/src
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.23.tar.gz
tar zxf httpd-2.4..tar.gz
/bin/cp -r apr-1.5. /usr/local/src/httpd-2.4./srclib/apr
/bin/cp -r apr-util-1.5. /usr/local/src/httpd-2.4./srclib/apr-util
cd /usr/local/src/httpd-2.4.
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --enable-mods-shared=most --enable-so --with-included-apr
check_ok
make && make install
check_ok
cp -a /usr/local/apache2/bin/apachectl /etc/init.d/httpd
sed -i '1a #chkconfig: 2345 10 90' /etc/init.d/httpd
sed -i '2a #description: Activates/Deactivates Apache Web Server' /etc/init.d/httpd
echo "export PATH=$PATH:/usr/local/apache2/bin" >>/etc/profile
source /etc/profile
check_ok
chkconfig --add httpd
chkconfig httpd on
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
/etc/init.d/iptables save
check_ok
/usr/local/apache2/bin/apachectl
check_ok
service httpd restart
} function install_php(){
echo "php5.6.27 will be installed,please be patient"
cd /usr/local/src
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar zxvf libmcrypt-2.5..tar.gz
cd libmcrypt-2.5.
./configure --prefix=/usr/local/libmcrypt
make && make install
cd /usr/local/src wget http://am1.php.net/get/php-5.6.27.tar.gz/from/this/mirror tar zxf php-5.6..tar.gz
cd php-5.6.
yum install openssl openssl-devel -y
yum install bzip2 bzip2-devel -y
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt=/usr/local/libmcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6 check_ok
make -j && make install
check_ok cp /usr/local/src/php-5.6./php.ini-production /usr/local/php/etc/php.ini
sed -i 's#^;date.timezone =#date.timezone=Asia/Shanghai#' /usr/local/php/etc/php.ini
check_ok
#
}
function set_lamp(){
sed -i '/AddType application\/x-gzip .gz .tgz/a\ AddType application/x-httpd-php .php\n' /usr/local/apache2/conf/httpd.conf
sed -i 's#index.html#index.html index.php#' /usr/local/apache2/conf/httpd.conf
sed -i '/#ServerName www.example.com:80/a\ServerName localhost:80\n' /usr/local/apache2/conf/httpd.conf
check_ok
cat >>/usr/local/apache2/htdocs/test.php<<EOF
<?php
echo "PHP is OK\n";
phpinfo();
?>
EOF /usr/local/apache2/bin/apachectl graceful
check_ok
} function install_lamp(){
install_mysql
install_apache
install_php
set_lamp
shutdown -r now
}
install_lamp

lamp 源码安装的更多相关文章

  1. Linux LAMP源码安装

    查看编译参数 # httpd cat /app/httpd24/build/config.nice # mysql cat /app/mysql/docs/INFO_BIN # php php -i ...

  2. LAMP源码安装,搭建zabbix监控

    #LAMP#httpd-2.2.32#mysql-5.7.17-linux-glibc2.5-x86_64 二进制压缩版#php5.3.27 1.系统环境优化检查 sed -i 's/SELINUX= ...

  3. lamp源码安装

    先从Apache开始装->MySQL->PHP PHP在编译的时候需要用到MySQL的一些参数,需要用到Apache的参数. 准备工作: 1.查看系统中是否有自带的Apache 如果提示你 ...

  4. Lamp源码包安装实录

    Lamp源码包安装实录 附件中是安装步骤,下载站点里包含视频(http://down.51cto.com/data/460776) 本文出自 "李晨光原创技术博客" 博客,请务必保 ...

  5. CentOS 6.3下源码安装LAMP(Linux+Apache+Mysql+Php)环境【转载】

    本文转载自 园友David_Tang的博客,如有侵权请联系本人及时删除,原文地址: http://www.cnblogs.com/mchina/archive/2012/11/28/2778779.h ...

  6. 以源码安装的lamp环境为依托,源码安装zabbix监控系统

    1.源码安装lamp环境 1)安装httpd, 以源码httpd-2.4.33为基础,解压后,执行./configure --prefix=/usr/local/ --sysconfdir=/etc/ ...

  7. linux应用之Lamp(apache+mysql+php)的源码安装(centos)

    Linux+Apache+Mysql+Php源码安装 一.安装环境: 系统:Centos6.5x64 Apache: httpd-2.4.10.tar.gz Mysql: mysql-5.6.20-l ...

  8. Httpd服务进阶知识-LAMP源码编译安装

    Httpd服务进阶知识-LAMP源码编译安装 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 想必大家都知道,动态资源交给fastcgi程序处理,静态资源依旧由httpd服务器处理  ...

  9. LAMP源码编译安装

    php加速器 XCache 快速而且稳定的PHP opcode缓存,经过严格测试且被大量用于生产环境. 项目地址:http://xcache.lighttpd.net/,收录EPEL源 实现XCach ...

随机推荐

  1. HTML5+Bootstrap 学习笔记 1

    HTML <header> 标签 <header> 标签定义文档的页眉(介绍信息),是 HTML 5 中的新标签. 参考资料: HTML <header> 标签 h ...

  2. 图的遍历——DFS(邻接矩阵)

    递归 + 标记 一个连通图只要DFS一次,即可打印所有的点. #include <iostream> #include <cstdio> #include <cstdli ...

  3. sql分页使用join提高性能

    今天在分析系统中的分页sql时意外知道了使用join可以提高分页性能. 逻辑是join部分使用单一表,单一字段排序分页,然后join大表.

  4. iOS- NSThread/NSOperation/GCD 三种多线程技术的对比及实现

    1.iOS的三种多线程技术 1.NSThread 每个NSThread对象对应一个线程,量级较轻(真正的多线程) 2.以下两点是苹果专门开发的“并发”技术,使得程序员可以不再去关心线程的具体使用问题 ...

  5. MVC学习笔记:入门

    1.controller/action action直接返回字符串,适用于不需要返回大量html的业务,类似一般处理程序. 如果需要返回大量html代码,需要返回view(); View文件夹中需添加 ...

  6. 无法打开mfc120.lib

    今天在用VS2013编译OSG的时候报错:无法打开mfc120.lib.仔细查了下资料. 我是这么解决的: 安装Multibyte MFC Library for Visual Studio 2013 ...

  7. winform 删除,清空指定文件夹上的所有文件或文件夹

    //递归删除文件夹及子文件C#代码: public void DeleteFolder(string dir) { if (Directory.Exists(dir)) //如果存在这个文件夹删除之 ...

  8. python爬虫--打开爬取页面

    def requests_view(response): import webbrowser requests_url = response.url base_url = '<head>& ...

  9. dedecms给原模型添加新字段

    1.进入dedecms后台 2.点击核心=>频道模型=>内容模型管理(在这里可以看到dedecms预设的模型设置) 3.选中我们需要的模型,点击更改,跳入以下页面 4.点击字段管理(可以看 ...

  10. 网页中NPIO对Excel的操作实例

    上一节是在wpf中实现对excel的操作方法,这一节看看网页中如何封装实现对excel的上传导入和下载保存的. 看看效果图: