INSTALLATION OF MAGENTO IN LINUX
Introduction To Magento
Magento is an open source e-commerce platform written with PHP. Magento is the best possible shopping cart solution for businesses. We can also use different themes functionalities to modifiy colors and fonts to make effective in your website.
System Requirements
You need to Install these Requirements to run magento in your linux system . before check the version which version you want to install. These are basic requirements ,
- Apache2
- MySQL
- PHP and the extensions
- Composer
- Magento
STEP 1 : Install apache
To install apache2 on linux ,
sudo apt update
This command is used for update the package index.
sudo apt install apache2
This command is used for installing the apache2.
sudo apache2ctl -v
You can use this command to check the version of the apache2
You may check that apache is correctly installed by entering domain name in your browser.
STEP 2: Install MYSQL
To install mysql on linux,
sudo apt install mysql-server
This command is used for installing mysql ,after that you need to give configure access mysql root account
sudo mysql SELECT user, autheitcation_string,plugin,host FROM mysql user;
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘your_password’; exit
You need the change ‘your _password’ to your own password.
Next , you need to create user for the magento
mysql -u root -p
SELECT user, authetication_string, plugin, host FROM mysql.user;
CREATE USER ‘magento’@’localhost’ IDENTIFIED BY ‘your _password’;
Then, you need to modify the user and the permissions
ALTER USER ‘magento’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘your_password”
GRANT ALL PRIVILEGES ON *.* TO ‘magento2’@’localhost’ WITH GRANT OPTION ; exit
You need to create a database for the magento, mysql -u magento2 CREATE DATABASE magento; exit
STEP 3: Install PHP
sudo apt update
This command is used for update the apt repositories.
sudo apt install PHP (required version) libapache2 – mod – php php – mysql
The Following command is used for installing the PHP and the enabling the libapache. In the place required version you need to give which version you want to install.
sudo apt install PHP(required version)-mbstring
sudo a2enmod php
The following command is used for the enable mbstring and the PHP extensions. In the place required version you need to give which version you want to install.
STEP 4: Install Composer
curl -sS https://getcomposer .org/installer -o composer – setup .php sudo php composer -setup.php – – install -dir =/usr/bin – -filename=composer
This command is used for installing the composer to start with the root directory.
composer
The (composer )command used to check the version of the composer.
STEP 5: Install Magento
First we need to open the folder where the root folder is for eg:
cd /var/www/html
You need to Create a composer project
sudo composer create -project – – repository – url =https://repo.magento.com/ magento/project -community-edition =(2.4.3 )magento2
In the place of 2.4.3 you need to replace which version you need to install.
Then You need to set permissions
cd /var/www/html/magento
sudo find var generated vendor pub/static pub/media app/etc – type f -exec chmod g+w {} +
sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chown -R user_name : www-data
Then you need to open the install directory for the magento, In the place of magento give the correct directory.
cd/var/www/html/magento
php bin/magento setup:install – – base -url= <your-domain> – – db – host =localhost –db-user=magento –db-password=<your-db-password>
base url -Give a your domain which you want eg: hello.magento.com
db name – Magento database name you need to enter
db user – Magento database user name that you need to enter
db password – enter the mysql password
And then ,restart the apache2
sudo systemctl restart apache2
127.0.0.1 hello.magento.com
Next you need to save the file and the below command,
sudo a2ensite hello.magento.com
php bin/magento indexer :reindex && php bin/magento se :up &&php bin/magento se:s:d -f && php bin /magento c:f && php bin/magento module:disable magento_TwoFactorAuthoruization
Now you check with browser using http://hello.magento.com, then your luma page or admin page will be displayed.