Magento 2.4.x installation and setup takes approximately 5 to 10 minutes to complete. However, this does not include the time required to configure your web server and install supporting extensions that Magento requires. Overall, the time required to install Magento from scratch is approximately 90 to 120 minutes.
Let’s take a closer look at the steps involved in installing Magento from scratch to get a realistic understanding of the total time required to install Magento.
Step 1: Initial server setup
Some providers have offers tailored specifically to Magento 2. If you have such an option — go for it, as in this case the server is already configured for you. Further we assume that you’re using a VPS on DigitalOcean or AWS: you will start with a clean server that only has an Unix operating system like Ubuntu installed on it.
Before you begin installing Magento or its associated components, you would perform an initial server setup like:
- Creating a superuser and a dedicated Magento filesystem user to perform tasks on the server.
- Configuring a basic firewall using UFW or iptables.
- Securing SSH and disabling root access for security purposes.
Time required: 5–7 minutes.
Step 2: Install and configure the webserver
To serve web pages to your site visitors, you must install a webserver application to handle web traffic. Magento supports both Apache and Nginx, so you could install whichever you’re more comfortable using or both if you like.
Apache is more user-friendly, while Nginx offers slightly better performance and will help with SSL termination if you install and configure Varnish-->Varnish for full-page caching.
This step involves installing the webserver application, updating the firewall, verifying it works, and setting up a virtual host for Magento.
Time required: 5–7 minutes.
Step 3: Install and configure MySQL
Magento requires a MySQL database to store important information containing customer, catalog, and sales-related data. To that end, you can choose to install MySQL 8.0 or MariaDB 10.4 for Magento Commerce Cloud projects as your database management system.
This step involves installing and securing your MySQL application and creating a database and user for your Magento store.
Time required: 3–5 minutes.
Step 4: Install and configure PHP 7.4
As a PHP-based application, you must install and configure PHP to use Magento. If you’re using Nginx, you will also install PHP-FPM, which acts as the liaison between the web server and the PHP interpreter.
This step involves installing PHP, its extensions, and configuring it for use with Magento by updating the php.ini configuration file.
Time required: 5–7 minutes.
Step 5: Download and install Composer
Magento uses Composer to manage its components and dependencies. Installing Composer and using it to install Magento will help you avoid extension conflicts and use Magento in a production environment.
This step only involves downloading and installing Сomposer. Additional configuration of Сomposer is not required at this point.
Time required: 2–3 minutes.
Step 6: Install Elasticsearch
Since version 2.4, Magento stores no longer support MySQL as the search engine and must be configured to use Elasticsearch instead. Elasticsearch is an advanced search engine that supports multiple languages, supports stop words and synonyms, and is extremely scalable.
This step involves installing the Java software development kit, downloading, installing Elasticsearch, and updating firewall rules.
Time required: 10–12 minutes.
Step 7: Download and install Magento using Composer
Downloading Magento with Composer allows using the software to its fullest capabilities.
This step involves fetching the Magento metapackage via Composer, setting pre-install file permissions, and running the Magento install script.
Time required: 10–15 minutes.
Step 8: (Optional) Install and configure Varnish for FPC
Although an optional step, as Magento is built to use Varnish for full-page caching, installing and configuring Varnish helps maximize the performance benefits of using Magento. Varnish is a powerful HTTP accelerator that caches and serves static content at lightning speeds.
This step involves downloading and installing Varnish, configuring Magento to use Varnish, and configuring Nginx to terminate SSL and work with Varnish.
Time required: 10–15 minutes.
Step 9: (Optional) Install and configure Redis for sessions caching
Redis is a powerful in-memory data store that helps reduce latency and take the load off your database and filesystem when it comes to storing session cache files.
This step involves downloading, installing, securing, and configuring Redis to work with Magento for session caching.
Time required: 8–10 minutes.
All things considered, the total time required to install Magento from scratch is approximately an hour and a half to two hours, depending on your experience performing the tasks listed above.