Step 1. Configure Apache and PHP
Before you download and install Magento, you need to configure your local server to work with the CMS Magento.
Firstly, we need to create configuration file for a virtual host in the /etc/apache2/sites-available/ folder. The configuration file has *.conf filename extension. In this tutorial we will name it as magentotest.com.conf . You can name it as you please.
Execute this command in the terminal:
sudo nano /etc/apache2/sites-available/magentotest.com.conf
For the virtual host to work, we need to add several directives in this config file. Type these directives, save and close the file. If you use your hostname, make sure you make changes to all the directives.
<VirtualHost *:80> ServerAdmin admin@beprogrammer.com DocumentRoot /var/www/magentotest.com/public_html ServerName magentotest.com DirectoryIndex index.php ServerAlias www.magentotest.com ErrorLog /var/www/magentotest.com/logs/error_log CustomLog /var/www/magentotest.com/logs/access_log common <Directory /var/www/magentotest.com/public_html> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
Use the following command to enable a new site with Apache.
sudo a2ensite magentotest.com.conf
Create magentotest.com folder in the /var/www/ directory and then in this new folder create 2 folders: logs and public_html.
It remains to add the entry to the hosts file. To do this, use the following command:
sudo nano /etc/hosts
And then register new site name. Add this line in the end of file:
127.0.0.1 magentotest.com
Now restart Apache for the changes to take effect.
service apache2 reload
If everything went well, then at this point you already have a fully-prepared virtual host.
Secondly, you need to install PHP, if it was not installed, and configure it. Execute the following commands in the terminal:
sudo apt-get install php5 php5-mhash php5-mcrypt sudo apt-get install php5-curl php5-cli php5-mysql php5-gd sudo apt-get install php5-xsl sudo apt-get install php5-intl sudo php5enmod xsl sudo php5enmod mcrypt cd /etc/apache2/mods-enabled sudo ln -s ../mods-available/rewrite.load
You also need to install phpMyAdmin.
sudo apt-get install mysql-client mysql-server sudo apt-get install phpmyadmin
Enter: Apache2, Yes, password 3 times
sudo gedit /etc/apache2/apache2.conf
Append next text:
Include /etc/phpmyadmin/apache.conf ServerName localhost
Increase memory_limit to 2048M:
sudo gedit /etc/php5/apache2/php.ini
Restart Apache2.
sudo a2enmod rewrite sudo a2enmod headers sudo service apache2 restart
Check access to phpMyAdmin panel http://localhost/phpmyadmin/index.php
Step 2. Create a MySQL Database for Magento to use
Magento uses a MySQL database to store and manage data. At the previous step, the phpMyAdmin was installed. Now we need to create a database and a user to work with it. Open the terminal and log in to the root account.
mysql -u root -p
Enter the password after this command. If the log-in was successful, then you will get access to the database administrator console. First of all, you need to create a database. In our example, it will be called magentotest.
Execute this command in the command line:
create database magentotest;
To manage the database, you must create a user. In our example, username is 'magentotest_user' and password is 'password'. To do this, execute the following command:
create user magentotest_user@localhost identified by 'password';
The new user must have the rights to the created database. Grant him privileges with the following command:
grant all privileges on magentotest.* to magentotest_user@localhost identified by 'password';
Now flush privileges and exit from mysql command line.
flush privileges; exit
Step 3. Download and install sample data.
The next step is to download and install sample data. This is an optional step, but we strongly recommend installing sample data. To do this, go to the https://magento.com/tech-resources/download site and find the Sample Data - 1.x with version "1.9.2.4 and later". Download it.
Unpack the archive, for example, into home directory. After that, you need to import the data into the database. To do this, you must find the sql file into sample data folder and specify the full path to it in the import command.
mysql -u root -p magentotest < /home/username/magento-sample-data-1.9.2.4/magento_sample_data_for_1.9.2.4.sql
If the operation was successful, the data will be inserted in the database.
Now copy the sample data files to your site's folder.
Step 4. Download and set up Magento files
Finally, we are ready to install Magento. Go to the https://magento.com/tech-resources/download site, find the latest version of Magento.
Congratulations, now you got Magento on your local host!
Hope this tutorial was useful for you!
If you have any difficulties or questions concerning Magento installing, you could always contact Webinse team.
Enter a Comment