LAMP 通常表示 Linux + Apache + MySQL/MariaDB + Perl/PHP/Python,LAMP 的各個組件不是一成不變的,并不局限于它最初的選擇。作為一個解決方案套件,LAMP 非常適合構建動態網站和網站應用程式。另外使用類似 Zabbix 這樣的組件做監控也是網站必不可少的。如果想獲得更好的閱讀體驗,這里是傳送門。
安裝 LAMP
本檔案的 LAMP 代指 Linux + Apache2 + MySQL + php5 且各示例步驟基于 Azure 環境下的 LINUX 虛擬機。本檔案介紹三種方式來安裝LAMP:1. 使用 Azure PowerShell 腳本; 2. 使用 Azure CLI; 3. 使用 SHELL 腳本。 安裝 LAMP 程序中會在虛擬機上自動安裝 Zabbix agent。
說明:
目前 Azure PowerShell 腳本和 Azure CLI 方式僅支持 CentOS(6.5, 6.6, 6.7, 7.0, 7.1, 7.2)。而 SHELL 腳本則有 CentOS, Ubuntu以及 SLES 三個版本。
引數使用注意事項:
DNSNamePrefix:必須小寫,需保證唯一性,該引數將作為 DNS 前綴。
ZabbixServerIPAddress:可選項,指定 Zabbix 服務器地址。
Azure PowerShell 方式
PowerShell 腳本運行注意事項:
需要以管理員權限運行 PowerShell,使用之前需運行如下命令:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
如果您選擇 Azure PowerShell 方式安裝 LAMP,那么請按如何安裝和配置 Azure PowerShell 中的說明在本地計算機上安裝 Azure PowerShell。然后打開 Azure PowerShell 命令提示符,通過運行以下命令并遵循提示進行 Azure 帳戶的互動式登錄體驗,來使用作業或學校 ID 登錄:
Login-AzureRmAccount -EnvironmentName AzureChinaCloud
然后您需要創建一個 Azure 資源組 (Resource Group),創建 Azure 虛擬機和安裝LAMP都在該資源組中進行,運行以下命令創建 Azure 資源組:
New-AzureRmResourceGroup -Name "YOUR-RESOURCE-GROUP-NAME" -Location "China East"
您需要下載 PowerShell 腳本 single-lamp-deploy.ps1,按照以下示例運行 single-lamp-deploy.ps1 腳本,即可在資源組 rg1 中生成一臺 CentOS 虛擬機,接著會在該虛機上安裝 LAMP。其中 rg1 是在之前步驟中創建的資源組名字。
PS C:\> .\single-lamp-deploy.ps1 -ResourceGroupName rg1 -CentOSVersion 7.0 -AdminUserName azureuser -AdminPassword “YOUR-PASSWORD” -MySqlPassword “YOUR-MYSQL-PASSWORD” -DNSNamePrefix “YOUR-DNS-PREFIX”
創建程序大概需要 20 分鐘,運行成功后會出現如下提示, 這里我們直接去到下面訪問網站的步驟去進行驗證。
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 finally it will return the result on the web page.
If you refresh the webpage, will insert another record into mysql db table.
We strongly recommend you to 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 -p
drop database testdb;
更多的搭建方式,可以通過這里繼續閱讀。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/60108.html
標籤:虛擬化
上一篇:咨詢一個服務器搭建的問題
下一篇:VXLAN網路
