Hire Me
Magento 2.x Installation Guide

Magento 2.x Installation Guide

Magento is one of the most powerful eCommerce based CMS available in market. Well, maintaining its awesomeness, the Magento officials has released Magento 2.x (e.g. 2.0, 2.0.1, 2.4.3 etc.). The beginners may face some issue while installing Magento2. So, here is the prefect guide to help them out.

The latest stable version of Magento is 2.4.x (as of the day, the article is published), so the installation process would be shown for the same version. This would work in the previous versions of Magento as well.

Before you begin, you need to setup a host with Magento system requirements. as mentioned in the following section.

System Requirements

Web ServerApache 2.x / nginx 1.8 (or the latest mainline version)
ElasticsearchVersion 7.x
ComposerVersion 2.x
PHPVersion 7.4
MySQLVersion 8.x

The above ones are the essential system requirements of Magento 2.4.x, but you might need some other software too. To know more, click here.

One You are done with the host setup, you would need to go perform two tasks in order to Install Magento 2.4.x:

  1. Getting the metapackage
  2. Installation

Getting the Metapackage

There are multiple ways to create a Magento 2 project. You can find more details here. We will look into the 2 easiest methods .i.e.

  1. Using Composer
  2. Using FTP

Now let’s see these methods one by one.

1. Using Composer

  1. Log into your host as file system owner
  2. Change the directory to to the docroot of the virtual host of your configured server (e.g. /var/www/html)
  3. Now, you need to create a composer project using the Magento Open Source or Adobe Commerce metapackage.

Magento Open Source

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>

With Specific Version

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.1 <install-directory-name>

Adobe Commerce

composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition <install-directory-name>

With Specific Version

composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.1 <install-directory-name>

When prompted, enter your Magento authentication keys. Public and private keys are created and configured in your Commerce Marketplace.

2. Using FTP

  1. To install Magento2 via FTP, download the compressed setup file from https://magento.com/tech-resources/download
  2. Upload the file to apache server’s root directory or any desired directory inside it.

Installation

1. Set file/folder permissions

cd <magento install directory>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data .
chmod u+x bin/magento

2. For Magento version 2.4.x, command line is to be used to install. You need to run following command to Install it:

bin/magento setup:install \
--base-url=http://mystore.com \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--admin-firstname=admin \
--admin-lastname=admin \
[email protected] \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1

Here, you will need to change the values for these options, base-url, db-host, db-name, db-user and db-password. You can change the values for other options as well as per your requirement. Its highly recommended to use a strong admin-password. Wait till the installation is completed.

Note: You may customize the Admin URI using the –backend-frontname option. But, its recommended to skip this option and allow the installation command to automatically generate a random URI. A random URI is harder for hackers or malicious software to exploit. The URI displays in your console when installation is complete.

If you are a developer, then you need to do some more changes. To know about these stuffs, click here.

Leave a Reply

Your email address will not be published. Required fields are marked *