How to Install Magento 2.4 in CWP – Control Web Panel

by Sandeep B.

In this tutorial we’ll learn how to install magento 2.4.x in CWP control panel. At the time of writing this tutorial CWP 7 (centos 7) have older version of MySQL server i.e. MariaDB 10.1 which is not supported by Magento 2.4.x.

CWP on centos 8 is fully supported by magento since it have Mariadb 10.4. Without wasting time lets get started.

Centos 7 Only :-

if you’re using Centos 8 CWP proceed with steps from Elastic search installation below.

Remove Mariadb 10.1 and update Mariadb 10.2 :

systemctl stop mariadb mysql mysqld

Now edit/create the file run the commands one by one :

ensure to remove the content of /etc/yum.repos.d/mariadb.repo

> /etc/yum.repos.d/mariadb.repo
nano /etc/yum.repos.d/mariadb.repo

then paste this lines and save it (Remove any entries from mariadb.repo before pasting below if any):

name = MariaDB
baseurl =

Now remove Mariadb 10.1 and install 10.2 :

yum remove MariaDB-server MariaDB-client -y && yum install MariaDB-server MariaDB-client -y 

Now update the server :

yum update -y

Next we’ll install Elastic search which is required by Magento 2.4.xx

cd /usr/local/src
rpm -ivh elasticsearch-7.9.2-x86_64.rpm

After it is installed you need to start the service and enable it to start the service on boot startup :

systemctl enable elasticsearch.service
systemctl start elasticsearch.service

You can test the service active and running via the status command :

systemctl status elasticsearch.service

Next we’ll Download Opensource Magento 2.4.x :

you can follow your own way of installing Magento 2.4.x or follow this :

Please note here “user” is the username of your user account in below commands.

Download Magento :

cd /home/user/public_html
wget -c -O
rsync -av magento2-2*/ . && rm -rf magento2-2*

Now remove the “Options” config from .htaccess else you’ll get 500 Internal server Error

cd /home/user/public_html
sed -e '/Options/ s/^#*/#/' -i .htaccess pub/.htaccess

Fix the user file and folder permission :

cd /home/user/public_html
chown -R user:user *

Now install composer :

Use this tutorial to install composer : How to Install Composer in CWP

First you need to enabled full shell access for the user from cwp admin  >> Security >> Shell access and enable full shell access for the user now you need to login in ssh via user login details.

go to public_html dir or where magento root dir is :

cd /home/user/public_html

Now run composer install command to install required magento dependencies:

If you’re using php switcher version 7.3 or 7.4 run below command

composer install

when running php selector 7.3 or 7.4 run below command respectively :

/opt/alt/php73/usr/bin/php /usr/local/bin/composer install
/opt/alt/php74/usr/bin/php /usr/local/bin/composer install

when running php fpm 7.3 or 7.4 run below command respectively :

/opt/alt/php-fpm73/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm74/usr/bin/php /usr/local/bin/composer install

Now go to the domain url and check this page is showing up :

Thats means everything is up and running and we can proceed with next step :

Next Install Magento via Command line :

Ensure you’re still login as user via ssh and in the magento installation dir, now run below command to install magento ensure you created DB, user db and user DB password created from cwp and replaced in below command :

/opt/alt/php-fpm74/usr/bin/php bin/magento setup:install --base-url="https://www.domainname.tld/" --db-host="localhost" --db-name="magento_db" --db-user="magento_db" --db-password="db_password" --admin-firstname="admin" --admin-lastname="admin" --admin-email="youremail@domain.tld" --admin-user="admin" --admin-password="admin_pass" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin"   

Change php path:

#for php-fpm selector 7.4 :
#for php selector 7.4 :
#for php switcher 7.4 :

Change magento site domain url :


Replace the DB details :

--db-name="magento_db" --db-user="magento_db" --db-password="db_password"

Replace admin details for magento :

--admin-firstname="admin" --admin-lastname="admin" --admin-email="youremail@domain.tld" --admin-user="admin" --admin-password="admin_pass"

After that you can see installation is started and after the end you can login to admin and do settings and create magento powered site via gui.

Troubleshoot :

if you not able to login to admin and want to reset the password for magento admin, you need to login to phpmyadmin with magento user db and password and run this command to reset the Magento admin password :

go to SQL tab after selecting the correct db and run this command :

UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxYourNewPassword', 256), ':xxxxxxx:1') WHERE username = 'admin';

replace only “YourNewPassword” with your new password and run the sql command by clicking GO button.

If you’ve any question and want me to update the post comment below or for more advanced support use our support forum

If this post helps you in any way please consider a donation

Donate with PayPal :


You may also like


John November 16, 2020 - 8:27 pm

Thanks for this excellent support. My question is after granting “user” full ssh access, do you deactivate the access after comopleting the installation?

Sandeep B. November 16, 2020 - 8:36 pm

Yes sure you can disable it.

John November 28, 2020 - 3:22 pm

1. How do you ensure that the permission to the magento root is not overwritten all the time. For instance , i have to each time grant permision to the “user”, before the command is accepted or permission will be denied.

2. Do I install composer as the root or the user with ssh access?

Sandeep B. November 28, 2020 - 4:29 pm

replied here already, this need to be run when you want to modify the files or download any dependencies via composer/php

Keneth December 22, 2020 - 1:50 am

I get this error after I deploy sample data, the upgrade:
Unable to apply data patch Magento\CatalogRuleSampleData\Setup\Patch\Data\InstallCatalogRuleSampleData for module Magento_CatalogRuleSampleData. Original exception message: Rolled back transaction has not been completed correctly.

Sandeep B. December 22, 2020 - 11:23 am

check this thread

or create a topic in forum for more detailed issues.

Waqass Khalid May 2, 2021 - 11:10 pm

I followed the steps till composer install correctly. Everything setup correctly without any error. The latest composer was giving error but I downgraded it to run it successfully. However upon going to domain main page I get HTTP ERROR 500

Sandeep B. May 4, 2021 - 1:27 pm

500 internal server can be many reason probably you didn’t have correct permission for the script files.


Leave a Comment