How to deploy Magento on Windows Azure

Magento is a popular open-source e-commerce platform that provides front-end functionality for managing online stores and promotions as well as back-end functionality for handling transactions and integrating with other payment and shipping systems. For more information about Magento, see the Magento web site.

In this tutorial you'll learn how to deploy Magento on a Windows Azure virtual machine running the Ubuntu operating system.


To provision a virtual machine on Windows Azure, you must have an active Windows Azure subscription. If you don't have a subscription, you can sign up for a free 90-day trial at

Create a virtual machine

The first step in deploying Magento is to provision a virtual machine running Linux. In the screenshots that follow you'll see that Ubuntu is used for this example; you could also use other Linux options available on Windows Azure, such as CentOS or openSUSE.

For more information about how to create and provision a Linux virtual machine on Windows Azure, see the Azure Manage Center article Create a Virtual Machine Running Linux.

After your virtual machine is running, create the following two endpoints:

  • HTTP - port 80
  • HTTPS - port 443

For information about how to create endpoints on a virtual machine, see How to Set Up Communication with a Virtual Machine.

After the endpoints are set up, you'll need to sign in to the virtual machine via SSH so that you can run commands at the shell prompt. You can get the necessary connection information from the Windows Azure Management Portal or through the azure vm show command as shown here.


If you're working on a computer running Windows, you can use PuTTY or other software to connect to your virtual machine. On Linux operating systems, OpenSSH is a popular application for connecting via SSH. For information about how to connect to a Windows Azure virtual machine, see How to Log on to a Virtual Machine Running Linux.

Set up the server for Magento

From your shell prompt on the virtual machine, run the following commands.

sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install php5-mysql
sudo apt-get install php5-curl php5-mcrypt php5-gd php5-common
sudo apt-get install mysql-client mysql-server

Note: You may get errors because SSL is not installed. SSL is not enabled by default, and it is not needed for this tutorial, so you can ignore SSL errors if they occur. In the final step, you are prompted to create a password for the MySQL root user.


Install the Magento software

While still connected via SSH, use these commands to download and install the software.

cd /var/www
sudo wget
sudo tar -zxvf magento-
sudo mv magento/* magento/.htaccess .
sudo chmod -R o+w media var
sudo chmod o+w app/etc

After the software is installed, you can create the necessary database and user in MySQL. Run MySQL with the mysql -u root -p command, and then follow these steps:

  1. type the root password when prompted
  2. mysql> create database magento;
  3. mysql> Create user magentouser identified by 'password';
  4. mysql> Grant select insert, create, alter, update, delete, lock tables on magento.* to magentouser
  5. mysql> exit

Then enter these commands to complete the installation.

sudo /etc/init.d/apache2 restart
sudo rm index.html

Configure Magento

After setup is completed, open a browser client and navigate to the server. Follow the on-screen instructions to configure Magento.




Create the admin account. Note that an encrytion key is not required; it is generated for you if you do not provide it.


Note your encryption key.


The Magento dashboard

After completing the previous steps, you're now ready to start using Magento. The Magento dashboard provides a high-level view of your Magento configuration and activity.


For more information about use of the dashboard, see the Magento Knowledgebase.