Step 1: Check which version of php you have installed and running at the moment.
$ php -v
Step 2: After that you have to check which version of Magento is match with your php version.
https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html
click on this link After that you will get bellow table
Step 3: Here we can install Magento by install Magento2 composer pack.
$ composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.3 magento2
Step 4: run below command for download sample data into database :
here you have to change
–base-url=<as per your link> \
–db-host=<as per your local host > \
–db-name=<as per your data base name> \
–db-user=<as per your mysql user name>\
–db-password=<as per your mysql password> \
in these commands after that copy full command and run below command
$ sudo php bin/magento setup:install \
--base-url=http://localhost/magento2 \
--db-host=127.0.0.1 \
--db-name=magento2 \
--db-user=root \
--db-password= \
--backend-frontname=admin \
--admin-firstname=admin --admin-lastname=admin --admin-email=admin@admin.com \
--admin-user=admin --admin-password=admin@123 --language=en_US \
--currency=USD --timezone=America/Chicago --cleanup-database \
--use-rewrites=1 \
--search-engine=elasticsearch7 --elasticsearch-host=localhost \
--elasticsearch-port=9200 –elasticsearch-index-prefix=magento2
After successfully run of process you will get this type of message
Error : you may get elasticsearch version error at that time you check the version of elasticsearch by below command
$ cd /usr/share/elasticsearch
$ sudo ./bin/elasticsearch –version
After finished completing of your process you will get below message
Step 5: run update command which is given below :
$ php bin/magento setup:upgrade
Error :In ErrorHandler.php line 61:
then give a permission of pub folder by below command
$ sudo chmod -R 777 var/ generated/ pub/
then run again $ php bin/magento setup:upgrade
Step 6:run below command :
$ sudo chmod -R 777 var/ generated/ pub/
rm -rf generated/* &&\
rm -rf var/generation/* && \
rm -rf var/view_preprocessed/* && \
rm -rf var/di/* && \
rm -rf var/cache/* && \
rm -rf var/page_cache/* && \
rm -rf pub/static/frontend/* && \
rm -rf pub/static/adminhtml/* && \
php bin/magento setup:upgrade
php bin/magento setup:di:compile
sudo chmod -R 777 var/ generated/ pub/
php bin/magento s:s:d -f
sudo chmod -R 777 var/ generated/ pub/
php bin/magento index:reindex
php bin/magento c:c
php bin/magento c:f
sudo chmod -R 777 var/ generated/ pub/
After run this command you will get this type of message
Step :-7 run below command :
$ php bin/magento setup:di:compile
Step :- 8 After that run below command :
$ sudo chmod -R 777 var/ generated/ pub/
Step :-9 After that run below command :
$ php bin/magento s:s:d -f
Step 10:- After that You will run below command :
$ sudo chmod -R 777 var/ generated/ pub/
$ php bin/magento index:reindex
Some Command are use with short form so for understand and for use below are give some commands with shot form and full form
php bin/magento cache:clean ==> php bin/magento c:c
php bin/magento indexer:reindex ==> php bin/magento i:rei
php bin/magento indexer:info ==> php bin/magento i:i
php bin/magento indexer:status ==> php bin/magento i:sta
php bin/magento indexer:show-mode ==> php bin/magento i:sho
php bin/magento indexer:reset ==> php bin/magento i:res
php bin/magento setup:di:compile ==> php bin/magento s:di:c
php bin/magento setup:upgrade ==> php bin/magento s:up
php bin/magento setup:static-content:deploy ==> php bin/magento s:s:d
php bin/magento module:status ==> php bin/magento mo:s
php bin/magento module:disable Namespace_Module ==> php bin/magento mo:d Namespace_Module
php bin/magento module:enable Namespace_Module ==> php bin/magento mo:e Namespace_Module
php bin/magento module:uninstall Namespace_Module ==> php bin/magento m:u Namespace_Module
For more command of Magento you can follow below link :
https://devdocs.magento.com/guides/v2.4/install-gde/composer.html
Thank you for reading…!