The much speculated beta version of the Magento 2 has been finally released a few days ago. Setting Up Magento is really easy. Now, developers can experience the advanced offerings of this latest open-source web development tool and contribute to the platform with resourceful themes, extensions and more. However, for this you will need to successfully establish the Magento 2 on your systems.
This article will provide you a definitive guide that will help you set up the latest Content Management System (Magento 2) conveniently via composers.
Before beginning the installation process, here is a list of prerequisites.
- A Linux distribution
- Apache 2.2, 2.4 with active Apache module “mod_rewitre”.
- PHP version 5.4.11 and 5.5.x
- The latest version of the Composer – It can be downloaded by using the below mentioned command.
curl -sS https://getcomposer.org/installer | php
However, to make the composer globally active, you may use the following command.
mv composer.phar /usr/local/bin/composer
- MySQL version 5.6.x
- Supports Simple Mail Transfer Protocol (SMTP) and Mail Transfer Agent (MTA) server.
- Certain PHP extensions
After downloading all the requisite software versions, you can begin the installation process. Let’s get started with the step by step process.
1. Downloading Magento 2
The Magento 2 can be downloaded either via Composer, GitHub or source.
composer create-project magento/community-edition magento2 -s dev –prefer-dist
Here, the “–prefer-source” option will help Composer to determine all the requisite stuff.
git clone [email protected]:magento/magento2.git
With this command the entire repository is copied and pasted under the Magento2 directory. Now, in order to grab all the dependencies associated to Magento 2, you will need to call the Composer. And, this can be done efficiently with the following command line.
cd magento2 && composer install
The Magento2 project is sectioned into two parts including the magento2-community-edition and magento2. The magento2 holds the entire code base of Magento 2, while the magento2-community-edition features the compose.json file. This file is used for generating from source. However, a collection of the Magento modules can be simply created by generating a new project under the product-community-edition. And, this can be done by using the following command.
composer create-project magento/product-community-edition magento2 -s dev –prefer-source
2. Configure the permissions
Here, you will need to assign the appropriate permissions to the Magento 2 installation directory. Now what you have to do is, change the mode of all the directories to 700 and mode of all the files to 600.
This can be done with the command –
find . -type d -exec chmod 700 {} \; && find . -type f -exec chmod 600 {} \;
3. Create an empty database
By using the MySQL, you can generate an empty database as and when desired. Simply, run this command and get a desired database.
echo “CREATE DATABASE magento2” | mysql -u[mysqluser] -p
4. Let’s begin the Magento2 installation
To move further and install the Magento2, there are two ways to achieve it.
- Command Line Installer – The Magento comes complete with the command line installer. This installer can be invoked by running the set of below mentioned commands. Just, execute these commands via the root directory of the Magento 2.
php setup/index.php
–db_host=localhost \
–db_name=magento2 \
–db_user=root \
–db_pass=canbempty \
–backend_frontname=admin \
–admin_username=username \
–admin_password=password \
–admin_firstname=First \
–admin_lastname=Last \
–base_url=http://magento2.local/ \
–base_url_secure=http://magento2.local/ \
–language=en_US \
–currency=USD \
–use_rewrites=true \
–use_secure=false \
–use_secure_admin=false \
–cleanup_database
Upon its successful installation, you will get a message indicating the installation completion on the screen.
- Installation Wizard – Simply, access the web browser and follow the easy steps mentioned in the wizard. Go step by step, and get the Magento 2 installed.
With this you will get a fresh Magento 2 installation done on your system. However, this installation will come complete with an empty database. If you want to add something to your database, proceed to the next step.
5. Updating the database
To add something into the database of the Magento 2, you can choose either of the two ways.
- Via the performance toolkit – You can easily add the static entries in the database by implementing the performance toolkit’s generator. In the Magento 2, you will have four profiles, namely extra_large, large, medium, and small. All these profiles represent their corresponding xml files. For this, you can run the command –
php dev/tools/performance-toolkit/generate.php –profile dev/tools/performance-toolkit/profiles/small.xml
- Via Sample Data – The packages repository of the Magento 2 facilitates a great development tool which is known as Sample Data.
- To indicate the existence of the repository, first modify the composer.json file with the following command.
composer config repositories.magento composer http://packages.magento.com
- For including the magento/sample-data package and magento/sample-data-media package.
composer require magento/sample-data:0.42.0.beta1 magento/sample-data-media:0.42.0-beta1 –dev
- Now, in order to install all the dependencies run the below mentioned command.
php dev/tools/Magento/Tools/SampleData/install.php –admin_username=username
By following this definitive guide thoroughly, you can conveniently get the Magneto 2 installed on your system. Set up the beta version of the latest eCommerce platform and reap the benefits of this popular platform.
Author Bio: Jason Roiz is a web developer by profession and a writer by hobby and works for OSSMedia, a Magento development company. He loves sharing information regarding Magento development tips & tricks. If you are looking forward to hire Magento developers then just get in touch with him.