Saturday, 5 October 2019

How to Install Magento 2 on Ubuntu 18.04

#######   How to Install Magento 2 on Ubuntu 18.04 ######

Login with your server and follow the steps


sudo apt update && sudo apt upgrade
sudo apt install unzip

sudo apt install mysql-server mysql-client


sudo mysql

CREATE DATABASE magento2;

GRANT ALL ON magento2.* TO 'magento2'@'localhost' IDENTIFIED BY 'Z6TyZnMux0gcNRXk!1';   #magento 2 is db name and user name


UPDATE mysql.user SET Super_Priv='Y' WHERE user='magentotheme2' AND host='%';
UPDATE mysql.user SET Super_Priv='Y' WHERE user='magento2' AND host='%';
GRANT SUPER ON *.* TO magentotheme2@localhost;
GRANT SUPER ON *.* TO magento2@localhost;
flush privileges;

EXIT;


###################  Create system user

sudo useradd -m -U -r -d /home/www www
sudo usermod -a -G www www-data

#sudo chmod 750 /home/www

#########################   Installing and configuration php

sudo apt install php7.2-common php7.2-cli php7.2-fpm php7.2-opcache php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-soap

sudo systemctl status php7.2-fpm


sudo sed -i "s/memory_limit = .*/memory_limit = 2048M/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 256M/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/zlib.output_compression = .*/zlib.output_compression = on/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/;opcache.save_comments.*/opcache.save_comments = 1/" /etc/php/7.2/fpm/php.ini


sudo nano /etc/php/7.2/fpm/pool.d/www.conf

write the following

[www]
user = www
group = www

listen = /run/php/php7.2-fpm.sock
listen.owner = www
listen.group = www

;pm = dynamic
;pm.max_children = 5
;pm.start_servers = 2
;pm.min_spare_servers = 1
;pm.max_spare_servers = 3

pm = dynamic
pm.max_children = 25
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500


Then

sudo systemctl restart php7.2-fpm

ls -al /var/run/php/php7.2-fpm.sock


#Installing Composer

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer


########  Change user
sudo su www
then go to cd /home/www

run the following command to download the magento

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition

To Install magento through command then run the following command

php bin/magento setup:install --base-url=http://limextechnology.com/ \
        --base-url-secure=https://limextechnology.com/ \
        --admin-firstname="Debendra" \
        --admin-lastname="Prusty" \
        --admin-email="debendra@limextechnology.com" \
        --admin-user="debendra" \
        --admin-password="admin1234@" \
        --db-name="magento2" \
        --db-host="localhost" \
        --db-user="magento2" \
        --currency=USD \
        --timezone=America/Chicago \
        --use-rewrites=1 \
        --db-password="Z6TyZnMux0gcNRXk!1"




############  If Nginx is not installed then run the following commands only ##############################
sudo apt update
sudo apt install nginx
sudo systemctl status nginx
sudo systemctl restart nginx

$$$$$$$$$  Some Command $$$$$$$$$$$$$$$$$$$$
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl restart nginx
sudo systemctl reload nginx
sudo systemctl disable nginx
sudo systemctl enable nginx
###############################  End Nginx installation #########################################



sudo nano /etc/nginx/sites-available/default

Add the followng lines


upstream fastcgi_backend {
server unix:/run/php/php7.2-fpm.sock;
}

server {

server_name limextechnology.com;

access_log /var/log/nginx/access-limex.log;
error_log /var/log/nginx/error-limex.log;

set $MAGE_ROOT /home/www;
set $MAGE_MODE developer; # or production
include /home/www/nginx.conf.sample;


}

server {
server_name limextechnology.com;
listen 80;

}



sudo nginx -t

sudo systemctl restart php7.2-fpm
sudo systemctl restart nginx

##################  End the Magento 2 Installation ###################################################

No comments:

Post a Comment

Thanks for your comments.