Open Source Solution: Quickly build a stand-alone version of the LAMP website

Source: Internet
Author: User

LAMP usually means that the components of Linux + Apache + mysql/mariadb + Perl/php/python,lamp are not immutable and are not limited to the original selection. As a solution suite, LAMP is ideal for building dynamic Web sites and website applications. It is also necessary to use components such as Zabbix to monitor the site.

For a better reading experience, you can click here .

Installing LAMP

The LAMP for this document refers to Linux + Apache2 + MySQL + php5 and each example step is based on a Linux virtual machine in an Azure environment. This document describes three ways to install lamp:1. Using Azure PowerShell script; 2. Using the Azure CLI; 3. Use SHELL scripts. The Zabbix agent is automatically installed on the virtual machine during LAMP installation.

Description
Currently, the Azure PowerShell script and the Azure CLI approach only support CentOS (6.5, 6.6, 6.7, 7.0, 7.1, 7.2). The SHELL script has three versions of CentOS, Ubuntu, and SLES.

Parameter usage precautions:
Dnsnameprefix: Must be lowercase to ensure uniqueness, this parameter will be used as the DNS prefix.
Zabbixserveripaddress: Optional, specify Zabbix server address.

Azure PowerShell Mode

PowerShell Script Runtime Considerations:
You need to run PowerShell with administrator privileges before you use the following command:

Set-executionpolicy-executionpolicy Unrestricted

If you chose Azure PowerShell to install LAMP, install Azure PowerShell on your local computer as described in how to install and configure Azure PowerShell. Then open the Azure PowerShell command prompt to sign in with your work or school ID by running the following command and following the interactive sign-in experience of prompting for your Azure account:

Login-azurermaccount-environmentname Azurechinacloud

Then you need to create an Azure resource group (Resource Group), create an Azure virtual machine and install lamp in that resource group, and run the following command to create an Azure resource group:

New-azurermresourcegroup-name "Your-resource-group-name"-location "China East"

You need to download PowerShell script Single-lamp-deploy.ps1, run the Single-lamp-deploy.ps1 script in the following example to generate a CentOS virtual machine in the resource group RG1, and then install it on that virtual machine LAMP. Where Rg1 is the name of the resource group created in the previous step.

PS c:\>. \single-lamp-deploy.ps1-resourcegroupname rg1-centosversion 7.0-adminusername Azureuser-adminpassword " Your-password "  -mysqlpassword" Your-mysql-password "-dnsnameprefix" Your-dns-prefix "

The creation process takes about 20 minutes, and after successful operation, the following prompt will appear, here we go directly to the following steps to visit the site to verify.

Deploy LAMP Server successfully. To Veriy the lamp server deployment, following below Steps:open the URL  http://<YOUR-DNS-PREFIX>. chinaeast.cloudapp.chinacloudapi.cn/mysql.php to check if PHP can connect to MySQL, if can do some insert operation, and F Inally it would return the result on the Web page. If you refresh the webpage, would insert another record into MySQL db table.  We strongly recommend delete/var/www/html/mysql.php after you access the URL and see the successful result because Mysql.php stores your MySQL root password. You can delete the inserted data by executing below Commands:mysql-uroot-pdrop database testdb;

Azure CLI Mode

If you chose the Azure CLI method to install LAMP, install the Azure CLI. Then make sure that you are in Resource Manager mode, and that you can verify by running the following command:

Azure Config mode arm

Now sign in with your work or school ID by running the following command and following the interactive sign-in experience of prompting for your Azure account:

Azure Login-e azurechinacloud-u <your account>

Then you need to create an Azure resource group (Resource Group), create an Azure virtual machine and install LAMP in that resource group, and run the following command to create an Azure resource group:

Azure Group Create "Your-resource-group-name" "China East"

You need to download the Azuredeploy.parameters.json parameter configuration file on the machine where the Azure CLI is installed, run the following command:

wget Http://msmirrors.blob.core.chinacloudapi.cn/single-lamp/azuredeploy.parameters.json-O Azuredeploy.parameters.json

Then modify the Azuredeploy.parameters.json parameter configuration file:

VI Azuredeploy.parameters.json

You need to modify the values of "AdminPassword", "Dnsnameprefix", and "Mysqlpassword", and other parameter values can remain unchanged by default. Then run the following command to install the CentOS virtual machine and LAMP, the creation process takes approximately 20 minutes, where Rg1 is the name of the resource group created in the previous step:

$TemplateUri = "Http://msmirrors.blob.core.chinacloudapi.cn/single-lamp/azuredeploy.json" Azure Group Deployment Create Rg1 deploylamp--template-uri $TemplateUri-E Azuredeploy.parameters.json

Using SHELL scripting methods

If you have already built a LINUX virtual machine, you can run the SHELL script to install LAMP directly.

If you do not have a Linux virtual machine under Azure, please refer to Azure Linux VM tutorial. Create a LINUX virtual machine.

Connect to your LINUX virtual machine. If this is your first time using Azure's Linux virtual machine, refer to Azure Linux VM tutorial to connect to the virtual machine.

Different LINUX distributions are slightly different when installing LAMP. Please select the appropriate steps for your LINUX version.

Redhat Base Linux: (with CentOS 7.0, 64-bit system, MySQL Server 5.6, Apache 2.4, PHP5 for example)

To download the shell script:

$sudo wget http://msmirrors.blob.core.chinacloudapi.cn/single-lamp/install_single_lamp.sh

Then execute the following command. Note: Mysqlpassword refers to your MySQL root password, set according to your specific situation, insertvalue refers to the value you want to write to the MySQL test table, this value is accessed http://yourwebsite/ Mysql.php will show up.

For example, if you run sudo bash install_single_lamp.sh s3cret Jack then S3cret is your MySQL root password, and Jack is writing to the values in the MySQL test table.

$sudo Bash install_single_lamp.sh Mysqlpassword insertvalue

ubuntu Linux: (in Ubuntu 14.04, 64-bit system, MySQL 5.5, Apache 2.4, PHP5 for example)

To download the shell script:

$sudo wget http://msmirrors.blob.core.chinacloudapi.cn/single-lamp/install_single_lamp_Ubuntu.sh

Then execute the following command. Note: Mysqlpassword refers to your MySQL root password, set according to your specific situation, insertvalue refers to the value you want to write to the MySQL test table, this value is accessed http://yourwebsite/ Mysql.php will show up. For example, if you run sudo bash install_single_lamp_ubuntu.sh s3cret Jack then S3cret is your MySQL root password, and Jack is writing to the values in the MySQL test table.

$sudo Bash install_single_lamp_ubuntu.sh Mysqlpassword insertvalue

SUSE Linux: (in SLES, 64-bit system, MySQL Server 5.6, Apache 2.4, PHP5 for example)

To download the SHELL script:

$sudo wget http://msmirrors.blob.core.chinacloudapi.cn/single-lamp/install_single_lamp_SLES.sh

Then execute the following command. Note: Mysqlpassword refers to your MySQL root password, set according to your specific situation, insertvalue refers to the value you want to write to the MySQL test table, this value is accessed http://yourwebsite/ Mysql.php will show up.

For example, if you run sudo bash install_single_lamp_sles.sh s3cret Jack then S3cret is your MySQL root password, and Jack is writing to the values in the MySQL test table.

$sudo Bash install_single_lamp_sles.sh Mysqlpassword insertvalue

  

Open Source Solution: Quickly build a stand-alone version of the LAMP website

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.