You are on page 1of 5

1.

Install WSL:
 Please install the wsl.exe file at your window system.
Path: wsl_update_x64(1).msi
 Open the powershell with administrator mode
 Run wsl –install
 Run: wsl --install -d Ubuntu-22.04
This command install the ubuntu 22.04
 Check the wsl status and version: wsl -l -v
Others command for WSL:
wsl –list
wsl –status
wsl –update
wsl –version
wsl --list –online
wsl --setdefault Ubuntu-22.04
wsl --set-default-version 2
wsl --install -d Ubuntu-22.04 2
wsl --list –verbose
wsl --set-version Ubuntu-22.04 2
wsl --shutdown
 Run the wsl: type “wsl” at the powershell to enable the wsl (enter the linux system)
2. Install Apache:
 sudo apt update
if above command didn’t work use =-> echo "nameserver 8.8.8.8" | sudo tee
/etc/resolv.conf > /dev/null
 sudo apt install apache2
 Once installed, you can check the installed Apache version with the following
command:
sudo apache2ctl -v
 To enable auto startup for apache, use this command: systemctl is-enabled
apache2
 Update default port 80 to any other:
sudo cp /etc/apache2/ports.conf /etc/apache2/ports.conf.bak
sudo nano /etc/apache2/ports.conf
change the port 80 to 8081
 Apatche conf accept filter changes:
sudo nano /etc/apache2/apache2.conf
Add below lines at end of the file.
AcceptFilter http none
AcceptFilter https none
 Be sure apache is running :
sudo service apache2 restart

3. Check if you are able to open localhost on browser: http://127.0.0.1/ then follow 5th step.
4. In command line: ifconfig & copy the underline IP & hit it with port you mentioned above.

Check now If now server is working. If yes just replace this IP 127.0.0.1 with copied one in all below
steps

5. Install Mysql:
 sudo apt install mysql-server
 After installation you can check the mysql version using below command:
mysql -V
 Login with root user :
sudo mysql
 SELECT user,authentication_string,plugin,host FROM mysql.user;
 Note: Replace ‘your_secure_password‘ with your password:
 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY
'your_secure_password';
 exit
 Create new MySQL user for Magento 2:
 mysql -u root -p
 SELECT user,authentication_string,plugin,host FROM mysql.user;
 Note: Replace ‘your_secure_password‘ with your password.
 CREATE USER 'magento2'@'localhost' IDENTIFIED BY 'your_secure_password';
 ALTER USER 'magento2'@'localhost' IDENTIFIED WITH mysql_native_password BY
'your_secure_password';
 GRANT ALL PRIVILEGES ON *.* TO 'magento2'@'localhost' WITH GRANT OPTION;
 exit
 Create Database :
 mysql -u magento2 -p
 CREATE DATABASE magento2;
 Exit

Mysql Commands:
sudo service mysql start
sudo service mysql stop
sudo service mysql status
sudo service mysql restart

6. Install PHP and required extensions


 Update your APT repositories :
sudo apt update
 Install PHP 8.1 and packages with command :
sudo apt install php8.1 libapache2-mod-php php-mysql
 verify your PHP version:
php -v
 Install and enable mbstring extension:
sudo apt install php8.1-mbstring
sudo phpenmod mbstring
 Enable the Apache rewrite module:
sudo a2enmod rewrite
 Install PHP modules for Magento 2.4.x.
sudo apt install php8.1-bcmath php8.1-intl php8.1-soap php8.1-zip php8.1-gd
php8.1-curl php8.1-cli php8.1-xml php8.1-xmlrpc php8.1-gmp php8.1-common
 Restart Apache:
sudo service apache2 restart
 Configure php settings:
php -i | grep "Configuration File"
sudo nano <path_of_php.ini_file>
In php.ini file, search and change the following values as below:
max_execution_time=18000
max_input_time=1800
memory_limit=8G
max_input_vars =50000
 Restart Apache:
sudo service apache2 restart

7. Install Elastic search and configuration:


 First, we will install Openjdk17 (Java) as Elasticsearch runs on Java:
sudo apt install openjdk-17-jdk
 verify if the java was installed properly and check its version with this syntax
java -version
 sudo apt install curl
 sudo curl -sSfL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --no-default-
keyring --keyring=gnupg-ring:/etc/apt/trusted.gpg.d/magento.gpg –import
 sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" >
/etc/apt/sources.list.d/elastic-7.x.list'
 sudo chmod 666 /etc/apt/trusted.gpg.d/magento.gpg
 sudo apt update
 sudo apt install elasticsearch
 sudo service elasticsearch start
 Configure Elasticsearch After installation:
 sudo nano /etc/elasticsearch/elasticsearch.yml
 Remove the # character at the beginning of the lines
for node.name and cluster.name to uncomment them, and then change their
values. Your first configuration changes in
the /etc/elasticsearch/elasticsearch.yml file will look like this:
node.name: "My First Node"
cluster.name: my-application
network.host: 0.0.0.0
 sudo service elasticsearch restart
 Check the ES is working fine or not:
curl -X GET 'http://localhost:9200'

8. Install Composer:
 cd ~
 Downloading and installing composer.:
curl -sS https://getcomposer.org/installer -o composer-setup.php
 sudo php composer-setup.php --install-dir=/usr/bin --filename=composer
 Let’s check the composer version:
composer

9. Install Magento:
 Add your ssh key to the git repo:
ssh-keygen
Copy the public key and follow the below steps:
Go to the ado git repository => user settings => SSH public key
Add your public key here
 After Adding the key. Take the git clone:
cd /var/www/
sudo chmod -R 777 html/
cd /var/www/html/
git clone tfs-glo-lexisadvance@vs-ssh.visualstudio.com:v3/tfs-glo-lexisadvance/BPS/
3094-global-ecommerce
CD 3094-global-ecommerce
COMPOSER_PROCESS_TIMEOUT=-1 composer install
 if your project root directory is not pub : Add index.php at root of the project
 Import DB:
DB file path: integration.sql (for infosys only)
mysql -u user_name -p dbname < dbpath.sql
Change the base url , static url , media path as well as elastic search host with the
core_config_data table.
 Add the config.php and env.php file under the app/etc directory of the magento.
File path: App
 Change the DB settings with the App/etc/env.php
 Run the below Magento commands:
php bin/magento s:up && php bin/magento se:di:co && php bin/magento se:s:d -f --
theme Magento/spectrum --theme Smartwave/porto_child_hk --theme
Smartwave/porto_child_sg --theme Smalllaw/theme en_US && php bin/magento
cache:clean && php bin/magento cache:flush
 Run indexing:
php bin/magento indexer:reset && php bin/magento indexer:reindex
 sudo chmod -R 777 var/ generated/ pub/ app/etc/
 upload the en-hk ,en-hk, buyonline direct at the root of your project. Change the
htaccess url
 upload the media and porto file pub/media direcotry
Media file path: pub

YT1EkSXyWhzxWLnV

10. Now hit the project url at browser.
EX: http://127.0.0.1:8081/3094-global-ecommerce
update your port here as well as the project directory name.

You might also like