Magento 18.104.22.168 Released – Installing and Configuring on Debian/Ubuntu
Magento is a free, open-source CMS for web-commerce websites, first launched in 2008 and later acquired by eBay, according to W3Techs, Magento is used by 1% in all websites world-wide on the Internet, which is why it is important for a Linux admin to know how to install it on Linux machine which we will be explaining in this article.
- Free and open-sourced.
- Built using PHP, Zend framework and MySQL database.
- Can easily be used to create online web-stores.
- Ability to install & change default website theme, without need to change the content.
- Ability to install & configure modules to add more functionality.
- 3 Available editions to use which are: Community Edition – Professional Edition – Enterprise Edition.
- Supported by a large community.
This article will guide you to install the most recent version of “Community Edition” of Magento on a system running:
- Ubuntu 10 or later, or Debian 6 & 7
- Apache 2
- PHP 5.4 and required extensions
- MySQL database
Step 1: Install Apache, PHP and MySQL
1. Magento is a PHP script, that uses MySQL database, thats why we will need a running web-server and a MySQL database server with PHP Support, to install those things on Ubuntu/Debian, you will have to run the following command in the terminal.
Note: On Ubuntu/Debian, during mysql installation, it will prompt you to setup password for mysql user (i.e. root) by default.
$ sudo apt-get install apache2 php5 php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd mysql-client mysql-server
Note: Currently, PHP 5.3 is the latest and most stable available version from the default Ubuntu and Debian repository, and works with Magento Community Edition 1.8 and 1.9.
But, due to the new features and changes in the preceding version of CE (Community Edition), we recommend you to install or upgrade to PHP 5.4 on your systems.
Next, you need to increase PHP memory for Magento, to do this, open php.ini file.
$ sudo nano /etc/php5/apache2/php.ini
Seach for the line ‘memory_limit‘ in the file.
memory_limit = 128M
And change the value to 512.
memory_limit = 512M
Once all the required packages has been installed on the system/server successful, now move forward to create a new MySQL database for Magento installation.
Step 2: Create MySQL Database for Magento
2. This section instructs, how to create a new database and new user for Magento. Although a new magento database is recommended, but optionally you can also deploy into an existing database, it’s upto you.
To create a new database and a user, login to your database server using root account and password that you’ve created during mysql-server installation above.
$ mysql -u root -p
## Creating New User for Magento Database ## CREATE USER magento@localhost IDENTIFIED BY "your_password_here"; ## Create New Database ## create database magento; ## Grant Privileges to Database ## GRANT ALL ON magento.* TO magento@localhost; ## FLUSH privileges ## FLUSH PRIVILEGES; ## Exit ## exit
Step 3: Configure Apache for Magento
We are here, using Apache as a webserver and Magento needs URL rewriting, to do this, you need enable ‘mod_rewrite‘ module in apache configuration. Open and edit the default apache host file using nano editor.
$ sudo nano /etc/apache2/sites-available/default
Locate the following section.
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
Change the value of ‘AllowOverride None‘ to ‘AllowOverride All‘.
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
Save and close the file. Now, enable ‘mod_rewrite‘ module and restart Apache service.
$ a2enmod rewrite $ sudo service apache2 restart
Step 4: Download Magento Community Edition
3. As usual, we’ll download the latest version from the official website, at the time of writing this article, the latest version from the Community Edition is 22.214.171.124, which you can download using the following link, it is under the “Full Release” section, of course, you need to register first before downloading Magento.
After you download Magento you may extract the downloaded file, place its content in /var/www/html/magento/ using root permissions.
4. An alternative way to download Magento is by using SVN, first you have to install the subversion package using this command.
$ sudo apt-get install subversion
Now to download the latest version from Magento SVN, run this command.
$ svn checkout http://svn.magentocommerce.com/source/branches/1.9
It will take sometime depending on your download speed, it will download Magento to the “1.9” folder in your home directory, to copy the content of “1.9” folder to /var/www/html/magento you will have to run.
$ sudo mkdir -p /var/www/html/magento $ sudo cp -R 1.9/* /var/www/html/magento/
5. Now open your browser and navigate to the following urls, you will be presented with the Magento installation wizard.
Step 5: Install Magento CMS
6. This will be the first step you see in the installation process of Magento, Accept the license agreement and click “Continue”.
7. Now choose the locale, timezone and the currency you want and click on “Continue”.
8. In the “Configuration” step, you will face some permissions error on the some of configuration files.
9. To, fix these errors, you need to set correct writable permissions on these files as shown below.
$ sudo chmod -R 777 /var/www/html/magento/media/ $ sudo chmod -R 777 /var/www/html/magento/app/etc
10. Refresh the page and you will be able to continue to the next step.
11. Replace localhost with your hostname (if it was different). Enter “magento” in the database field which you created above, then enter the username and password. Change the other settings on your needs.
12. Click on the “Continue” button to go to the next step. Enter your first name, last name..etc in the requested fields and continue.
13. You may answer the survey if you want or you may just skip it.. scroll down and take a copy from your encryption key and store it in a safe place, you may need it later.
That’s it, Magento installation completes.
Step 6: Magento Configuration
Magento is a very configurable CMS, the problem is that it isn’t easy, it is not like configuring WordPress or Drupal themes & modules, thats why we won’t talk a lot in this section here, however you may download Magento official user guide which will explain how to configure Magento from Bennington to advance for you.
Have you ever tried Magento before? What do you think about it in comparing with other web-commerce CMSs? Please share your feedback using our comment section.