While getting started with Magento some time ago, I thought it would be a good idea to write a post that started at the beginning: how to install it. Reading through the Magento forums, I get the impression that Magento users have extremely varied levels of web development and systems administration experience. That raises the question of the amount of detail to include in a post aimed at Magento newcomers, since experienced web developers will need only the important steps, whilst those new to web development will prefer more info. Here's our take on an install guide that will hopefully prove useful for both audiences.

In order to broaden the appeal of this article I have used JavaScript to make things more readable. Below are all the steps necessary to install Magento, and if you are unsure about any of the steps, just click for more details.

Installing Magento is similar to installing Drupal or Wordpress. Before we can install Magento we need to configure the environment in which it will run. In this case we'll use Ubuntu as the operating system in our examples, though the instructions are fairly similar for other Linux distributions. You will need sudo access in order to complete the steps below.

  1. Configure Ubuntu

    1. Install php5 including the following modules:
      • mhash
      • cli
      • mcrypt
      • curl
      • mysql
      • gd
    2. Install mysql
    3. Create a database for Magento
    4. Increase memory limit in /etc/php5/apache2/php.ini to 64MB
    5. Increase memory limit in /etc/php5/cli/php.ini to 64MB
    6. Enable server rewrites
  2. Download Magento

    1. Follow this link to the download page
    2. Download the Full Release in your favourite format. If you are not sure which format to choose download zip.
    3. Uncompress the file
    4. Move the Magento directory to your web accessible directory
    5. Make magento/app/etc, magento/var/ and magento/media world-writable
  3. Install sample data for Magento

    (Optional - click here for details)

  4. Install Magento

    1. To install Magento load it in the browser by typing magento after server's base url.
    2. On the first page that loads accept the license agreement and click 'Continue'
    3. Enter locale information
    4. Enter database information
    5. Enter personal information
    6. Magento Installation Complete!
  5. Install extensions

    (Optional - click here for details)

  6. Keep Magento up-to-date

    Warning! Please don't perform an upgrade on your live site, you should always test the upgrade process on a copy of your live site first. Also keep backups of both the database and magento directory just in case.

    1. Run ./pear mage-setup in Magento directory (if you haven't done so in the 'Install extensions' step)
    2. Run ./pear upgrade magento-core/Mage_All_Latest in your Magento directory
    3. Clear session and cache data

I hope your installation was successful. Have fun using Magento!

Comments

Hi, nice article :)
one comment, could you add a dot after ./pear mage-setup ?

./pear mage-setup .

Hi Unirgy - using the trailing "." will also work but we've found the command to work with or without it, so we usually leave it out for the sake of simplicity. We haven't seen any problems from doing it this way but if you've run into some please let us know!

I get an the following error when I try to install extensions or do mage-setup:

./pear line 91: exec:php: not found

Any ideas of what might be going wrong?

Well it appears that the php executable cannot be found. My suggestion is to make sure that the php command line package (php5-cli) is actually installed, since it is not installed by default. If it is installed, I would also suggest double checking that the executable paths are set correctly.

Hi,

I couldn't find the file: /etc/php5/cli/php.ini the directory doesn't exist.
Second, when i get to a browser, I typed in http://127.0.0.1/magento, and it tries to download the page instead of executing it. I followed your instructions to the letter.

Any ideas?

Hello,

I still have the rewrite issue. I have to type in http://127.0.0.1/magento/index.php in order to install.
After I check that rewrite is selected, I still have to type http://127.0.0.1/magento/index.php/admin.
If not, my web browser asks me where to download the file.

After extensive research, you should add these following instructions. If people are using this as a development should comment out the following lines from app/code/core/Mage/Core/Model/Session/Abstract/Varien.php

session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);

to

session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath() // don't forget to put back the comma "," when uncommenting the lines below
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

thanks for writting this installation guide, i've been breaking my head for weeks...

I keep getting a write permissions error on the Magento folder, but can't figure out how to get around that. I've set all the permissions with the entire Magento folder to be able to read and write. Any ideas?

Error: Please check for sufficient write file permissions

Your Magento folder does not have sufficient write permissions, which this web based downloader requires.

It might be necessary to make the Magento directory itself world writeable. You need to go the the directory that contains Magento, and change the permissions on the Magento root directory itself.

If you installed Magento via any other method than the downloader, then when you come to use Magento Connect, you will find that you are unable to due to permissions. For Magento Connect to work, all folders must have 777 permissions.

If you have SSH access to your server, you can fix this by running the following command:

find ./ –type d –exec chmod 777 {} \;

If you don't have SSH access you could try a php based SSH emulator instead.

The other option is to use Filezilla 3 to recursively chmod the files for you. This can take a little while to run, but at least you don't have to do it manually!