Skip to main content

Magento

On this site, you find a guide to install Magento 2 on CloudPanel.

Prerequirements

Magento 2 requires to have Elasticsearch 7.9 installed.

Follow the guide https://www.elastic.co/guide/en/elasticsearch/reference/7.9/deb.html to learn how to install Elasticsearch 7.9.

Creating a Magento Site

Via CloudPanel

  1. Click on + Add Site and then click on Create a PHP Site.
Create a PHP Site
  1. Select the Application Magento 2, enter Domain Name, Site User, Site User Password, and click on Create.
Create a Magento Site

Via CloudPanel CLI

If you like the command line, you can create a Magento Site with the following command as root user.

clpctl site:add:php --domainName=www.domain.com --phpVersion=8.2 --vhostTemplate='Magento 2' --siteUser='john-doe' --siteUserPassword='!secretPassword!'

Creating a Magento 2 Project

  1. Log in via SSH with the Site User:
ssh john-doe@server-ip-address
  1. Go to htdocs and delete the directory which CloudPanel has created:
cd htdocs && rm -rf www.domain.com
  1. Create a Magento Project via Composer.
Magento Authentication Keys Required

Get Magento Authentication Keys before you create the project via composer.

php8.2 /usr/local/bin/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition www.domain.com
  1. Create a Database and copy the Database Name, Database User Name, and Database User Password.

  2. Go to the installation directory and execute the setup::install script from Magento:

cd ~/htdocs/www.domain.com/
Edit Parameters

Edit the parameters like key, db-host, db-name to your needs.

php8.2 bin/magento setup:install --backend-frontname='admin' --key='18Av6ITivOZG3gwY1DhMDWtlLfx1spLP' --session-save='files' --db-host='127.0.0.1' --db-name='magento2' --db-user='magento2' --db-password='magento2' --base-url='https://www.domain.com/' --base-url-secure='https://www.domain.com/' --admin-user='admin' --admin-password='!admin123!' --admin-email='john@doe.com' --admin-firstname='John' --admin-lastname='Doe'
  1. Done. Magento 2 has been installed.
Magento 2 has been installed