Magento is an open-source e-commerce application written in PHP language. Magento also uses other PHP frameworks like Symfony and Laminas. Please refer to the following steps to install Magento 2.4.2 on Centos 7.x with cPanel using Softaculous.
System Requirements for Magento 2.4.2 in cPanel
- RAM: Minimum 2 GB RAM Required
- WebServer: Apache 2.4 with module mod_version enabled.
- MySQL 8.0 or MariaDB 10.4 for Magento Commerce Cloud projects
- PHP 7.4
- PHP Extention: ext-bcmath, ext-curl, ext-gd, ext-iconv, ext-intl, ext-mbstring, ext-openssl, ext-pdo_mysql, ext-simplexml, ext-soap, ext-xsl, ext-zip, ext-sockets, php-opcache, libsodium
- PHP Memory Limit: 512MB
You may not find the libsodium inside EasyApach 4.0 PHP Extention. Please go with the below steps to install libsodium in Centos 7.x
How to Install libsodium to Install Magento 2.4.2 on Centos 7.x?
1. In the first step, install the Linux EPEL package with the below command.
sudo yum install epel-release
2. Install the required library for the libsodium with the below command.
yum install libsodium libsodium-devel -y
3. Run the below command to install the libsodium PHP extension.
find /opt/cpanel/ -iname pecl | grep bin
/opt/cpanel/ea-php74/root/usr/bin/pecl install libsodium
4. We have successfully installed the PHP Extention libsodium.
Now, we have completed installing all the prerequisites for Magento 2.4.2. Let's move forward toward the Magento installation. Please note that we will install Magento from Softaculous. Ensure that your cPanel account has Softaculous installed. Please refer to how to install Softaculous on a Linux server with the cPanel?
1. Log in to your cPanel account.
2. Go to the Softaculous installer and search for Magento and click on it.
3. Click on the Install Now button.
4. Fill in all the details, like the Magento version and admin path. We suggest you keep it blank for the admin path.
5. At the admin account section, enter your admin credentials and email account. Make sure you enter the correct email account. You can select the database name, table prefix, and backup policy for Magento at the advanced options. Finally, click on the Install button. You will see the Downloading Packages option once you click on the Install button.
6. After the successful installation, you will get the below screen.
7. Open your website in the browser, and you will see the below screen.
8. You can open your admin account using yourdomain.com/admin in the browser.
9. We have successfully installed Magento, so let us log in with the admin credentials that we entered during installation.
10. Oops, Here you will face a challenge. By default, Magento enables two-factor authentication, but it doesn't ask for it during installation.
How to Disable Magento Admin Two-Factor Authentication?
To disable Magento Admin two-factor authentication, you need to run the below command at the Magento installation root. For cPanel, you need to go to the public_html of your domain and run the below command.
php bin/magento module:disable Magento_TwoFactorAuth
We have fixed the Magento 2-factor authentication. Log in to the Magento Admin Panel. But you may face the next hurdle. When you log in to the Magento Admin panel, you will see that it is loading continuously.
How to Fix Magento Admin Keep Loading Issue?
After installing the Magento Admin, you will face an issue that Magento Admin keeps loading.
Run the below command at the Magento root directory. It will deploy the static content and fix the Magento Admin loading issue,
php bin/magento setup:static-content:deploy -f
Now, clear the browser cache, and you should be able to log in to the Magento Admin now without any issues.