Hi .I am new to magento.I have been trying to install it but not able to do so.I have installed composer and got the authentication keys.What should i do next?
Installing Magento can be a complex process, but I can provide you with a general overview of the steps you need to follow after obtaining your Composer authentication keys. Here's a step-by-step guide to help you install Magento:
Prerequisites:
Create a Database:
Install Composer:
Get Magento Authentication Keys:
Install Magento:
Open your command line or terminal.
Navigate to the directory where you want to install Magento.
Use the following Composer command to install Magento 2:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition
When prompted, enter your authentication keys.
Configure Magento:
After the installation is complete, navigate to the Magento installation directory. You can use the cd command to change directories.
Run the Magento setup wizard by executing the following command:
bin/magento setup:install --base-url=http://your-magento-url/ \ --db-host=your-db-host --db-name=your-db-name --db-user=your-db-username \ --db-password=your-db-password --admin-firstname=YourFirstName \ --admin-lastname=YourLastName --admin-email=you@example.com \ --admin-user=admin --admin-password=admin123 --language=en_US \ --currency=USD --timezone=America/New_York --use-rewrites=1
Set File Permissions:
Complete the Installation:
Customize and Configure:
Install Extensions and Themes:
Step 1: Install Composer
1) Run the following command to check if Composer has already been installed:
composer --help
composer list --help
2) If nothing displays or you face any errors, please install Composer:
Create an empty directory on your Magento server and run the following commands:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
3) Run the following command to make your Composer globally available
mv composer.phar /usr/local/bin/composer
Step 2: Download Magento 2
Run the following command in the root directory.
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .
For example, let’s say we want to download Magento 2.4.2 in our root directory.
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.2 .
Step 3: Set Up Permissions
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 4: Create The Database
echo "CREATE DATABASE magento2" | mysql -u[mysqluser] -p
Step 5: Install Magento 2
php bin/magento setup:install
--base-url="http://yoururl.com/"
--db-host="localhost"
--db-name="dbname"
--db-user="dbuser"
--db-password="dbpass"
--admin-firstname="admin"
--admin-lastname="admin"
--admin-email="user@example.com"
--admin-user="admin"
--admin-password="admin123"
--language="en_US"
--currency="USD"
--timezone="America/Chicago"
--use-rewrites="1"
--backend-frontname="admin"
Root .htaccess file:
Copy .htaccess file in pub folder and paste in root directory
Root index.php file:
Copy index.php file in pub folder and paste in root directory
Database Name :
Table Name: core_config_data
Simple SQL for above: Change your base url to your project folder name
INSERT INTO `core_config_data` (`config_id`, `scope`, `scope_id`, `path`, `value`, `updated_at`) VAL...
Sample data:
php bin/magento sampledata:deploy
DISABLE Module:
php bin/magento module:disable Magento_TwoFactorAuth
Run Commands Module:
php bin/magento s:up
php bin/magento s:di:compile
php bin/magento s:static-content:deploy -f
php bin/magento c:f
rm -rf generated/metadata
If there is index.php in URL, to remove it got to path:
Store->Configuration->General->Web->Search Engine Optimization
Enable: Use Web Server Rewrites