Step -1 update the system.
sudo apt-get update
Step -2: Check the version of your system(PHP -v) or you can find the installed PHP version in the directory.-
/etc/php
Step -3 Install PHP 8.1 if not installed in your system.(apt-get install -y php8.1)
Change the PHP version of your system
1st way
sudo update-alternatives --config PHP
**2nd way**
sudo a2dismod php7.4
sudo a2enmod php8.1
sudo systemctl restart apache2
sudo update-alternatives --set php /usr/bin/php8.1
Step -4 :
Install the PHP libary
sudo apt-get install php-curl
sudo apt-get install php-xml
sudo apt install php-xmlwriter
sudo apt-get install php8.1-gd
sudo apt-get install php8.1-intl
sudo apt-get install php8.1-mysql
sudo apt-get install php8.1-intl
sudo apt-get install php-mbstring
sudo apt-get install php8.1-soap
sudo apt-get install php8.1-zip
sudo apt install php8.1-bcmath
Step -5 Restart the server
sudo service apache2 restart
Step -6 Instlla Mangento in local
php -d memory_limit=6G /usr/local/bin/composer2 create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.4
Step -7 :Install Database
php bin/magento setup:install --base-url=http://magento244.com/ --db-host=localhost --db-name=magento244 --db-user=admin --db-password=Admin@123 --admin-firstname=dipesh --admin-lastname=balar --admin-email=dipesh.balar@brainvire.com --admin-user=dipesh --admin-password=Brain@2018 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200
Step - 8: Setup Host entry and configuration in local
http://magento244.com/
sudo touch magento244.com.conf
Do configuration as in mentioned below.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName magento244.com
DocumentRoot /home/dipesh_balar/htdocs/magento244
<Directory /home/dipesh_balar/htdocs/magento244/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
3 - open the local host file and do setup
/etc/hosts
127.0.1.1 magento244.com
4 - Restart the server
sudo a2ensite magento244.com.conf
sudo a2enmod rewrite
service apache2 restart
Note: for PHP 8.1 your PHPmyadmin version required 5.2+
Step -9 : php bin/magento module:disable Magento_TwoFactorAuth
Step -10 : php bin/magento config:set dev/static/sign 0
Step -11 : php bin/magento dep:mod:set developer
Step -12 : php bin/magento s:up && php bin/magento s:di:com && php bin/magento s:s:de -f && php bin/magento ind:rei && php bin/magento c:f
If you want to install sample data you have to run the below command.
php -d memory_limit=6G bin/magento sampledata:deploy