Magento is a open source e-commerce platform written in PHP. And it is highly popular ecommerce platform and owned and managed by Adobe Inc. The platform is flexible and has a large variety of features to build an online store.
In this tutorial we will guide you on how to install Magento 2.4.3 using the LAMP stack.
Let us start the installation.
1 1. Updating the system
sudo apt update -y && apt upgrade -y
2 2. Installing PHP and PHP extensions
The default PHP version of Ubuntu 20.04 is PHP 7.4. In this setup we will use PHP 7.4 since it is the required version for the 2.4.3 version. Let us proceed installing PHP and the extensions.
The database that we are going to use in this tutorial is MariaDB.
Let us proceed with the Database installation.
sudo apt install mariadb-server -y
Let us configure MariaDB server.
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): Press Enter
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
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
Restart MariaDB service:
sudo systemctl restart mariadb
Let us create the database for our application.
First login to our MariaDB console.
sudo mysql -u root
Now create the Database name and Database user.
MariaDB [(none)]> create database magento2;
MariaDB [(none)]> grant all privileges on magento2.* to 'magento_user'@'localhost' identified by 'mypassword';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
Please don’t forget to change the “mypassword” to your desired password.
4 4. Web server Installation and Configuration
Since this tutorial is on LAMP stack we will install Apache web server.
Congratulations you have successfully installed Magento 2.4.3 you can now access your site at http://domain.com
You have learned how to install Magento 2.4.3 on Ubuntu 20.04 with the LAMP stack. The next obvious thing to do is secure your site by installing SSL certificate so we recommend you check our article on Let’s Encrypt.
If you have questions, feel free to leave a comment and we will try to answer it.