1. Update and Upgrade Packages:
-
Open a terminal window and run:
Bashsudo apt update && sudo apt upgrade
2. Install Apache2:
-
Install the Apache web server:
Bashsudo apt install apache2
3. Install PHP 7.4 and Extensions:
-
Add the Ondrej PHP repository:
Bashsudo add-apt-repository ppa:ondrej/php sudo apt update
-
Install PHP 7.4 and required extensions:
Bashsudo apt install php7.4 php7.4-common php7.4-mysql php7.4-gd php7.4-curl php7.4-intl php7.4-mbstring php7.4-zip php7.4-xml php7.4-soap php7.4-bcmath php7.4-fpm php7.4-opcache
4. Configure Apache for PHP 7.4:
-
Disable the default PHP 8.1 module:
Bashsudo a2dismod php8.1
-
Enable the PHP 7.4 module:
Bashsudo a2enmod php7.4
-
Restart Apache:
Bashsudo systemctl restart apache2
5. Install MySQL:
-
Install MySQL server and client:
Bashsudo apt install mysql-server mysql-client
-
Secure MySQL installation:
Bashsudo mysql_secure_installation
6. Create a Magento Database:
-
Access the MySQL shell:
Bashsudo mysql -u root -p
-
Create a database and user:
SQLCREATE DATABASE magento_db; CREATE USER 'magento_user'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON magento_db.* TO 'magento_user'@'localhost'; FLUSH PRIVILEGES;
-
Exit the MySQL shell:
SQLexit
7. Install Elasticsearch:
-
Add the Elasticsearch repository key and repository:
Bashwget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - echo
"deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
-
Install Elasticsearch:
Bashsudo apt update sudo apt install elasticsearch
-
Start and enable Elasticsearch:
Bashsudo systemctl start elasticsearch sudo systemctl enable elasticsearch
8. Install Composer:
-
Download and install Composer:
Bashphp -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3d5936c39e735c55f72dac986e5155545f5485754052f589f555a852f40f66c454a93') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"