#!/bin/bash
#nginx:nginx-1.8.0.tar.gz
#mysql:mysql-5.5.50.tar.gz
#php:php-5.5.31.tar.gz
#the software package
dir = /software
if [ ! -f $dir ];then
        mkdir $dir
fi
#configure epel source
cd $dir
wget http://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm
rpm -ivh epel-release-latest-6.noarch.rpm
yum repolist
#Install the development packages
yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devel libjpeg* libpng* freetype*
#close iptables and selinux
service iptables stop
sed -i 's/SELINUX=enforcing/SELINUX=diabled/g' /etc/sysconfig/selinux
setenforce 0
#install and configure mysql server
cd $dir
wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.50.tar.gz
if ! id mysql &> /deve/null;then
        useradd -d /usr/local/mysql -s /sbin/nologin mysql
fi
mkdir -p /mydata/data
mkdir -p /mydata/log
chown -R mysql.mysql /mydata/data
chown -R mysql.mysql /mydata/log
chmod 750 /mydata/data
chmod 750 /mydata/log
tar xf mysql-5.5.50.tar.gz
cd mysql-5.5.50
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/mydata/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DSYSCONFDIR=/etc \
-DWITH_SSL=yes

sed -i 's@datadir=/var/lib/mysql@datadir=/mydata/data@g' /etc/my.cnf
sed -i 's@socket=/var/lib/mysql/mysql.sock@socket=/tmp/mysql.sock@g' /etc/my.cnf

ln -s /usr/local/mysql/include/mysql /usr/include/mysql
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/data
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
service mysqld start
echo "PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile
mysqladmin -u root password Lsf@8816 #setting mysql root password
#install and configure nginx 1.8.1
#Install the prerequisite
yum -y install  gcc openssl-devel pcre-devel zlib-devel
cd $dir
groupadd nginx
useradd -g nginx -s /sbin/nologin nginx
wget http://nginx.org/download/nginx-1.8.1.tar.gz
tar xf nginx-1.8.1.tar.gz
cd nginx-1.8.1
./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock  --user=nginx --group=nginx --with-http_ssl_module --with-http_dav_module --with-http_flv_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi  && make && make install
mkdir -p /var/tmp/nginx/client
/usr/local/nginx/sbin/nginx
#install and configure php
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel
cd $dir
wget http://mirrors.sohu.com/php/php-5.5.31.tar.gz
tar xf php-5.5.31.tar.gz
cd php-5.4.25
./configure --prefix=/usr/local/php5 --enable-fpm --with-libxml-dir=/usr/local/lib --with-zlib-dir=/usr/local/lib --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd --enable-soap --enable-sockets  --enable-xml --enable-mbstring --with-png-dir=/usr/local --with-jpeg-dir=/usr/local --with-curl=/usr/lib --with-freetype-dir=/usr/include/freetype2/freetype/ --enable-bcmath --enable-zip --enable-maintainer-zts && make && make install
cp php.ini-development /etc/php.ini
echo "error_log = /usr/local/nginx/logs/php_error.log" >> /etc/php.ini
echo "date.timezone=PRC" >> /etc/php.ini
 cd /usr/local/php5/etc/

cp php-fpm.conf.default  php-fpm.conf
/usr/local/php5/sbin/php-fpm

LNMP脚本安装的更多相关文章

  1. LNMP 一键安装脚本

    这个脚本是使用shell编写,为了快速在生产环境上部署lnmp/lamp/lnmpa(Linux.Nginx/Tengine/OpenResty.MySQL/MariaDB/Percona.PHP), ...

  2. LNMP编译安装教程

    LNMP编译安装教程 此次安装在Centos上,我采用的CentOS的版本是:CentOS release 6.5 (Final) 可以通过以下命令查看:lsb_release -a 一.准备工作: ...

  3. lnmp一键安装的卸载

    http://blog.csdn.net/lansetiankong12/article/details/48130507  如果是lnmp一键安装的 进入安装包目录 [root@www home]# ...

  4. CentOS5.5 - lnmp环境安装与使用

    CentOS5.5 - lnmp环境安装与使用 到公司搭建环境可以直接使用YUM. 安装一.rpm包安装(安装方便) yum:下载软件包并且安装.前提:连网. yum 使用流程: 1. yum lis ...

  5. [转帖]LNMP组件安装

    https://lnmp.org/install.html 系统需求: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian/Deepin/Aliyun/Amazon/M ...

  6. lnmp 一键安装

    系统需求: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian/Deepin Server/Aliyun/Amazon/Mint Linux发行版 需要5GB以上硬盘剩 ...

  7. HHvm建站环境搭建方法:Nginx,Mariadb,hhvm及lnmp/lamp安装部署

    HHVM起源于Facebook公司,是一个开源的PHP虚拟机,使用JIT的编译方式以及其他技术,让PHP代码的执行性能大幅提升.HHVM提升PHP性能的途径,采用的方式就是替代Zend引擎来生成和执行 ...

  8. shell-网上lnmp一键安装讲解

    shell-网上lnmp一键安装讲解 #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/b ...

  9. lnmp 一键安装配置

    l系统需求: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian/Deepin Server/Aliyun/Amazon/Mint Linux发行版 需要5GB以上硬盘 ...

随机推荐

  1. Modelica学习

    Annotation Choices for Suggested Redeclarations and Modifications Replaceable model sample(start,int ...

  2. easyui datagrid 点击列表头排序出现错乱的原因

    之前我的导师,也就是带我的同事,使用datagrid,发现点击列表头排序出现乱序,按理说只有顺序和逆序两种排序结果.因为他比较忙,当时没解决,把排序禁掉了,后来又要求一定要排序,所以他交给我. 一开始 ...

  3. layer弹出层不居中解决方案

    layer弹出层不居中解决方案 代码头中加入以下代码即可 <!doctype html>

  4. nginx的初步了解

    今天学习了nginx.nginx不但可以作为服务器,类似于IIS,也可以作为反向代理.它有一个配置文件nginx.conf,在这个文件里配置了一些重要的参数,通过修改这些参数,然后启动nginx,就可 ...

  5. Libevent 的多线程操作

    起因是event_base 跨线程add/remove event 导致崩溃或者死循环. 据查:libvent 1.4.x是非线程安全的,要跨线程执行event_add,会有问题.因此传统做法是通过p ...

  6. MySQL出现Access denied for user 'root'@'%' to database 'netai_test'问题

    访问数据库时报错信息 Access denied for user 'root'@'%' to database 'netai_test' 原因:这是由于创建数据库后没有对用户授权,使用户可以访问数据 ...

  7. 解决 Gnome3 窗口背景是黑色的问题

    . . . . . Gnome3 在 Ubuntu 上窗口背景颜色经常是黑色的,终于找到了解决办法,其实很简单: >$ gsettings set com.canonical.desktop.i ...

  8. POJ 1151 Atlantis(线段树-扫描线,矩形面积并)

    题目链接:http://poj.org/problem?id=1151 题目大意:坐标轴上给你n个矩形, 问这n个矩形覆盖的面积 题目思路:矩形面积并. 代码如下: #include<stdio ...

  9. h5 js 图片预览并判断 ajax上传

    //建立一個可存取到該file的url function getObjectURL(file) { var url = null; if (window.createObjectURL != unde ...

  10. 伸缩盒 Flexible Box(新)

    flex   flex-grow    flex-shrink   flex-basis  flex-flow   flex-direction   flex-wrap  align-content  ...