LNMP Script Installation

Source: Internet
Author: User

#!/bin/bash
#nginx: nginx-1.8.0.tar.gz
#mysql: mysql-5.5.50.tar.gz
#php:p hp-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 C Url-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 ' [email protected]=/var/lib/[email protected]=/mydata/[email protected] '/etc/my.cnf
Sed-i ' [email protected]=/var/lib/mysql/[email protected]=/tmp/[email protected] '/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 [email protected] #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-deve L zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs E2 Fsprogs-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 Script Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.