Magento2 Installation – Getting Started

In this blog we are going to study simple steps of installing magento2 and the various options we have for installation.

Getting Started

There are different ways to install magento2, we are discussing a basic one here.
This post is recommended and useful for beginners and advanced users, on which we will only learn the most simplest way of installation.
You can chose two different methods
1. Installation with SSH/Terminal Access
2. Installation on shared hosting (without terminal access)
Because magento2 has an rich set of commands in its new command line interface magento2 is recommend to have a terminal access.

Installation with SSH

To install magento2 there are 2 repository’s which you can use
1. https://github.com/magento/magento2
2. https://github.com/magento/magento2-community-edition
For advanced developers the first repository is recommended, if you are looking for module development etc.
But if you just need to work with admin features etc the second repository is much recommended.
Let's see how to install magento2 via terminal

Setting up git and composer – Step1

For your magento installation create a new directory or go to your apache root directory
Run below command in your directory
This will clone the git repository. Just create a new file auth.json in root directory with content because after this is complete, you need to setup auth.json in your root folder
like this
1
2
3
4
5
6
7
8
{
   "http-basic": {
      "repo.magento.com": {
         "username": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
         "password": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
      }
   }
}
For the secure keys section in your magento connect account you can get the value of username/password.
Run the command once you have done with auth.json this
1
composer install
If you have not installed composer before, install it using the guide here
Once the above process is done, all the relevant module will install by composer that are required for magento2. At this step you have all the required files to start magento2 installation.
You need to php version 5.6+ for magento2. To update php on ubuntu follow this link
Error logs you might face
Problem 1
– The requested PHP extension ext-intl * is missing from your system. Install or enable PHP’s intl extension.
Problem 2
– The requested PHP extension ext-xsl * is missing from your system. Install or enable PHP’s xsl extension.
Do the following
sudo apt-get install php5-intl
sudo apt-get install php5-xsl
sudo service apache2 restart

Step2 – Permissions

Now you can configure the permissions for different folder in magento2 it also has a auto-generation system in which it generates files for performance. So setting folder permissions is compulsory otherwise you might get many errors.
1
2
3
4
sudo chmod -R 777 var/
sudo chmod -R 777 pub/static
sudo chmod -R 777 pub/media
sudo chmod -R 777 app/etc
All folders must owned by apache user.  You need to confirm although this is mostly the case by default. You can also set to particular user/group using
1
sudo chown -R {user}:{group} *
make sure to use user and group with correct values.

Step3 – Setup Wizard

Open the url http:////setup
This should start the magento installation wizard, proceed with the steps to complete the installation.
There is also another method to install magento via command line but better is setup wizard.

1. You might get this error during installation
Your PHP Version is 5.6.20-1+deb.sury.org~trusty+1, but always_populate_raw_post_data = 0. $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0. This will stop the installer from running. Please open your php.ini file and set always_populate_raw_post_data to -1. If you need more help please call your hosting provider.
Open the php.ini to fix this (typicall located at /etc/php5/apache2/php.ini) you can find this by looking at php_info() output.
Find the line
 always_populate_raw_post_data = 0
and edit it to
 always_populate_raw_post_data = -1
 You must restart apache server (typicall sudo service apache2 restart) to fix this issue
2. You might get an error to upgrade mysql version 5.6
To install via command line run this
1
2
3
4
5
php bin/magento setup:install --base-url=http://<your-domain->/<magento_dir>/ \
--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/Chicago --use-rewrites=1
fill in the correct values for database etc

Installation on shared hosting


Directly download latest magento version from https://magento.com/developers/magento2 If you have a shared hosting and no command line.
Upload the file to your server through ftp and then unzip it there.
Follow same process from step2 as mentioned above

Comments

Popular posts from this blog

Best Ecommerce Wordpress Flatsome Theme and UX Builder