Learn Magento 2.4.6 Installation On Ubuntu 22.04

Updated 19 October 2023

In this blog, we’ll learn Magento 2.4.6 Installation On Ubuntu 22.04. You can follow more blogs for Magento 2.4 Installation on Windows and macOS.

Regardless of whether it’s B2B or B2C, an eCommerce platform is the backbone of an online enterprise. The best eCommerce platform also promotes the mechanism of the market interaction processes with clients, workers, and customers.

Therefore, you can’t survive online if you don’t have a strong e-commerce site. Thus, in widening and growing the market, the right e-commerce platform plays a very important role, like Magento.

What’s The Magento, Exactly?

Magento is an open-source eCommerce platform that provides online shoppers with a versatile shopping cart interface. Also provides control over their online store’s look, content, and usability of their online store.

Therefore, it facilitates effective marketing, optimization of search engines, and tools for catalog management.

Installation Requirements For Magento 2.4.6:

Operating systems (Linux x86-64)

  • Distributions of Linux, including RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, etc.

Memory requirement

  • Magento 2.4.6 requires 4 GB or higher RAM. 


  • Composer 2.2.x 

Web servers

  • Apache 2.4
  • Nginx 1.x


  • MySQL 8.0
  • MariaDB 10.6


Magento 2.4.0 supports PHP 7.4

Magento 2.4.6 supports PHP 8.1


  • Elasticsearch 7.17
  • Elasticsearch 2.x, 5.x, and 6.x are no longer supported by Magento

To get detailed information about system requirements, just visit the mentioned link: https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html

What We’re Going To Use:

  • OSUbuntu 22.04
  • SERVERApache 2
  • RAM4 GB
  • PHP: 8.1
  • MY SQL8.0
  • Composer: 2.2.x
  • Elasticsearch: 7.17

Magento 2.4.6 Installation

So let’s move to the installation part.

STEP 1: Log in to your Ubuntu Server

Log in to your Ubuntu Server by executing the command mentioned below:

STEP 2: Install Apache2, PHP , and its modules

Apache,  PHP, and its module are needed for the Magneto backend.  Use below mentioned commands to install the packages.

Check the version of PHP, then allow the PHP-module apache and the rewrite-apache module.

STEP 3: Install the Composer

STEP 4: SSH User creation

Presently, we were in our server’s root user, but due to security issues, we do not keep our application code in the directories of the root user. So, we have to create another SSH user for this.

Create an SSH user who will be the owner of the application code. I created an SSH user with the name “magento.” You can pick any name you want.

Eventually, this prompts a password window where you can set the password. Also, the remaining fields can be left empty by simply pressing the enter key. Additionally, after creating a user, we will switch to a new user.

STEP 5: Download Magento 2.4.6 by using the composer:

To install magento2 with composer, first, create the Access keys of Magento marketplace. If you have an account on Magento Marketplace, simply sign in and generate the access keys.

If you don’t have an account, create an account by registering yourself on marketplace.magento.com

To generate Access keys, log in to Magento marketplace, and from the top right corner of the page where your user name is displayed, navigate toMy profile > Marketplace > My products > Access Keys

After all, create a new pair of Access keys. You need to provide the public Key as a username and the Private Key as a password when prompted.

STEP 6: Apache configuration

However, to support the web pages we will configure Apache. So, we need to switch again to the root user for configuring Apache.

You will find the following lines as shown below, after executing the above command.

Besides that, change this to :

ServerAdmin webmaster@localhost
DocumentRoot /home/magento/magento2
ServerName localhost

We are using localhost but you can define your domain name

Save it, and exit after this.

Furthermore, configure the envvars file by executing the below command:

And find these lines :

Modify the Apache SSH username in this way :

export APACHE_RUN_USER=magento
export APACHE_RUN_GROUP=magento

And configure file apache2.conf by the following command:

Although, you will find the block code shown below:

Modify it to the following code:

<Directory /home/magento/magento2/>

Options FollowSymLinks

AllowOverride All

Require all granted


Save the file then exit it, and run the below command to check if any issues –

#apache2ctl -t

#systemctl restart apache2

Meanwhile, make some changes to the php.ini file

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

Save and exit, the php.ini file, and then run the command below:

STEP 7: Install MySql server

Install MYSQL Server for database creation by executing the following commands and when a password is asked after the below two commands, simply press ENTER

STEP 8: Install the Elastic Search

Similarly, Install the Elastic Search to move further

After the installation of Elasticsearch, define the memory for Elasticsearch

vim /etc/elasticsearch/jvm.options.d/custom.options

STEP 9: Install Magento 2.4.6

Likewise, execute the commands below to install Magento 2 by using the required variables such as host, database name, username, password, etc.

when this command is successfully executed, the output will be identical as seen in the image below:

STEP 10: Enable the rewrite module, give the permission and restart the apache2 service

The installation of Magento2 has been successfully completed, go to your browser and enter the IP address of your EC2 instance or domain name.

As a result, the homepage of your default eCommerce website will be like this:

STEP 11: Magento configuration

After following all the above steps, you can now access your admin panel by using your credentials. Therefore, the admin login will open as in the image below.

You can find admin login details in env.phpfile

#cat /home/magento/magento2/app/etc/env.php

Then you can login to – http://yourdomain/admin_5gxvjf

You can’t log in to the Magento Admin Panel after installation since two-factor authentication has been implemented in Magento 2.4.6.

Hence, a page similar to the one below will open.

Moreover, to log in, you need a working email id. Then Magento sends an email to authenticate the given email ID.

In order to log in to your Magento panel, the default flow is to first disable the 2-factor authentication and later on setting up it again.

Thus, we can disable 2FA by using the below command in the Magento web root directory:

**We highly recommend you continue with 2-factor authentication**

At last, the admin panel is accessible. In addition, this is what the default admin dashboard looks like.

In short, your Magento 2.4.6 e-commerce platform is ready to use.

Thanks For Reading!

At last, we hope it works for you! And during this blog, you have found something valuable.

Keep in touch!!

Need Support?

Thank You for reading this Blog!

For further more interesting blogs, keep in touch with us. If you need any kind of support, simply raise a ticket at https://webkul.uvdesk.com/en/.

You may also visit our Odoo development services and quality Odoo Extensions.

For further help or queries, please contact us or raise a ticket.

Category(s) AWS cloud ecommerce magento
. . .

Leave a Comment

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


  • Tahir
  • Roiman Cardenas
    • Bhawana Dehran (Moderator)
  • Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home