How to Install Magento 2 – Beginner’s Guide

TOP Magento Web Hosting Providers
NOW -79%

1. Hostinger

Number of Reviews rating circle 24.8k+
Avg. Review Rating rating circle 4.6 Positive
Customer Support rating circle Positive
Starts from $2.99 / mo.
Server Locations
Server Location in LithuaniaServer Location in SingaporeServer Location in NetherlandsServer Location in United States Of AmericaServer Location in BrazilServer Location in United KingdomServer Location in IndiaServer Location in FranceServer Location in Indonesia
Flash Sale

2. DreamHost

Number of Reviews rating circle 5.9k+
Avg. Review Rating rating circle 4.6 Positive
Customer Support rating circle Positive
Starts from $2.59 / mo.
Server Locations
Server Location in United States Of America

3. IONOS | ionos.com

Number of Reviews rating circle 20.7k+
Avg. Review Rating rating circle 4.1 Positive
Customer Support rating circle Neutral
Starts from $1.00 / mo.
Server Locations
Server Location in United States Of AmericaServer Location in United KingdomServer Location in NetherlandsServer Location in FranceServer Location in GermanyServer Location in IndiaServer Location in IndonesiaServer Location in RussiaServer Location in IrelandServer Location in South Africa

When it comes to building a website, there are a lot of different options you can choose from. Whether you will choose a CMS platform or an AI builder, you will succeed in building your website. In today’s article, we have prepared a tutorial on how to install Magento 2 platform, and Howtohosting.guide will guide you through the whole installation process.

install magento image

What is Magento 2?

Magento 2 is an advanced eCommerce platform that uses open-source technology to build websites. The platform is not like the other CMS platforms because it focuses on creating e-commerce sites and online stores. It provides flexible features like an advanced shopping cart and full customization.

The platform offers options to upload themes and plugins. Also, it provides powerful marketing and SEO optimization and is made for the knowledgable audience but with no advanced programming knowledge, and you can easily customize up to a point. But if you need to change some parts of the platform, it needs to be done by a Magento expert.

What’s New in Magento 2?

With the newest version released – v2.4 on 27 July 2020, the platfom has further improvements.

New Improvements and Upgrades

Support for PHP 7.4, PHPUnit 9.x
Support for Elasticsearch 7.x and MySQL 8.0
Removed MySQL search engine
Support for MariaDB 10.4
The Zend Framework has been deprecated and migration to the Laminas project.
Removed the support for Signifyd fraud protection code
Core Braintree module removed

Magento Features
Magento is the world’s most flexible eCommerce building platform.

– Gives you reliability with 99.99% Uptime.
– Customization with the option of integrating hundreds of extensions and plugins.
– Knowledgable expert 24/7 support with 315,000 developers and partners on the line
– 5 months money-back guarantiue
– Page Builder (the drag & drop gives you full control over your website. It will help you customize faster, and create fresh and rich content)

How to Install Magento 2?

To install the platform you need to do it by using an FTP database to transfer its archives. We are going to use an FTP server called Apache and set up Magento in 7 steps.

Install Magento by Using Apache in 7 Steps

Step #1: Install Apache Server and PHP

To set up the platform we are going to use one of the most popular HTTP Server now – Apache. Apache is free and open-source cross-platform web server software and is supported by all the operating systems.

To install Apache, you should update packages before running install Apache install command:

sudo apt update
sudo apt install apache2

To run Apache automatically, run the following command:

sudo systemctl enable apache2.service

The next step form the Apache installation is to:

Configure Apache2 Virtual Host

To affirm Apache2 site configuration for Magento store, you need to create a new configuration file called “magento2.conf”

sudo nano /etc/apache2/sites-available/magento2.conf

Get the following content and paste it to the above file. Have in mind that you can change domain.com to your domain.

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/magento2/
ServerName domain.com
ServerAlias www.domain.com


<Directory /var/www/html/magento2/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>


ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

If you are installing the CMS locally, you can change domain.com to localhost.com, dev.com or m2.com. Next you have to update hosts file at /etc/hosts with this:

127.0.0.1 localhost.com
127.0.0.1 dev.com
127.0.0.1 m2.com

In this tutorial, we use localhost.com.

Make sure you have enabled “rewrite mod” to use site-friendly URLs. To make it enter this code:

sudo a2ensite magento2.conf
sudo a2enmod rewrite

Next, you need to

Install PHP 7.2 and Extensions

On Ubuntu 18.04, you can install PHP 7.2 with the following command line:

sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gmp php7.2-curl php7.2-soap php7.2-bcmath php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mcrypt php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip

After installing PHP you need to update it by using this code:

Open php.ini file sudo nano /etc/php/7.2/apache2/php.ini

Change the data to this and save it.

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 512M
upload_max_filesize = 128M
max_execution_time = 3600

Now you need to restart Apache2 and run this command:

sudo systemctl restart apache2.service

Step #2: Install Database Server Manually

MariaDB Database Server to default MySQL Database Server is preferred, because of faster and better performance. To install MariaDB Server and Client, using the command line:

sudo apt-get install mariadb-server mariadb-client

Ensure it starts and startup every time you reboot the server:

sudo systemctl restart mariadb.service
sudo systemctl enable mariadb.service

After this you have the MariaDB server installed and now you need to set up the database by entering this line:

sudo mysql_secure_installation

It prompt and you choose the following option:

Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
New password: Type your password
Re-enter new password: Type your password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

Step #3: Create & Set Up MySQL User

This is a required step to go through. From Magento 2.3.x, it requires a unique user for the installation, it cannot default user: root.

To make it proper first you need to login MariaDB

sudo mysql -u root -p

Create a new database – CREATE DATABASE magento2 and then create a new name called: mageplaza

REATE USER ‘mageplaza’@’localhost’ IDENTIFIED BY ‘YOUR_PASSWORD’;

Grant mageplaza user to magento2 database:

GRANT ALL ON magento2.* TO ‘mageplaza’@’localhost’ IDENTIFIED BY ‘YOUR_PASSWORD’ WITH GRANT OPTION;

FLUSH PRIVILEGES;
EXIT;

Step #4: Install Composer

What Is Composer and How to Use It for Magento 2?

The CMS platform uses the composer, a PHP dependency manager, to package components and product editions.

Composer reads a composer.json file in Magento’s root directory to download third-party dependencies listed in the file.

After setting the server, you are ready to start the installation.

To start with the installation, you need to download the installer, which will set up your PATH environment variable so you can call the composer from any directory. You can download the file from here and also find more info about the process.

curl -sS https://getcomposer.org/installer | sudo php — –install-dir=/usr/local/bin –filename=composer

composer -v

Composer version 1.8.5 2019-04-09

Step #6: Download the Magento Pack

Download the Pack from here

After donwload, you should extract the pack to /var/www/html/. E.g you have a folder call: magento2 in /var/www/html/

Step #7: Install Magento 2

To start the Magneto installation you need access to the http://localhost.com/magento2, then you will see this window.

magento agree to install image

Click “Agree” and the “Start Readiness Check“. If everything is alright and there are no errors you need to click “next
Now you need to da Database, there you need to fill the Database information and press “next

The next step is the web configuration, you need to enter your store address http://localhost.com. Enter the relative URL by which to access the Admin. Then “next“.

Now you need to customize your store with general info like time zone, currency, language, and to set advanced modules like Google Analytics, Google Adwords, Google Optimizer, etc.

After setting all these stuff we are at the final steps, now you need to create an admin account.

Fill the following info:
New Username
New E-Mail
New Password
Confirm Password

Click “next“, and then “install“. After the installation is done, you ar ready to check the results and start customizing your site.

Extensions and Themes in the Module

Form the marketplace, you can load your website with different themes and flexible extensions which will help you customize your website. There are any-purpose themes available, and popular extensions like Facebook pixel, Multi-Vendor Marketplace, Google shopping, etc. Visit the marketplace here.

There are a few features categories with extensions for your website.

Customer Support
Paments & Security
Marketing
Accounting & Finance
Shipping & Fulfillment
Site Optimization

Command-line Configuration

The command-line interface performs both installation and configuration tasks. The new interface performs multiple tasks, including:

Installing the platform (creating or updating the database schema, creating the deployment configuration, etc).
Clearing the cache.
Managing indexes, including reindexing.
Creating translation dictionaries and translation packages.
Generating non-existent classes such as factories and interceptors for plug-ins, generating the dependency injection configuration for the object manager.
Deploying static view files.
Creating CSS from Less.

A single command (/bin/magento list) lists all available installation and configuration commands.
Consistent user interface based on Symfony.
The CLI is extensible so third party developers can “plug-in” to it. This has the additional benefit of eliminating users’ learning curve.
Commands for disabled modules do not display.

Magento Enterprise Edition

The enterprise edition is a premium paid version of the platform which offers more special features, premium customization options, and advanced 24/7 support. The enterprise edition is generally used from the bigger companies or online stores, which have the need for more advanced options. The main reason why the enterprise edition is mostly used by the bigger online stores is because of its price. It costs $15,550/year

HowtoHosting.guide Tips for Magento

Here you can find useful tips about Magento and how to use it properly and optimize your SEO. Even some of the tips are really easy to do and may sound unnecessary for many there are very important for the performance of your website and its SEO.

Tip #1 – Update to the Latest Version

To be up to date is very important because the latest updates always have improvements and enhancements. Also, the latest versions are the best SEO optimized. The platform itself always recommends being with the last version.

Tip #2 – Use Proper Keywords

This tip is essential not only for Magento websites, but it is very important for any other website. Using the proper keywords and researching for good ones for your site is a very significant moment for your website SEO success. If you are not sure how to do it properly Magento offers its own SEO tools, but you can also check some of the best ones here.

Tip #3 – Image Optimization

Image optimization even may sound that it is not that important, but it is. To optimize your images in the best way, describe what it is about in the best clear way and it is good to add your domain at the end of the image title, it is good for the domain rating of your website. To SEO the images add alt attributes(in this way Google will know what the image is about) and one more thing, compress the images and make them small, this will save your website space and will not slows down your site.

Tip #4 – Avoid Duplicate Content

An important tip is not to duplicate the content. The search engine bots take it as a bad point if they crow to duplicated content. If you have duplicated content you can solve the problem by telling Google that one of the contents you have is canonical to the other. To make this happen go to the SEO setting. Go to Store => Configuration => Catalog => Search Engine Optimization.

Tip #5 – Generate a Sitemap

The Sitemap is essential for your website because the Google crawlers follow the sitemap links and this helps them scan your site.
Manage create both XML and HTML sitemap. With Magento, you have an option both sitemaps at ease.

Magento Web Hosting FAQ

What Is Magento Web Hosting?

Magento web hosting refers to a hosting environment explicitly designed to accommodate the unique specifications of the Magento eCommerce platform. This tailored hosting approach ensures that online businesses powered by Magento can operate at peak efficiency, guaranteeing optimal speed, impenetrable security, and high-level scalability to handle surges in web traffic.

Why Do I Need Specialized Hosting for Magento?

Given Magento’s comprehensive and resource-demanding architecture, it becomes imperative to have a hosting environment that’s built to meet its rigorous standards. A specialized Magento hosting ensures that the server settings, configurations, and resources are in harmony with Magento’s requirements, paving the way for smooth operations, faster load times, and fortified security, essential for an online marketplace’s success.

Is Shared Hosting Suitable for Magento?

On the surface, shared hosting may seem like an economical choice for Magento stores. However, because multiple websites share the server resources in such an environment, it can often fall short of delivering the requisite performance metrics for larger Magento-based marketplaces. For businesses that aim for growth, dedicated, VPS, or cloud hosting are generally better suited, offering dedicated resources and enhanced configuration.

How Does SSD Hosting Benefit Magento?

Unlike traditional Hard Disk Drives (HDDs), Solid-State Drives (SSDs) don’t have moving parts and offer rapid data access speeds. Incorporating SSDs in a Magento hosting environment means that website content, especially dynamic content, loads at lightning speed. This not only provides a seamless shopping experience to end-users but also reduces the bounce rate and enhances overall user engagement.

Why Is Caching Important for Magento Hosting?

Caching, at its core, is a mechanism to store and retrieve frequently accessed data without burdening the primary data source repeatedly. In the context of Magento, implementing efficient caching strategies ensures that website pages render faster, system resources are optimally used, and users don’t have to wait long — a crucial factor in retaining potential customers and boosting sales.

How Does a Content Delivery Network (CDN) Benefit Magento Stores?

A Content Delivery Network is essentially a network of servers distributed globally. It functions by storing cached versions of your Magento store’s content in various locations. When a user from, say, Europe accesses your US-based store, the CDN serves content from a European server, drastically cutting down content delivery times. The result? Happier customers, reduced strain on your primary server, and potentially higher conversions.

Are Automatic Backups Essential for Magento?

In the dynamic world of online commerce, safety nets are crucial. Automatic backups serve as this very net, ensuring that if anything goes not according to plan — be it technical glitches, inadvertent human errors, or malicious cyber-attacks — your store’s data remains safe. With periodic automatic backups, you can restore your Magento store to its previous state, ensuring business continuity and safeguarding your reputation.

Do I Need SSL for My Magento Store?

SSL (Secure Socket Layer) isn’t just a recommendation for eCommerce platforms; it’s a necessity. By establishing an encrypted link between your web server and a visitor’s browser, SSL ensures that all data, especially sensitive information like credit card numbers, remains private. Beyond the security benefits, an SSL certificate also fosters trust among your clientele and can offer a slight edge in search engine rankings.

Can I Upgrade My Hosting Plan As My Store Grows?

Growth is the end goal for any business, and in the digital realm, growth often translates to more web traffic. Reputable hosting providers design their plans with scalability in mind, ensuring that as your Magento store expands its footprint, your hosting environment adapts in tandem. Whether it’s more storage, better processing power, or increased bandwidth, a scalable hosting solution will cater to your evolving requirements.

How Do I Choose the Right Magento Hosting Provider?

Choosing the right hosting provider is a decision that can shape the trajectory of your Magento store. While price is an essential factor, equally (if not more) important are aspects like guaranteed uptime (preferably 99.9% or more), stellar customer support, proven server speed and performance metrics, cutting-edge security provisions, and genuine reviews from fellow Magento store owners. Research, compare, and engage in trials if possible, to make an informed choice that aligns with your business aspirations. One recommended method to compare prices and features is to use the smart tool, called Hosting Finder by HTH. It will compare the latest Magento hosting plans and show you the best offers and discounts currently on the market.

Researched and created by:
Krum Popov
Passionate web entrepreneur, has been crafting web projects since 2007. In 2020, he founded HTH.Guide — a visionary platform dedicated to streamlining the search for the perfect web hosting solution. Read more...
Technically reviewed by:
Metodi Ivanov
Seasoned web development expert with 8+ years of experience, including specialized knowledge in hosting environments. His expertise guarantees that the content meets the highest standards in accuracy and aligns seamlessly with hosting technologies. Read more...

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.
I Agree
At HTH.Guide, we offer transparent web hosting reviews, ensuring independence from external influences. Our evaluations are unbiased as we apply strict and consistent standards to all reviews.
While we may earn affiliate commissions from some of the companies featured, these commissions do not compromise the integrity of our reviews or influence our rankings.
The affiliate earnings contribute to covering account acquisition, testing expenses, maintenance, and development of our website and internal systems.
Trust HTH.Guide for reliable hosting insights and sincerity.