Automatic Setup of LAMP environment for Linux server Shell code sharing

Source: Internet
Author: User
The LAMP (Linux-Apache-MySQL-PHP) website architecture is currently a popular Web framework, including: Linux operating system, Apache Network Server, MySQL database, perl, PHP, or Python programming language. all components are open-source software and are internationally mature architecture frameworks. many popular commercial applications are LAMP (Linux-Apache-MySQL-PHP) the website architecture is a popular Web framework. It includes the Linux operating system, Apache Network Server, MySQL database, Perl, PHP, or Python programming language, all components are open-source software and are an internationally mature architecture framework. many popular commercial applications adopt this architecture. compared with the Java/J2EE architecture, LAMP features rich Web resources, lightweight, and fast development. compared with the NET architecture, LAMP has the advantages of common, cross-platform, high performance and low price. Therefore, LAMP is the preferred platform for enterprises to build websites, regardless of its performance, quality, and price.



Place the Apache MySQL php source code package and the installation script in the same directory. run the script file and enter the installation path as prompted by the script.

#! /Bin/bash
Echo "1. please input the mysqls path where will installed [default:/web/mysql]"
Read sqlread
If ["$ sqlread "! = ""]; Then
SQL = $ sqlread
Else
SQL = "/web/mysql"
Fi

Echo "2. please input the httpdpath where will installed [default:/web/httpd]"
Read httpdread
If ["$ httpdread "! = ""]; Then
Httpd = $ httpdread
Else
Httpd = "/web/httpd"
Fi

Echo "3. please input the phps path where will installed [default:/web/php]"
Read phpread
If ["$ phpread "! = ""]; Then
Php = $ phpread
Else
Php = "/web/php"
Fi


Mkdir-p $ SQL
Mkdir-p $ httpd
Mkdir-p $ php
Useradd mysql
Tar zxvf 'ls | grep mysql | grep tar'
Cd 'ls-d */| grep mysql'
./Configure -- prefix = $ SQL -- enable-thread-safe-client -- with-extra-charsets = gbk & make install
Cp./support-files/my-medium.cnf/etc/my. cnf
$ {SQL}/bin/mysql_install_db -- user = mysql
Cd ..

Tar zxvf 'ls | grep http | grep tar'
Cd 'ls-d */| grep http'
./Configure -- prefix = $ httpd -- enable-so -- enable-rewrite & make install
Cd ..

Tar zxvf 'ls | grep php | grep tar'
Cd 'ls-d */| grep php'
. /Configure -- prefix = $ php -- with-mysql = $ SQL -- with-apxs2 =$ {httpd}/bin/apxs -- with-config-file-path =/usr/local/lib /& make install
Cp-f'ls | grep php. ini | head-1 '/usr/local/lib/php. ini
Cd ..

Ln-s $ {SQL}/bin/*/usr/bin/
Ln-s $ {httpd}/bin/*/usr/bin/
Ln-s $ {php}/bin/*/usr/bin/
Echo "$ {httpd}/bin/apachectl start">/etc/rc. d/rc. local
Echo "$ {SQL}/bin/mysqld_safe -- user = mysql &">/etc/rc. d/rc. local
Echo "AddType application/x-httpd-php. php" >$ {httpd}/conf/httpd. conf
 
Related Article

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.