Magento
On this site, you find a guide to install Magento 2 on CloudPanel.
Prerequirements
Magento 2 requires to have Elasticsearch 8.x installed.
Follow the guide https://www.elastic.co/guide/en/elasticsearch/reference/8.11/deb.html to learn how to install *Elasticsearch 8.x.
Creating a Magento Site
Via CloudPanel
- Click on + Add Site and then click on Create a PHP Site.
- Select the Application Magento 2, enter Domain Name, Site User, Site User Password, and click on Create.
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.3 --vhostTemplate='Magento 2' --siteUser='john-doe' --siteUserPassword='!secretPassword!'
Creating a Magento 2 Project
- Log in via SSH with the Site User:
ssh john-doe@server-ip-address
- Go to htdocs and delete the directory which CloudPanel has created:
cd htdocs && rm -rf www.domain.com
- Create a Magento Project via Composer.
Magento Authentication Keys Required
Get Magento Authentication Keys before you create the project via composer.
php8.3 /usr/local/bin/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition www.domain.com
Create a Database and copy the Database Name, Database User Name, and Database User Password.
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.3 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'
- Done. Magento 2 has been installed.