cancel
Showing results for 
Search instead for 
Did you mean: 

magento2 installation

magento2 installation

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?

2 REPLIES 2

Re: magento2 installation

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:

    • Before installing Magento, ensure that you have a suitable web hosting environment. Magento has specific system requirements, so make sure your server meets those requirements.
  • Create a Database:

    • You'll need a MySQL or MariaDB database to install Magento. Create a new database and make note of the database name, username, and password.
  • Install Composer:

    • It seems like you've already installed Composer, which is great. Composer is a dependency manager for PHP that Magento relies on for package management.
  • Get Magento Authentication Keys:

    • You've mentioned that you have the authentication keys. These keys are required to access Magento packages via Composer. Make sure you have them stored securely.
  • 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
  • Replace the placeholders (e.g., http://your-magento-url/, database details, admin information) with your specific information.
  • Set File Permissions:

    • Magento requires certain file permissions to function properly. Make sure to set the correct permissions for your Magento files and directories. Refer to Magento's documentation for the recommended permissions.
  • Complete the Installation:

    • Once the installation and configuration are complete, you can access your Magento store by opening a web browser and entering the URL you specified during installation.
  • Customize and Configure:

    • Log in to the Magento Admin Panel and start customizing your store, adding products, and configuring settings.
  • Install Extensions and Themes:

    • Magento is highly extensible. You can enhance its functionality by installing extensions and themes. Use Composer to install them, or follow the specific installation instructions provided by the extension or theme developers.

Re: magento2 installation

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

Delete File:- global.php
Under:- generated/metadata   directory

 

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