Ramblings on technology with a dash of social commentary
RSS icon Email icon Home icon
  • Installing Magento E-Commerce on CentOS

    Posted on May 21st, 2009 phpguru 3 comments

    This guide assumes you have a dedicated server or VPS running Cent OS, optionally with WHM and CPanel and have root access via SSH. We’ll be using WHM/CPanel to configure our install.

    If you’re running on DreamHost, this is a more specific tutorial. (Though I recommend Atjeu.)

    Important note: This may be obvious, but I wouldn’t recommend doing this during an important, high-traffic time or on a production server. Make sure you have a backup of all sites hosted on your box before doing this! If you break something — don’t blame me!

    Okay, get ready to install Magento, the ECommerce Platform for Growth!

    Before you begin

    (a) Check to make sure you Web server has PHP 5.x, MySQL 5.x and PEAR. 

    If you aren’t sure what versions of Apache, PHP and MySQL you have on your server, it’s a good thing to know and easy to find out. Just make a PHP file, e.g. info.php, put the following code inside it and upload it to your web server into the public_html directory of the account under which you intend to install magento:

    <?php
    phpinfo();
    ?>

    Browse to this phpinfo file you just uploaded, e.g. http://yoursite.com/info.php, and look at the software versions of PHP and such.

    Most modern WHM/CPanel hosting setups already have these items ready to go. In my case, I wanted to install Magento on a custom-configured server, and I had PHP 5.x and MySQL 5.x but I had to install PEAR.

    (b) Install PEAR (if you already have PEAR installed on your server, this would be a good time to update PEAR.)

    I checked on this page at PEAR, and even though I was running CentOS, the most appropriate example for me to install PEAR was the Mac OS X example. Typing

    #> curl http://pear.php.net/go-pear | php

    In a command prompt via SSH Worked perfectly for me.

    At the screen where it shows you the suggested file layout…

    installing-magento-18

    I entered 1, and used /pear as my $prefix.

    After the installation completed, I typed pear help and my output looked very similar to this:

    installing-magento-19

    (c) Update your web server software.

    If you need to upgrade any of your web server software (recommended before proceeding!) login to your server via SSH and run /scripts/easyapache as described here.

    Installing Magento

    (1) Download the Magento installer

    I skipped the registration by clicking the No thanks link, but I recommend signing up for access to the Magento Community.

    The easiest and fastest way is to use the Downloader. The Downloader install is a small PHP application that you download and run in your browser. The Magento Downloader requires you have created a database, uploaded the sample data, and permissions of 0777.

    Keep this window open and proceed to step 2.

    (2) Download the Sample Data.

    The Sample Data is required for the installer to work correctly. You’ll need this at step 5.

    (3) Uncompress the installer archives.

    You should now have two folders, one containing the Magento Downloader installer, and the other containing the Magento Sample Database. 

    (4) Create your online store database.

    The easiest way to do this is by logging into CPanel for the account. By default, this is at http://yoursite.com/cpanel

    installing-magento-11

     - i. Create the database. If your CPanel account username is ‘foo’ and you type ‘magento’ into this box, by default your website database name will be ‘foo_magento’. 

     

     

    installing-magento-12

    - ii. Create a database user. If your CPanel account username is  ‘foo’ and you type ‘storusr’ into this box, your DB username will be ‘foo_storusr’. (The password does NOT get pre-pended with the account name.)

     

     

    installing-magento-14- iii. Give the db user ALL privileges on the db. You can tighten up the security later, but for the installer to work, it needs to be able to do everything.

    (5) Install the sample database.

    Find the Magento SQL file that generates the Sample store database. In my case, this file was found in the ‘magento-sample-data-1.2.0′ folder, named ‘magento_sample_data_for_1.2.0.sql’.

    To do this, click to the phpMyAdmin interface from CPanel, click to the database name on the left column (nothing in it yet) and then to the Import tab over to the right. Click browse. Locate the SQL file, select it, then click GO.

    After several moments and approximately 1,400 SQL statements later, you should have about 233 tables in your database.

    (6) Set up a folder with the proper permissions where you want to install Magento.

    In my case, I chose the root level of the site, but it is probably advantageous to use a folder or subdomain, ‘shop’, for example. Next, access the filemanager, select the ‘shop’ folder you created, and click ‘Change Permissions’, giving the folder 0777 or all permissions. Again, this is just so the installer can do its thing. The permissions can be set back to their defaults after the installer is done. 

    (7) Using an FTP program, upload the contents of the Downloader to the ‘shop’ folder.

    When that’s done, you can finally run the Magento Downloader Installer web app.

    (8 ) Start the Magento Downloader install

    This is as simple as going to http://yoursite.com/shop/downloader in your browser and following the prompts as shown in the series of images below. 

    In step 1, the Magento Downloader connects to the MagentoECommerce website to download the latest install files.

    installing-magento-05

    Step 2 requires you to agree to the licensing terms.

    installing-magento-06

    Step 3 requests that you select your default localization, or language settings.

    installing-magento-07

    In step 4, you tell Magento how to connect to the database you created in part 4 above.

    installing-magento-08

    Step 5 is where you set up your Magento store admin username and password.

    installing-magento-09

    And at last… 

    installing-magento-10

    You’re All Set!

    Get ready to experience Open-Source eCommerce Evolved.

    Before you continue to your store, please make a note of your encryption key (Magento uses it to encrypt passwords, credit cards and more).

    (9) Check to make sure the front end works.

    You should see the demo store. Click around and check it out.

    (10) Login to the backend and check to see that works. 

    Write down the password you used for admin!

    Where to go next

    After poking around the Magento Admin you’ll see there’s a lot of things to learn. Most of the features are very self-explanatory, such as categories, subcategories and products, but other features, such as groups, permissions, roles, and most importantly, how to design and set up your store to look different from the demo, will require spending some time reading the Magento Design Guide and the  Magento User Guide.
    Good Luck! You’ve made a great choice for your online store.
     

    3 responses to “Installing Magento E-Commerce on CentOS” RSS icon


    Leave a reply