Jump to content

Install Magento 2.4 from Github Source in CWP – Control Web Panel

Recommended Posts

 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.2 which is not supported by Magento 2.4.x. With recent CWP installation MariaDB 10.4 IS ALREADY THERE.

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 or10.2 and update Mariadb 10.4:

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 = http://yum.mariadb.org/10.4/centos7-amd64

Now remove Mariadb 10.1, 10.2 and install 10.4 :

systemctl stop mariadb mysql mysqld
systemctl disable mariadb
rpm --nodeps -ev MariaDB-server
yum clean all
yum -y update "MariaDB-*"
yum -y install MariaDB-server

Then Start MariaDB server :

systemctl enable mariadb && systemctl mariadb start

then upgrade the mysql dbs :

mysql_upgrade --force

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

For version Elastic Search 7 Centos 7 and Centos 8 (recommended) :

cd /usr/local/src
rm -rf elasticsearch*
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.8-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.8-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-7.17.8-x86_64.rpm.sha512
rpm --install elasticsearch-7.17.8-x86_64.rpm

For version Elastic Search 8.5 Centos 7 and Centos 8:

cd /usr/local/src
rm -rf elasticsearch*
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.5.3-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.5.3-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-8.5.3-x86_64.rpm.sha512 
rpm --install elasticsearch-8.5.3-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 https://github.com/magento/magento2/archive/refs/tags/2.4.6-p1.zip -O magento24.zip
unzip magento24.zip
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

Then 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,7.4,8.0 or 8.1/8.2 run below command

composer update
composer install

when running php selector 7.3,7.4,8.0 or 8.1/8.2 run below command respectively :

/opt/alt/php73/usr/bin/php /usr/local/bin/composer update
/opt/alt/php73/usr/bin/php /usr/local/bin/composer install
/opt/alt/php74/usr/bin/php /usr/local/bin/composer update
/opt/alt/php74/usr/bin/php /usr/local/bin/composer install
/opt/alt/php80/usr/bin/php /usr/local/bin/composer update
/opt/alt/php80/usr/bin/php /usr/local/bin/composer install
/opt/alt/php81/usr/bin/php /usr/local/bin/composer update
/opt/alt/php81/usr/bin/php /usr/local/bin/composer install
/opt/alt/php82/usr/bin/php /usr/local/bin/composer update
/opt/alt/php82/usr/bin/php /usr/local/bin/composer install

when running php fpm 7.3,7.4,8.0 or 8.1/8.2 run below command respectively :

/opt/alt/php-fpm73/usr/bin/php /usr/local/bin/composer update
/opt/alt/php-fpm73/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm74/usr/bin/php /usr/local/bin/composer update
/opt/alt/php-fpm74/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm80/usr/bin/php /usr/local/bin/composer update
/opt/alt/php-fpm80/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm81/usr/bin/php /usr/local/bin/composer update
/opt/alt/php-fpm81/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm82/usr/bin/php /usr/local/bin/composer update
/opt/alt/php-fpm82/usr/bin/php /usr/local/bin/composer install

Now go to the domain url and check this page is showing up if the magento version is showing there That's 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-fpm82/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"   

** Below are the pipe parameters you need to change 

To Change php path:

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

or for php 8.1 : 

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

or for php 8.2 :

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

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.

it will show success message at last

[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin
Nothing to import.

admin url will be : https://www.yourdomain.tld/admin

Now Add cron Job

/opt/alt/php-fpm82/usr/bin/php bin/magento cron:install

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.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...