Skip to content

diohsu-mrliving/magento

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TOC

Network overview

Linux and Web server setup under GCE

  • 2vCPU with 8GB memory
  • Ubuntu 20.04 LTS with 200 GB capacity

Time zone and ntp

apt-get update
dpkg-reconfigure tzdata
apt-get install ntp

Unzip

apt-get install unzip

Nginx

apt-get -y install nginx

Optional, enable default PHP interpreter

Uncomment the partial commands of the PHP section in /etc/nginx/sites-available/default.

# pass PHP scripts to FastCGI server                                                                       
#                                                                                                          
location ~ \.php$ {                                                                                        
        include snippets/fastcgi-php.conf;                                                                 

        # With php-fpm (or other unix sockets):                                                            
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;                                                    
#       # With php-cgi (or other tcp sockets):                                                             
#       fastcgi_pass 127.0.0.1:9000;                                                                       
}   
apt-get update
apt-get -y install php7.4-fpm php7.4-cli
apt-get install php7.4-fpm php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip php7.4-soap php7.4-bcmath

Check PHP/Nginx services

Restart services

systemctl restart php7.4-fpm.service
systemctl restart nginx.service 

Verify PHP is installed

<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
  • open http://${HOST}/phpinfo.php with a browser

MySQL

  • MySQL v8.0
  • Character set utf8mb4
  • Collation utf8mb4_0900_ai_ci

install mysql-client

apt-get install mysql-client-core-8.0
mysql -h {mysql_server_host} -u ${username} -p --ssl-mode=DISABLED

--ssl-mode=DISABLED stands for an unencrypted connection especially for the legacy versions..

create database magento;
create user 'magento'@'<remote web node server ip address> or %' IDENTIFIED BY 'magento';
GRANT ALL ON magento.* TO 'magento'@'<remote web node server ip address> or %';
flush privileges;

Elasticsearch

sudo apt-get update
sudo apt-get install openjdk-8-jdk
adduser elk
sudo su -l elk
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz
tar -xvf elasticsearch-7.6.2-linux-x86_64.tar.gz

Configuration for production mode

  • Virtual memory
  • elasticsearch.yaml
    network.host: 0.0.0.0
    discovery.seed_hosts: []
    cluster.initial_master_nodes: []
    
Stores > Settings > Configuration > Catalog > Catalog > Catalog Search

Elasticsearch Server Hostname
Elasticsearch Server Port
Elasticsearch Index Prefix

Check and Start ES demon

Check ES demon

sudo su -l elk
jps

// You should see the message below
${PID} Elasticsearch

Start ES demon if you haven't seen the process via the JPS command

sudo su -l elk
cd elasticsearch-7.6.2/
./bin/elasticsearch -d

# check ES alive
curl localhost:9200/_state
  • Add an user as magento file system owner

    sudo adduser <magento_user>
    sudo mkdir -p /var/www/html/magento2
    sudo chown -R <magento_user>:<magento_user> magento2
    
  • Get the Magento package

    • Build versions of compressed archive, under Archive (zip/tar) section.

      • Extract the software on your server
        sudo cp <src path>/magento-ce-2.4.3-p1-2021-09-23-07-56-34.zip /var/www/html/magento2/      
        
        sudo su -l <web server docroot>
        cd /var/www/html/magento2
        unzip magento-ce-2.4.3-p1-2021-09-23-07-56-34.zip
        
    • or Composer

      • Install Latest Composer

      • Create a new Composer project (get the Magento software metapackage)

        sudo su -l <web server docroot>
        cd /var/www/html/magento2      
        composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.3-p1 .
        
      • Deprecated, Install Composer v1.x

        curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
        composer self-update 1.10.16    # downgrade it back to version 1.x due to a recent incompatibility issue with one of the packages.
        
  • Set ownership and permissions

    sudo usermod -a -G www-data <magento_user>
    
    su -l <magento_user>
    cd <magento_root>
    find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
    find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
    chown -R :www-data .
    chmod u+x bin/magento
    
  • Config the Server Block of Nginx

    • nginx server configuration

      • /etc/nginx/sites-available/magento
      upstream fastcgi_backend {
          server  unix:/run/php/php7.4-fpm.sock;
      }
      
      server {
          listen 80;
      #    server_name www.magento-dev.com;
          set $MAGE_ROOT /var/www/html/magento2;
          include /var/www/html/magento2/nginx.conf.sample;
      }
      
    • ln -s /etc/nginx/sites-available/magento /etc/nginx/sites-enabled

    • rm /etc/nginx/sites-enabled/default

./bin/magento setup:install --base-url=http://${m2_host}/ --db-host=${db_host} --db-name=${db_name} --db-user=${db_user} --db-password=${dp_pass} --admin-firstname=Magento --admin-lastname=User [email protected] --admin-user=${admin_name} --admin-password=${admin_pass} --language=zh_Hant_TW --currency=TWD --timezone=Asia/Taipei --use-rewrites=1
  • magento info:language:list
  • magento info:currency:list
  • magento info:timezone:list
rm -rf ${magento_root}/pub/static/*
./bin/magento setup:static-content:deploy

Tax configuration

  • Magento 2 Redis Configuration

  • check redis setting
    redis-cli -p REDIS_PORT -h REDIS_HOST info | egrep --color "(role|used_memory_peak|maxmemory|evicted_keys|uptime_in_days)"

  • restart redis
    service redis-server restart

Magento extension module installation

3rd-party extensions

  • see Notion

  • Simple Chinese Language Pack

    • unzip the zip package into /${M2_ROOT}/app/i18n/Sunflowerbiz/zh_hans_cn/
    • magento setup:upgrade
    • enable in front-end
      • backend console STORES/ Configuration/ GENERAL/ General/ Locale Options/ Locale/ Chinese (Simplified Han, China) and click Save Config
    • enable in backend
      • backend console SYSTEM/ ALL USERS/ click an user/ Interface Locale/ Chinese (Simplified Han, China)
  • The Most Popular SMTP for Magento 2

    • installation guide
      composer require mageplaza/module-smtp  
      php bin/magento setup:upgrade
      php bin/magento setup:static-content:deploy
      
  • Magento 2 Currency Formatter extension

    composer require mageplaza/module-currency-formatter
    php bin/magento setup:upgrade
    php bin/magento setup:static-content:deploy
    
  • Order Editor

    • prerequisites

      composer require matomo/device-detector  
      magento setup:upgrade
      
    • download & unzip the package to ${M2_Base}/app/code/MageWorx

    • enable modules

      ./bin/magento module:enable MageWorx_Info MageWorx_OrdersBase MageWorx_OrderEditor
      ./bin/magento setup:upgrade
      
  • Magento 2 PDF Customizer

    • prerequisites
      • mPDF
        composer require mpdf/mpdf
        
  • Facebook Business Extension

    • install guide
    • 注意事項: 記得要照安裝手冊中的把 php-business-sdk 裝起來。

Command line interface

Install the Composer update plugin

composer require magento/composer-root-update-plugin=~1.0 --no-update TODO ...

Setup GCP CDN (Alpha)

Change the base URLs for Static View Files and User Media Files

Reference

Extension

Theme

Connector, evaluation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published