0% found this document useful (0 votes)
25 views3 pages

Magento Installation Guide with Dependencies

Uploaded by

hnluong.work02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Magento Installation Guide with Dependencies

Uploaded by

hnluong.work02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

# Install neccessaries

sudo apt-get -y update


sudo apt-get -y upgrade
sudo apt-get install -y gedit
sudo apt-get install -y composer
sudo apt-get install -y software-properties-common
sudo apt install -y pwgen
sudo apt install -y dbus-x11
sudo apt install -y openjdk-11-jdk
sudo apt install -y openssh-server

##
sudo apt-get -y update
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get -y update
sudo apt-get install -y curl wget gnupg

##
sudo apt install -y nginx
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
sudo ufw allow OpenSSH
sudo ufw allow
sudo ufw enable

####################### Install MySQL


sudo apt install -y mysql-server
sudo mysql_secure_installation
##
sudo mysql
set global validate_password.policy = LOW;
set global validate_password.length = 0;
set global validate_password.mixed_case_count = 0;
set global validate_password.number_count = 0;
set global validate_password.special_char_count = 0;
CREATE DATABASE magento;
CREATE USER 'magento'@'%' IDENTIFIED WITH mysql_native_password BY '12345678';
GRANT ALL ON magento.* TO 'magento'@'%';
exit

#==================================================================Install
php==========================================######################################
#
sudo apt install -y php8.3-fpm php8.3-mysql
sudo mkdir /var/www/[Link]
sudo chown -R $USER:$USER /var/www/[Link]
sudo apt-get install -y php8.3-common php8.3-xml php8.3-curl php8.3-bcmath php8.3-
intl php8.3-gd php8.3-zip php8.3-mysql php8.3-soap

#Install
ElasticSearch8#####################################################################
################==========================================#########################
wget -qO - [Link] | sudo gpg --dearmor
-o /usr/share/keyrings/[Link]

sudo apt-get install -y apt-transport-https

echo "deb [signed-by=/usr/share/keyrings/[Link]]


[Link] stable main" | sudo tee
/etc/apt/[Link].d/[Link]

sudo apt-get update && sudo apt-get install elasticsearch=7.17.0

sudo /bin/systemctl daemon-reload


sudo /bin/systemctl enable [Link]
sudo systemctl start [Link]

### Install magento


##################################################################################=
=========================================#######################################
## ------------------------------Remember to add [Link] to /etc/hosts next to
localhost!!!!!!
cd /var/www/[Link]
sudo composer create-project --repository-url=[Link]
magento/project-community-edition=2.4.7-p2 magento
cd /var/www/[Link]/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 :www-data .
sudo chmod u+x bin/magento
##
sudo gedit /etc/nginx/sites-available/[Link] ### Copy server block inside
magento config sample
# --- - -- - -- -- - -- - - - -
upstream fastcgi_backend {
server unix:/var/run/php/[Link];
}
server {
listen 80;
server_name [Link];
set $MAGE_ROOT /var/www/[Link]/magento;
set $MAGE_DEBUG_SHOW_ARGS 0;
include /var/www/[Link]/magento/[Link];
}
# - - -- - - - -- - -
sudo ln -s /etc/nginx/sites-available/[Link] /etc/nginx/sites-enabled/
sudo unlink /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx

#####/admin_l1ooki1
sudo php bin/magento setup:install \
--base-url=[Link] \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=12345678 \
--admin-firstname=Admin \
--admin-lastname=Admin \
--admin-email=admin@[Link] \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=localhost \
--elasticsearch-port=9200

###################################################################################
#################==========================================########################
###############
#Install phpMyAdmin
sudo apt update
sudo apt install -y phpmyadmin
#
sudo ln -s /usr/share/phpmyadmin /var/www/[Link]/magento/pub/hideonbush

pwgen -s 32 1 ## Copy

sudo gedit /etc/phpmyadmin/conf.d/pma_secure.php

### Add this to pma_secure.php file (Optional)


<?php

# PhpMyAdmin Settings
# This should be set to a random string of at least 32 chars
$cfg['blowfish_secret'] = 'CHANGE_THIS_TO_A_STRING_OF_32_RANDOM_CHARACTERS'; ##
Paste

$i=0;
$i++;

$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['AllowRoot'] = false;

?>
#########################

openssl passwd ##Copy Ltuq4wCkk20xE

sudo gedit /etc/nginx/pma_pass ## Write this in file: faker:#paste (format is


username:encryptedpassword)
# ---------------- Add this in module file
location ^~ /hideonbush/ {
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/pma_pass;

location ~ \.php$ {
include snippets/[Link];
fastcgi_pass unix:/var/run/php/[Link];
}
}
# ------------------------------------------------####
sudo nginx -t
sudo systemctl reload nginx

Common questions

Powered by AI

Nginx is used in the installation as the primary web server due to its asynchronicity and scalability, which contribute to high performance and efficient handling of multiple client requests . Nginx's configuration with PHP-FPM supports fast CGI processing, which is crucial for executing PHP scripts efficiently . From a security perspective, Nginx offers features such as access control through 'auth_basic' for Http Basic Authentication and the ability to manage SSL/TLS, providing enhanced protection against unauthorized access . Additionally, Nginx allows traffic management through UFW rules to facilitate secure HTTP, HTTPS, and SSH access .

Enabling a Magento e-commerce site with Nginx involves creating server blocks to handle traffic to the site. The configuration sets the MAGE_ROOT variable to Magento's web root directory, including necessary configuration files such as 'nginx.conf.sample' . Additionally, Nginx security configurations include symbolic linking of enabled sites, disabling the default site link, and enabling URL rewrites to improve site navigation . Security measures include configuring upstream PHP processing using PHP-FPM sockets, using server_name directives to define site domain hosting, and enabling http basic authentication for administrative areas via Nginx .

MySQL configuration for Magento involves the use of the "mysql_secure_installation" script which assists in disabling remote root access, removing anonymous users, and testing databases . Moreover, setting global validate_password policies to low complexity allows flexibility while maintaining basic security measures . Best practices reflected here include limiting user privileges, which is achieved by creating a specific 'magento' user with defined permissions connected to Magento's database, thus adhering to the principle of least privilege .

Critical PHP environment configuration steps for Magento include installing PHP 8.3 with necessary modules such as php8.3-fpm (FastCGI Process Manager), php8.3-mysql (database connectivity), php8.3-soap (SOAP protocol support), php8.3-xml (XML parsing), and php8.3-gd (graphics manipulation). Each component facilitates Magento functionalities: PHP-FPM ensures efficient PHP script execution, php-mysql enables database interactions, soap supports web services essential for third-party integrations, XML handling is critical for data imports and exports, and GD is used for image processing within the Magento framework .

'Composer' is crucial for efficiently managing dependencies and libraries required for large applications like Magento. By using Composer to create a project, the necessary components and libraries are automatically downloaded and configured, reducing manual effort and potential errors . In a Linux environment, Composer leverages package managers to resolve dependencies, ensuring that the PHP environment is fully compatible and up-to-date with Magento's requirements, thereby streamlining installation across different system configurations .

Significant risks of unsecured PhpMyAdmin include unauthorized access to sensitive database information and configuration settings . Mitigation strategies include setting a blowfish secret for encryption, enforcing cookie-based authentication, disallowing root access, and utilizing encrypted passwords in the auth_basic_user_file for Http Basic Authentication via Nginx . An additional risk mitigation step is to use URL aliasing and restricted file location access within Nginx configurations .

OpenJDK provides the Java environment necessary for running Java-based applications and features that may be integrated into a Magento platform, such as search functionalities with ElasticSearch that rely on Java . Packages like dbus-x11 facilitate communication between different system components, ensuring seamless interactions and operations in a multi-user environment, which is essential for the backend operations of Magento . Additionally, tools like 'gedit' and 'composer' support system administration tasks, while 'openssh-server' enables secure remote administration capabilities .

User permissions management in MySQL directly impacts security and performance by controlling access and resource usage. Creating a dedicated Magento user with specific privileges, such as the ability to access only the 'magento' database, minimizes the risk of unauthorized data modification or access beyond its scope . Granting only necessary permissions prevents privilege escalation and maintains database integrity. This approach balances security with performance, as more restricted permissions reduce overhead and potential vectored attacks that can compromise data or system availability .

ElasticSearch installation enhances the search performance and capabilities of a PHP-based e-commerce platform like Magento by providing fast and scalable search capabilities. The system assists in handling large datasets and improves search relevancy due to its full-text search engine . Configuring Magento to use ElasticSearch as a search engine allows for better handling of search requests and enables advanced search functionalities like filtering and aggregating results, which are crucial for a robust e-commerce experience .

To set up a secure Magento installation, several components must be configured: 1) Update and upgrade the system packages . 2) Install necessary tools such as gedit, composer, dbus-x11, openjdk-11-jdk, openssh-server, and Nginx, which is configured to allow HTTP and HTTPS traffic . 3) Install and secure MySQL with "mysql_secure_installation" and configure the database for Magento by altering validation policies and creating user-specific permissions . 4) Install PHP 8.3 with necessary extensions such as php8.3-fpm, php8.3-mysql, php8.3-soap, which are essential for running Magento . 5) Set up ElasticSearch for search functionality within Magento . 6) Configure Magento installation with create-project, adjust permissions, set up server blocks in Nginx, and configure PHP-FPM for Unix socket connectivity . Each component contributes to system architecture: software updates ensure the latest security and feature enhancements; Nginx serves as the web server and load balancer; MySQL manages data storage and retrieval; PHP processes server-side scripting; ElasticSearch optimizes ons

You might also like