Reading list Switch to dark mode

    Magento 2.4 Environment Setup Installation on Ubuntu

    Updated 13 January 2023

    Let’s start configuring environment to install Magento 2.4 on Ubuntu.

    Recent version of Magento requires some special configuration from other versions so i have explained the required configuration on fresh Ubuntu. By following the below command step by step we can setup the environment properly.

    To install Apache 2.4 you can go through this url

    Configure Apache 2.4

    To check system requirements as per the magento version, you can click:

    Searching for an experienced
    Magento 2 Company ?
    Find out More

    Install PHP version 7.4/8.1(based on magento version) by following commands.

    All of the commands requires sudo access so run sudo su first

    1. apt install software-properties-common
    2. add-apt-repository ppa:ondrej/php
    3. apt update
    4. apt install php7.4

    PHP-7.4 required extensions must be installed before installing Magento 2.4

    1. $ apt-get install php7.4-{gd,curl,intl,bcmath,ctype,dom,iconv,mbstring,simplexml,soap,xsl,zip}
    2. $ apt-get install php7.4-mysql

    Install MySQL 8.0 by following commands

    1. wget
    2. dpkg -i mysql-apt-config_0.8.10-1_all.deb
    3. apt-get update
    4. apt-get install mysql-server


    1. $ php -r "copy('', 'composer-setup.php');"
    2. $ php composer-setup.php --version=1.10.16
    3. mv composer.phar /usr/local/bin/composer
      Note: The composer version may vary as per magento version.

    Disable old version php and enable new latest

    1. a2dismod php7.2
    2. a2enmod php7.4

    Install Elasticsearch by the following commands

    1. apt-get -y update
    2. apt-get install -y openjdk-8-jdk
    3. java -version
    4. curl -fsSL | sudo apt-key add –
    5. echo “deb stable main” | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
    6. apt update
    7. sudo apt install elasticsearch
    8. Configure Apache and Elasticsearch

    Now you can install Magento 2.4 by following the urls.

    Install Magento and Installing Magento2.4

    Thanks for reading.

    . . .

    Leave a Comment

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


  • Jose Villalobos
    Just amazing, thanks!
    • Rajan Dimri (Moderator)
      Hello There,
      Thanks for the appreciation. For any further queries email us at [email protected] and we will assist you accordingly.

      Thank You

  • Back to Top

    Message Sent!

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

    Back to Home