How to install magento - a practical example

Comprehensive Guide to Installing Magento 2 on a cPanel Server


In terminal window run the following.

Step one
composer create-project --repository-url= magento/project-community-edition

Step two
php bin/magento setup:install --base-url= --db-host=localhost --db-name=yourdomain_magento2 --db-user=yourprefex_magento2 --db-password=A3nnIsEyasaM --admin-firstname=branden --admin-lastname=Thomas --admin-user=branden --admin-password=JlfsdjpSlfdgw --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=localhost --elasticsearch-port=9200 --elasticsearch-index-prefix=Yourdomain

Still stuck on installing Magento try the more in depth article below.

Need more help! Our Magento Support Department would be more then happy to help usually only take an hour or so depending on the situcation.

Magento 2 is a powerful, open-source eCommerce platform widely used by businesses to create and manage online stores. While its robust features and flexibility make it a popular choice, the complexity of the platform can sometimes present challenges. Effective Magento 2 Support is crucial for ensuring a smooth, uninterrupted shopping experience for customers. This article will provide a detailed guide to installing Magento 2 from scratch on a cPanel server.


Before you begin, ensure you have the following:

  • A cPanel account with access to the server.
  • SSH access (if necessary).
  • A domain name pointed to your server.
  • Composer installed on the server (Magento 2 requires Composer).

Step 1: Prepare the Server

  1. Log in to cPanel:
    • Access your cPanel by visiting and log in with your credentials.
  2. Create a Database:
    • Go to the Databases section and click on MySQL® Databases.
    • Create a new database.
    • Create a new database user and assign it to the database with all privileges.

Step 2: Set Up SSH Access (If Required)

  1. Enable SSH Access:
    • In the Security section of cPanel, click SSH Access and manage SSH keys if required.
  2. Access via SSH:
    • Use an SSH client (like PuTTY for Windows or Terminal for macOS/Linux) to connect to your server.
    • Use your server IP and SSH port (default is 22).

Step 3: Install Composer

If Composer is not installed, follow these steps:

cd ~
curl -sS | php
sudo mv composer.phar /usr/local/bin/composer

Step 4: Download Magento

  1. Create a Document Root for Magento:
    • In the Files section, click File Manager and navigate to your document root (public_html or create a new directory).
  2. Download Magento via SSH:
    • Navigate to the directory where you want to install Magento:
      cd /home/yourcpanelusername/public_html
    • Download Magento using Composer:
      composer create-project --repository-url= magento/project-community-edition .
    • You will need to use your Magento Marketplace public and private keys to authenticate.

Step 5: Set Up File Permissions

Set the correct permissions:

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :yourcpanelusername .
chmod u+x bin/magento

Step 6: Install Magento

  1. Run the Magento Installation Wizard:
    • Access the Magento installation wizard by navigating to in your web browser.
    • Follow the on-screen instructions to complete the installation. You will need the database details you created earlier.
    • Alternatively, you can install Magento via CLI:
      bin/magento setup:install \
      --base-url= \
      --db-host=localhost \
      --db-name=yourdbname \
      --db-user=yourdbuser \
      --db-password=yourdbpassword \
      --admin-firstname=Admin \
      --admin-lastname=User \ \
      --admin-user=admin \
      --admin-password=admin123 \
      --language=en_US \
      --currency=USD \
      --timezone=America/Chicago \

Step 7: Finalize Configuration

  1. Set Up Cron Jobs:
    • Magento requires cron jobs for various tasks. Set up the following cron jobs in cPanel:
    • Go to Advanced > Cron Jobs.
    • Add the following cron jobs:
      * * * * * /usr/local/bin/php /home/yourcpanelusername/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/yourcpanelusername/public_html/var/log/magento.cron.log
      * * * * * /usr/local/bin/php /home/yourcpanelusername/public_html/update/cron.php >> /home/yourcpanelusername/public_html/var/log/update.cron.log
      * * * * * /usr/local/bin/php /home/yourcpanelusername/public_html/bin/magento setup:cron:run >> /home/yourcpanelusername/public_html/var/log/setup.cron.log
  2. Set Up File Permissions:
    • Ensure Magento has the correct permissions to function properly:
      find var pub/static pub/media app/etc -type f -exec chmod g+w {} +
      find var pub/static pub/media app/etc -type d -exec chmod g+ws {} +
      chmod u+x bin/magento
  3. Deploy Static Content (If Necessary):
    • After making changes, you may need to deploy static content:
      bin/magento setup:static-content:deploy -f

Step 8: Secure Your Installation

  1. Use HTTPS:
    • Ensure your website uses HTTPS by setting up an SSL certificate in cPanel under the Security section.
  2. Update .htaccess:
    • Update the .htaccess file to include security best practices.


By following these steps, you can successfully install Magento 2 on a cPanel server. Remember to keep your Magento installation updated and secure by regularly applying patches and updates. For additional support and services, consider reaching out to Magento 2 Support, a reliable service provider that can assist with all aspects of Magento 2 support.