How to write installation configuration lamp service Script

Source: Internet
Author: User

This script example requires the following:

The source code installs lamp environment, request executes the script under the character terminal (Ls-l/usr/src display is different)

The required tar packets have been copied to the/USR/SRC directory

#!/bin/bash

Rpm-q httpd &>/dev/null

If [$?-eq 0];then

Yum-y Remove httpd &>/dev/null

Fi

Ls-l/usr/local/| grep httpd &>/dev/null

If [$?-ne 0];then

Httpball= ' ls/usr/src/httpd*.gz '

Tar zxf $httpball-C/usr/src &>/dev/null

Dir= ' Ls-l/usr/src | grep ^d | grep httpd | awk ' {print $} '

cd/usr/src/$dir

./configure--prefix=/usr/local/httpd--enable-so--enable-rewrite--enable-charset-lite--enable-cgi && make && make Install

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

Cp/usr/local/httpd/bin/apachectl/etc/init.d/httpd

Sed-i ' 1a #chkconfig: 35 85 15 \

#description: httpd server '/etc/init.d/httpd

Chkconfig--add httpd

Chkconfig httpd on

Service httpd Start

Fi

Rpm-q Mysql-server &>/dev/null

If [$?-eq 0];then

Yum-y mysql-server MySQL &>/dev/null

Fi

Ls-l/usr/local | grep MySQL &>/dev/null

If [$?-ne 0];then

grep mysql/etc/passwd &>/dev/null

If [$?-ne 0]; Then

Useradd-m-u 49-s/sbin/nologin mysql

Fi

Mysqlball= ' ls/usr/src/mysql*.gz '

Tar zxf $mysqlball-C/usr/src &>/dev/null

Dir= ' Ls-l/usr/src | grep ^d | grep MySQL | awk ' {print $} '

cd/usr/src/$dir

./configure--prefix=/usr/local/mysql--with-charset=utf8--with-collation=utf8_general_ci--with-extra-charset= gbk,gb2312 && make && make install

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.