Como instalar o magento2
Get the metapackage
To get the Adobe Commerce or Magento Open Source metapackage:
-
Log in to your application server as, or switch to, the file system owner.
-
Change to the web server docroot directory or a directory that you have configured as a virtual host docroot.
-
Create a Composer project using the Adobe Commerce or Magento Open Source metapackage.
Magento Open Source
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>
Adobe Commerce
-
rompted, enter your authentication keys. Public and private keys are created and configured in your Commerce Marketplace.
https://commercemarketplace.adobe.com/customer/account/
Step 4: Set Permission to Install Magento 2.4
To install Magento 2, you now need to set proper permissions for your Magento 2 Store. Magento has a set of recommended permissions that we have to apply.
a ) The owner must have full access to files.
b ) Web Server must have write permission on var, app/etc and pub directory.
c ) Execute permission of bin/magento.
Certain commands for permissions are required to be executed at this stage:
Command:
- find . -type f -exec chmod 644 {} \;
- find . -type d -exec chmod 755 {} \;
- chmod -Rf 777 var
- chmod -Rf 777 pub/static
- chmod -Rf 777 pub/media
- chmod 777 ./app/etc
- chmod 644 ./app/etc/*.xml
- chmod -Rf 775 bin
Step 5: Create a Database for Magento installation
Create an empty database with MySQL/MariaDB
Command:
- echo "CREATE DATABASE magento2" | mysql -u[mysqluser] -p
Step 6: Install Magento 2.4
Now, the install Magento command needs to be executed
Command:
- php bin/magento setup:install --base-url="http://phpstack-739336-2511019.cloudwaysapps.com/"
- --db-host="167.99.205.158"
- --db-name="magento2"
- --db-user="yrzhqayjyq"
- --db-password="VA2r8RdxAe"
- --admin-firstname="Admin"
- --admin-lastname="Admin"
- --admin-email="abdul.rehman@cloudways.com"
- --admin-user="admin"
- --admin-password="Testing123%567"
- --use-rewrites="1"
- --backend-frontname="admin"
- --db-prefix=mage_
Configuração do apache
<VirtualHost *:443>
Define VAR_SSLCertificateFile /etc/letsencrypt/archive/diogogl.com/fullchain.pem
Define VAR_SSLCertificateKeyFile /etc/letsencrypt/archive/diogogl.com/privkey.pem
ServerName xsign.diogogl.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/xsign.diogogl.com
<Directory /var/www/xsign.diogogl.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteCond %{SERVER_NAME} =gilbertomag.diogogl.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile ${VAR_SSLCertificateFile}
SSLCertificateKeyFile ${VAR_SSLCertificateKeyFile}
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>