How to install Wordpress server based on Azure Container Instances

From PUBLIC-WIKI
Jump to navigation Jump to search

How to install Azure CLI Tools

  • Login to the machine using privileged account.
  • Download the latest build of Azure CLI.
  • Windows download instruction and location:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest
  • Linux download instruction and location:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest

How to login to an Azure subscription

  • Login to an Azure account, from command prompt:
az login
  • Run the command below to list the available subscriptions:
az account list --output table
  • Run the command below to change the context to a specific Azure subscription:
az account set --subscription "MySubscription"
Note: Replace “MySubscription” with the relevant subscription name
  • Run the command below to verify the currently selected Azure subscription:
az account show

Installation phase

  • Run the command below to create a new resource group:
az group create --name MyResourceGroup --location MyLocation
Note 1: Replace MyResourceGroup with your own relevant group name
Note 2: Replace MyLocation with the target location, from the list below:
https://azure.microsoft.com/en-us/global-infrastructure/locations/
  • Run the command below (as a single line) to create a new MySQL database:
az mysql server create -g MyResourceGroup -n MyDBServerName --admin-user MyDBUserName --admin-password "MyDBPassword" -l MyLocation --ssl-enforcement Disabled --sku-name B_Gen5_1 --version 5.7
Note 1: Replace MyResourceGroup with the previously create resource group
Note 2: Replace MyDBServerName with your own MySQL server name
Note 3: Replace MyDBUserName with your own MySQL username
Note 4: Replace MyDBPassword with a complex password for the MySQL database account
Note 5: Replace MyLocation with the same region as the resource group
  • Run the command below (as a single line) to configure firewall rule for accessing the MySQL database:
az mysql server firewall-rule create -g MyResourceGroup --server MyDBServerName --name AllowAppService --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0
Note 1: Replace MyResourceGroup with the previously create resource group
Note 2: Replace MyDBServerName with your own MySQL server name
  • Run the command below to create a new database for the Wordpress application:
az mysql db create --resource-group MyResourceGroup --server-name MyDBServerName --name MyWordPressDBName
Note 1: Replace MyResourceGroup with the previously create resource group
Note 2: Replace MyDBServerName with your own MySQL server name
Note 3: Replace MyWordPressDBName with your own custom WordPress database name
  • Run the command below (as a single line) to create a Wordpress server using Azure Container instances:
az container create --name MyAzureContainerName --image wordpress --resource-group MyResourceGroup --ip-address public --port 80 443 --dns-name-label MyAzureContainerName
Note 1: Replace MyAzureContainerName with your own app service name
Note 2: Replace MyResourceGroup with the previously create resource group
  • Run the command below (as a single line) to show the Wordpress Azure Container instance DNS name:
az container show --resource-group MyResourceGroup –name MyAzureContainerName --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table
Note 1: Replace MyResourceGroup with the previously create resource group
Note 2: Replace MyAzureContainerName with your own app service name
  • Exit the command prompt
  • Login to the Azure portal:
https://portal.azure.com
  • From the left pane, click on Resource Groups -> select the newly created resource group -> from the main pane, click on Tags:
  • Name: Specify here “Project”
  • Value: Specify here a value to represent the project name
  • Click on Save
  • From the upper search bar of the Azure portal, write “Azure Database for MySQL servers” -> click to enter the properties of the newly created MySQL database -> From the main pane, click on “Tags”:
  • Name: Specify here “Project”
  • Value: Specify here a value to represent the project name
  • Click on Save
  • From the upper search bar of the Azure portal, write “Container instances” -> select the newly create Azure instance -> From the main pane, click on “Tags”:
  • Name: Specify here “Project”
  • Value: Specify here a value to represent the project name
  • Click on Save
  • Exit the Azure portal

WordPress initial configuration

  • Open a browser and specify the FQDN name of the Wordpress Azure container instance.
  • From the language selection page, select English and click Continue
  • Click on “Let’s go!”
  • From the Welcome wizard page:
  • Specify the web site title
  • Specify your own username
  • Write down the password and store it in a safe location
  • Specify an email address for notifications (prefer to use a mailing list)
  • Click Install WordPress