Lamp Environment One-click Deployment

Source: Internet
Author: User

#!/bin/bash

#tangbo

#QQ 79313760

libs= "gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc g Libc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-d Evel Libidn libidn-devel OpenSSL openssl-devel pcre pcre-devel gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* N  Curses-devel libmcrypt* libtool-ltdl-devel* make CMake gcc-devel gcc-c++-devel autoconf* automake*ncurses libtool* cmake Bison Bison-devel Unzip "


Yum-y Install $libs


#mkdir dirctory

Soft_dir= "/var/soft"

if [!-D $soft _dir]

Then

mkdir $soft _dir

Fi

#mkdir MySQL Install and data

Mkdir/usr/local/mysql

Mkdir/usr/local/data

Chown-r Mysql.mysql/usr/local/mysql

Chown-r Mysql.mysql/usr/local/data


#代码上传, and Unzip

echo "Please upload the software source code to $soft _dir, after the completion of input OK:"

Read stat

if [$stat = = "OK"]

Then

echo "Enter the packages that need to be installed, separated by spaces:"

Read List_tmp

CD $soft _dir

Echo $list _tmp

For sft_temp in ' echo $list _tmp '

Do

sft= ' ls | grep $sft _temp '

/BIN/TAR-ZXVF $sft 1>/dev/null 2>&1

/BIN/TAR-JXVF $sft 1>/dev/null 2>&1

echo "$sft decompression Done"

Done

Else

echo "Please enter OK"

Fi


#编译安装

Home_dir=/usr/local


Add_usr () {

Groupadd $

Useradd-m-s/sbin/nologin-g

}


Get_dir () {

B_name=$1

CD $soft _dir

b_dir= ' ls | grep $b _name | Grep-v Tar '

}


#3, installing Apache

CD $soft _dir

For mk_temp in ' echo $list _tmp '

Do

Case $MK _temp in

#1, Install Apr

apr-1.5.1)

#add_usr www www

Get_dir $MK _temp

CD $b _dir

./configure--prefix=/usr/local/apr &>/dev/null && make && make install && echo "$MK _ Temp Installation Complete "

;;

#2, installing Apr-util

apr-util-1.5.4)

#add_usr www www

Get_dir $MK _temp

CD $b _dir

./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr &>/dev/null && make && make Install && echo "$MK _temp installation Complete"

;;

httpd-2.4.16)

Add_usr www www

Get_dir $MK _temp

CD $b _dir

./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--with-zlib--with-pcre--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util-- Enable-modules=most--enable-mods-shared=most--enable-mpms-shared=all--with-mpm=event &>/dev/null & & Make && make install && echo "$MK _temp installation Complete"

Chkconfig--add httpd

Chkconfig httpd on

;;

mysql-5.6.20)

ADD_USR MySQL MySQL

Get_dir $MK _temp

CD $b _dir && echo "$b _dir"

CMake \

-dcmake_install_prefix=/usr/local/mysql \

-dmysql_datadir=/usr/local/data \

-DSYSCONFDIR=/ETC \

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dwith_readline=1 \

-dmysql_unix_addr=/var/lib/mysql/mysql.sock \

-dmysql_tcp_port=3306 \

-denabled_local_infile=1 \

-dwith_partition_storage_engine=1 \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-DDEFAULT_COLLATION=UTF8_GENERAL_CI \

-dmysql_user=mysql && make && make install && echo "$mk _temp ann Complete"

cd/usr/local/mysql/scripts/&&/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/ Local/data

Cd/usr/local/mysql/support-files

CP Mysql.server/etc/rc.d/init.d/mysql

CP MY-DEFAULT.CNF/ETC/MY.CNF

Ln-s/usr/local/mysql/bin/*/usr/bin/

Chkconfig--add MySQL

Chkconfig MySQL on

;;


libmcrypt-2.5.7)

# add_usr www www

Get_dir $MK _temp

CD $b _dir

./configure &>/dev/null && make && make install && echo "$MK _temp installation Complete"

;;


php-5.6.0)

# add_usr www www

Get_dir $MK _temp

CD $b _dir

./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=/usr/local/mysql/ Bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir= /usr--enable-xml--enable-sockets--with-apxs2=/usr/local/apache/bin/apxs--with-config-file-path=/etc-- WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2--enable-maintainer-zts--with-mcrypt &>/dev/null && Make && make install && echo "$MK _temp installation Complete"

;;

*)

echo "usage:{apr-1.5.1 apr-util-1.5.4 httpd-2.4.16 mysql-5.6.20}"

Exit 1

;;

Esac

Done


This article from "Bobcat" blog, declined reprint!

Lamp Environment One-click Deployment

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.