Install Magento eCommerce Platform on CentOS 8 - CentLinux

Latest

Sunday, 13 December 2020

Install Magento eCommerce Platform on CentOS 8

install-magento-ecommerce-platform-on-centos-8

Magento is an open source eCommerce platform. This guide will show you how to install Magento eCommerce Platform on CentOS 8.

 

Table of Contents:

     

    What is Magento ? :

    Magento is an open source eCommerce platform written in PHP by using multiple PHP frameworks such as Laminas and Symfony.

    Magento was acquired by Adobe Inc. in May 2018. Magento software is available in Magento Enterprise and Community editions. Enterprise edition is named as Magento Commerce and has a license fee, but offer many Enterprise level features. Check out the complete Magento Pricing.

    Whereas, Community edition is named as Magento Open Source, which is free and distributed under Open Software License (OSL) v3.0. It’s source code is available at Magento Github.

     

    Magento Features:

    Some of the popular features in Magento eCommerce Platform are:

    • Page Builder
    • Product Recommendations
    • Customer Segmentation and Personalization
    • Asset and Content Management
    • Content Staging and Preview
    • Instant Purchase
    • Dynamic Rule-Based Product Relations
    • Visual Merchandising
    • Elasticsearch
    • Powerful Admin Experience

    Complete details about each feature is available on Magento website .

    You can also view the feature comparison of Magento Commerce and Magento Open Source here.

     

    Environment Specification:

    We are using a minimal CentOS 8 virtual machine with following specifications.

    • CPU - 3.4 Ghz (2 cores)
    • Memory - 2 GB
    • Storage - 20 GB
    • Operating System - CentOS 8.2
    • Hostname – magento-2.centlinux.com
    • IP Address - 192.168.116.230 /24

     

    Update Linux Server Packages :

    Connect with magento-2.centlinux.com as root user by using a SSH client.

    It is a best practice to update your Linux server packages before installing any new software. Therefore, execute the dnf command and update installed software packages on CentOS 8.

    [root@magento-2 ~]# dnf update -y Last metadata expiration check: 0:00:40 ago on Thu 03 Dec 2020 08:47:52 PM PKT. Dependencies resolved. Nothing to do. Complete!

    Our Linux server is already up-to-date, therefore, no package is updated this time. The output may vary on your CentOS 8 server.

    Verify the Linux operating system and updated Kernel versions.

    [root@magento-2 ~]# uname -r 4.18.0-193.28.1.el8_2.x86_64 [root@magento-2 ~]# cat /etc/redhat-release CentOS Linux release 8.2.2004 (Core)

     

    Installing Magento Software Prerequisites:

    Magento requires following prerequisite software.

    • Nginx or Apache Web Server
    • PHP (7.3 or later)
    • MySQL Database Server
    • ElasticSearch

    Apache, PHP and MySQL are available in standard yum repositories, therefore, you can install all of them with a single dnf command.

    [root@magento-2 ~]# dnf install -y httpd mariadb-server @php:7.3 mod_ssl wget unzip ... Installed: apr-1.6.3-9.el8.x86_64 apr-util-1.6.1-6.el8.x86_64 apr-util-bdb-1.6.1-6.el8.x86_64 apr-util-openssl-1.6.1-6.el8.x86_64 centos-logos-httpd-80.5-2.el8.noarch dejavu-fonts-common-2.35-6.el8.noarch dejavu-sans-fonts-2.35-6.el8.noarch fontconfig-2.13.1-3.el8.x86_64 fontpackages-filesystem-1.44-22.el8.noarch gd-2.2.5-6.el8.x86_64 httpd-2.4.37-21.module_el8.2.0+494+1df74eae.x86_64 httpd-filesystem-2.4.37-21.module_el8.2.0+494+1df74eae.noarch httpd-tools-2.4.37-21.module_el8.2.0+494+1df74eae.x86_64 jbigkit-libs-2.1-14.el8.x86_64 libX11-1.6.8-3.el8.x86_64 libX11-common-1.6.8-3.el8.noarch libXau-1.0.8-13.el8.x86_64 libXpm-3.5.12-8.el8.x86_64 libjpeg-turbo-1.5.3-10.el8.x86_64 libtiff-4.0.9-17.el8.x86_64 libwebp-1.0.0-1.el8.x86_64 libxcb-1.13.1-1.el8.x86_64 libzip-1.5.1-2.module_el8.2.0+313+b04d0a66.x86_64 mailcap-2.1.48-3.el8.noarch mariadb-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-backup-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-common-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-connector-c-3.0.7-1.el8.x86_64 mariadb-connector-c-config-3.0.7-1.el8.noarch mariadb-errmsg-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-gssapi-server-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-server-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-server-utils-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mod_http2-1.11.3-3.module_el8.2.0+486+c01050f0.1.x86_64 mod_ssl-1:2.4.37-21.module_el8.2.0+494+1df74eae.x86_64 nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch perl-Carp-1.42-396.el8.noarch perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64 perl-DBI-1.641-3.module_el8.1.0+199+8f0a6bbd.x86_64 perl-Data-Dumper-2.167-399.el8.x86_64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.x86_64 perl-Encode-4:2.97-3.el8.x86_64 perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Socket-SSL-2.066-4.el8.noarch perl-MIME-Base64-3.15-396.el8.x86_64 perl-Math-BigInt-1:1.9998.11-7.el8.noarch perl-Math-Complex-1.59-416.el8.noarch perl-Mozilla-CA-20160104-7.el8.noarch perl-Net-SSLeay-1.88-1.el8.x86_64 perl-PathTools-3.74-1.el8.x86_64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 perl-Socket-4:2.027-3.el8.x86_64 perl-Storable-1:3.11-3.el8.x86_64 perl-Term-ANSIColor-4.06-396.el8.noarch perl-Term-Cap-1.17-395.el8.noarch perl-Text-ParseWords-3.30-395.el8.noarch perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Time-Local-1:1.280-1.el8.noarch perl-URI-1.73-3.el8.noarch perl-Unicode-Normalize-1.25-396.el8.x86_64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.x86_64 perl-libnet-3.11-3.el8.noarch perl-libs-4:5.26.3-416.el8.x86_64 perl-macros-4:5.26.3-416.el8.x86_64 perl-parent-1:0.237-1.el8.noarch perl-podlators-4.11-1.el8.noarch perl-threads-1:2.21-2.el8.x86_64 perl-threads-shared-1.58-2.el8.x86_64 php-bcmath-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-common-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-gd-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-intl-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-json-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-mbstring-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-mysqlnd-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-opcache-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-pdo-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-pecl-zip-1.15.4-1.module_el8.2.0+314+53b99e08.x86_64 php-soap-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-xml-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-cli-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 php-fpm-7.3.20-1.module_el8.2.0+498+4deef2f1.x86_64 psmisc-23.1-4.el8.x86_64 sscg-2.3.3-14.el8.x86_64 unzip-6.0-43.el8.x86_64 Complete!

    Configure PHP settings as required by Magento eCommerce platform.

    [root@magento-2 ~]# vi /etc/php.ini

    Locate and adjust following parameter in this file.

    memory_limit = 1024M

    Enable and start Apache, MySQL and PHP services.

    [root@magento-2 ~]# systemctl enable --now mariadb.service httpd.service php-fpm.service Created symlink /etc/systemd/system/mysql.service â /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/mysqld.service â /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service â /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service â /usr/lib/systemd/system/httpd.service. Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service â /usr/lib/systemd/system/php-fpm.service.

    Configure MySQL database server security as follows.

    [root@magento-2 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!

     

    Configure Linux Firewall for Magento :

    Configure Linux firewall to allow incoming traffic to HTTP service port. You can add http service or port 80/tcp in Linux firewall.

    [root@magento-2 ~]# firewall-cmd --permanent --add-service=http success [root@magento-2 ~]# firewall-cmd --reload success

     

    Create Linux User and Directory for Magento :

    Create a Linux user to own Magento directory and files.

    [root@magento-2 ~]# adduser magento [root@magento-2 ~]# usermod -a -G apache magento

    Create a directory for deploying Magento eCommerce software.

    [root@magento-2 ~]# mkdir /var/www/magento [root@magento-2 ~]# chown magento:apache /var/www/magento

     

    Create MySQL Database for Magento :

    Magento uses MySQL as its backend database. You have already installed MariaDB on your Linux server. Now, login to MySQL shell as root user.

    [root@magento-2 ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 10.3.17-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>

    Create a MySQL database for Magento eCommerce software.

    MariaDB [(none)]> CREATE DATABASE magentodb; Query OK, 1 row affected (0.001 sec)

    Grant all privileges on magentodb database to magento user. This command also creates the magento user, if not already created.

    MariaDB [(none)]> GRANT ALL ON magentodb.* TO magento@localhost IDENTIFIED BY 'Str0ngP@ssw0rd'; Query OK, 0 rows affected (0.001 sec)

    Exit from MySQL shell.

    MariaDB [(none)]> exit Bye

     

    Installing ElasticSearch on Linux server :

    Starting from Magento 2.4.0, ElasticSearch is now used for search. Therefore, you are also required to install ElasticSearch on your Linux server.

    ElasticSearch needs Java Runtime, therefore, before installing ElasticSearch you have to install OpenJDK on your CentOS 8 machine.

    [root@magento-2 ~]# dnf install -y java-11-openjdk ... Installed: abattis-cantarell-fonts-0.0.25-4.el8.noarch adwaita-cursor-theme-3.28.0-2.el8.noarch adwaita-icon-theme-3.28.0-2.el8.noarch at-spi2-atk-2.26.2-1.el8.x86_64 at-spi2-core-2.28.0-1.el8.x86_64 cairo-gobject-1.15.12-3.el8.x86_64 colord-libs-1.4.2-1.el8.x86_64 dconf-0.28.0-3.el8.x86_64 dejavu-sans-mono-fonts-2.35-6.el8.noarch glib-networking-2.56.1-1.1.el8.x86_64 gsettings-desktop-schemas-3.32.0-5.el8.x86_64 gtk3-3.22.30-6.el8.x86_64 java-11-openjdk-1:11.0.9.11-2.el8_3.x86_64 java-11-openjdk-headless-1:11.0.9.11-2.el8_3.x86_64 json-glib-1.4.4-1.el8.x86_64 lcms2-2.9-2.el8.x86_64 libepoxy-1.5.3-1.el8.x86_64 libgusb-0.3.0-1.el8.x86_64 libmodman-2.0.1-17.el8.x86_64 libproxy-0.4.15-5.2.el8.x86_64 libsoup-2.62.3-2.el8.x86_64 libwayland-client-1.17.0-1.el8.x86_64 libwayland-cursor-1.17.0-1.el8.x86_64 libwayland-egl-1.17.0-1.el8.x86_64 rest-0.8.1-2.el8.x86_64 Complete!

    Verify the Java version of installed software.

    [root@magento-2 ~]# java -version openjdk version "11.0.9" 2020-10-20 LTS OpenJDK Runtime Environment 18.9 (build 11.0.9+11-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.9+11-LTS, mixed mode, sharing)

    Import the ElasticSearch GPG key by using rpm command.

    [root@magento-2 ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

    Create a Yum repository file by using vi text editor.

    [root@magento-2 ~]# vi /etc/yum.repos.d/elasticsearch.repo

    Add following directives in this repo file.

    [elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md

    You can now easily install ElasticSearch on your Linux server by using dnf command.

    [root@magento-2 ~]# dnf install -y --enablerepo=elasticsearch elasticsearch Last metadata expiration check: 21:33:08 ago on Mon 07 Dec 2020 10:23:12 PM PKT. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: elasticsearch x86_64 7.10.0-1 elasticsearch 304 M Transaction Summary ================================================================================ Install 1 Package Total download size: 304 M Installed size: 510 M Downloading Packages: elasticsearch-7.10.0-x86_64.rpm 243 kB/s | 304 MB 21:18 -------------------------------------------------------------------------------- Total 243 kB/s | 304 MB 21:18 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: elasticsearch-7.10.0-1.x86_64 1/1 Creating elasticsearch group... OK Creating elasticsearch user... OK Installing : elasticsearch-7.10.0-1.x86_64 1/1 Running scriptlet: elasticsearch-7.10.0-1.x86_64 1/1 ### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd sudo systemctl daemon-reload sudo systemctl enable elasticsearch.service ### You can start elasticsearch service by executing sudo systemctl start elasticsearch.service Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore Verifying : elasticsearch-7.10.0-1.x86_64 1/1 Installed: elasticsearch-7.10.0-1.x86_64 Complete!

    Since, we are installing on a virtual machine with limited memory. Therefore, we are reducing the Java virtual machine (JVM) memory options as follows.

    Open jvm.option file in vi text editor.

    [root@magento-2 ~]# vi /etc/elasticsearch/jvm.options

    Find and adjust following parameters therein.

    -Xms256m -Xmx512m

    Enable and start ElasticSearch service.

    [root@magento-2 ~]# systemctl enable --now elasticsearch.service Synchronizing state of elasticsearch.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable elasticsearch Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service â /usr/lib/systemd/system/elasticsearch.service.

     

    Install Composer on CentOS 8:

    Composer is a dependency manager for PHP. Currently, the Composer v2.0 is available on the Internet. But Magento 2.4.1 does not supports it. Therefore, you have to use Composer v1.0 for your Linux server.

    Download the Composer using wget command.

    [root@magento-2 ~]# wget https://getcomposer.org/composer-1.phar --2020-12-05 18:53:38-- https://getcomposer.org/composer-1.phar Resolving getcomposer.org (getcomposer.org)... 142.44.245.229, 2607:5300:201:2100::4:d105 Connecting to getcomposer.org (getcomposer.org)|142.44.245.229|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1999995 (1.9M) [application/octet-stream] Saving to: âcomposer-1.pharâ composer-1.phar 100%[===================>] 1.91M 63.0KB/s in 29s 2020-12-05 18:54:11 (67.6 KB/s) - âcomposer-1.pharâ saved [1999995/1999995]

    Add execute permissions to composer file and copy it in /usr/local/bin directory, so users can run it from any location.

    [root@magento-2 ~]# chmod +x composer-1.phar [root@magento-2 ~]# mv composer-1.phar /usr/local/bin/composer

     

    Installing Magento Open Source on CentOS 8:

    You can now use composer to install the Magento Open Source edition as follows.

    Note: You may be asked to provide a Username/Password during installation of Magento eCommerce software. The username is the Public Key and Password is the Private Key. These Public/Private keys can be generated at Magento Marketplace website. You are required to sign-up/sign-in to generate keys.

    [root@magento-2 ~]# composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /var/www/magento Creating a "magento/project-community-edition" project at "/var/www/magento" Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html Authentication required (repo.magento.com): Username: 266b35923a518acdacd9fd4680ca29a0 Password: Do you want to store credentials for repo.magento.com in /home/magento/.config/composer/auth.json ? [Yn] Y Installing magento/project-community-edition (2.4.1) - Installing magento/project-community-edition (2.4.1): Loading from cache Created project in /var/www/magento Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 554 installs, 0 updates, 0 removals - Installing magento/magento-composer-installer (0.1.13): Downloading (100%) - Installing laminas/laminas-dependency-plugin (1.0.4): Downloading (100%) - Installing psr/container (1.0.0): Downloading (100%) - Installing container-interop/container-interop (1.2.0): Downloading (100%) - Installing laminas/laminas-zendframework-bridge (1.1.1): Downloading (100%) - Installing laminas/laminas-stdlib (3.3.1): Downloading (100%) - Installing laminas/laminas-validator (2.13.4): Downloading (100%) - Installing laminas/laminas-escaper (2.7.0): Downloading (100%) - Installing laminas/laminas-uri (2.8.0): Downloading (100%) - Installing psr/http-message (1.0.1): Downloading (100%) - Installing laminas/laminas-diactoros (1.8.7p2): Downloading (100%) - Installing laminas/laminas-loader (2.6.1): Downloading (100%) - Installing laminas/laminas-http (2.13.0): Downloading (100%) - Installing laminas/laminas-psr7bridge (0.2.2): Downloading (100%) - Installing laminas/laminas-hydrator (2.4.2): Downloading (100%) - Installing laminas/laminas-servicemanager (2.7.11): Downloading (100%) - Installing laminas/laminas-filter (2.9.4): Downloading (100%) - Installing laminas/laminas-inputfilter (2.10.1): Downloading (100%) - Installing laminas/laminas-form (2.15.0): Downloading (100%) - Installing laminas/laminas-eventmanager (3.3.0): Downloading (100%) - Installing laminas/laminas-code (3.4.1): Downloading (100%) - Installing laminas/laminas-console (2.8.0): Downloading (100%) - Installing laminas/laminas-mvc (2.7.15): Downloading (100%) - Installing laminas/laminas-math (2.7.1): Downloading (100%) - Installing laminas/laminas-crypt (2.6.0): Downloading (100%) - Installing tedivm/jshrink (v1.3.3): Downloading (100%) - Installing symfony/polyfill-mbstring (v1.20.0): Downloading (100%) - Installing psr/log (1.1.3): Downloading (100%) - Installing monolog/monolog (1.25.5): Downloading (100%) - Installing magento/zendframework1 (1.14.5): Downloading (100%) - Installing symfony/process (v4.4.17): Downloading (100%) - Installing symfony/polyfill-ctype (v1.20.0): Downloading (100%) - Installing symfony/service-contracts (v2.2.0): Downloading (100%) - Installing symfony/polyfill-php80 (v1.20.0): Downloading (100%) - Installing symfony/polyfill-php73 (v1.20.0): Downloading (100%) - Installing symfony/console (v4.4.17): Downloading (100%) - Installing seld/phar-utils (1.1.1): Downloading (100%) - Installing seld/jsonlint (1.8.3): Downloading (100%) - Installing justinrainbow/json-schema (5.2.10): Downloading (100%) - Installing composer/xdebug-handler (1.4.5): Downloading (100%) - Installing composer/spdx-licenses (1.5.5): Downloading (100%) - Installing composer/semver (1.7.2): Downloading (100%) - Installing composer/ca-bundle (1.2.8): Downloading (100%) - Installing symfony/finder (v5.2.0): Downloading (100%) - Installing symfony/filesystem (v5.2.0): Downloading (100%) - Installing symfony/polyfill-intl-normalizer (v1.20.0): Downloading (100%) - Installing composer/composer (1.10.6): Downloading (100%) - Installing colinmollenhour/credis (1.11.1): Downloading (100%) - Installing colinmollenhour/php-redis-session-abstract (v1.4.3): Downloading (100%) - Installing ralouphie/getallheaders (3.0.3): Downloading (100%) - Installing guzzlehttp/psr7 (1.7.0): Downloading (100%) - Installing guzzlehttp/promises (1.4.0): Downloading (100%) - Installing symfony/polyfill-php72 (v1.20.0): Downloading (100%) - Installing symfony/polyfill-intl-idn (v1.20.0): Downloading (100%) - Installing paragonie/random_compat (v9.99.99): Downloading (100%) - Installing guzzlehttp/guzzle (6.5.5): Downloading (100%) - Installing laminas/laminas-mime (2.7.4): Downloading (100%) - Installing true/punycode (v2.1.1): Downloading (100%) - Installing laminas/laminas-mail (2.12.3): Downloading (100%) - Installing wikimedia/less.php (1.8.2): Downloading (100%) - Installing ramsey/uuid (3.8.0): Downloading (100%) - Installing magento/framework (103.0.1): Downloading (100%) - Installing magento/inventory-composer-installer (1.1.0): Downloading (100%) - Installing magento/composer-root-update-plugin (1.0.0): Downloading (100%) Installing "magento/composer-root-update-plugin: 1.0.0" for the Web Setup Wizard Loading composer repositories with package information Updating dependencies Package operations: 23 installs, 0 updates, 0 removals - Installing symfony/polyfill-ctype (v1.20.0): Loading from cache - Installing psr/container (1.0.0): Loading from cache - Installing symfony/service-contracts (v2.2.0): Loading from cache - Installing symfony/polyfill-php80 (v1.20.0): Loading from cache - Installing symfony/polyfill-php73 (v1.20.0): Loading from cache - Installing symfony/polyfill-mbstring (v1.20.0): Loading from cache - Installing psr/log (1.1.3): Loading from cache - Installing seld/phar-utils (1.1.1): Loading from cache - Installing seld/jsonlint (1.8.3): Loading from cache - Installing justinrainbow/json-schema (5.2.10): Loading from cache - Installing composer/xdebug-handler (1.4.5): Loading from cache - Installing composer/spdx-licenses (1.5.5): Loading from cache - Installing composer/semver (1.7.2): Loading from cache - Installing composer/ca-bundle (1.2.8): Loading from cache - Installing symfony/process (v5.2.0): Downloading (100%) - Installing symfony/finder (v5.2.0): Loading from cache - Installing symfony/filesystem (v5.2.0): Loading from cache - Installing symfony/polyfill-intl-normalizer (v1.20.0): Loading from cache - Installing symfony/polyfill-intl-grapheme (v1.20.0): Downloading (100%) - Installing symfony/string (v5.2.0): Downloading (100%) - Installing symfony/console (v5.2.0): Downloading (100%) - Installing composer/composer (1.10.6): Loading from cache - Installing magento/composer-root-update-plugin (1.0.0): Loading from cache Writing lock file Generating autoload files 18 packages you are using are looking for funding. Use the `composer fund` command to find out more! - Installing squizlabs/php_codesniffer (3.5.8): Downloading (100%) - Installing dealerdirect/phpcodesniffer-composer-installer (v0.5.0): Downloading (100%) - Installing laminas/laminas-di (2.6.1): Downloading (100%) - Installing psr/cache (1.0.1): Downloading (100%) - Installing symfony/polyfill-intl-grapheme (v1.20.0): Loading from cache - Installing symfony/string (v5.2.0): Loading from cache - Installing symfony/polyfill-php70 (v1.20.0) - Installing laminas/laminas-session (2.10.0): Downloading (100%) - Installing laminas/laminas-db (2.11.3): Downloading (100%) - Installing laminas/laminas-captcha (2.9.0): Downloading (100%) - Installing magento/module-user (101.2.1): Downloading (100%) - Installing magento/module-ui (101.2.1): Downloading (100%) - Installing magento/module-variable (100.4.0): Downloading (100%) - Installing magento/module-widget (101.2.1): Downloading (100%) - Installing magento/module-store (101.1.1): Downloading (100%) - Installing magento/module-require-js (100.4.0): Downloading (100%) - Installing magento/module-backend (102.0.1): Downloading (100%) - Installing magento/module-authorization (100.4.1): Downloading (100%) - Installing magento/framework-bulk (101.0.0): Downloading (100%) - Installing magento/framework-message-queue (100.4.1): Downloading (100%) - Installing magento/module-asynchronous-operations (100.4.1): Downloading (100%) - Installing magento/module-theme (101.1.1): Downloading (100%) - Installing magento/module-wishlist (101.2.1): Downloading (100%) - Installing magento/module-tax (100.4.1): Downloading (100%) - Installing magento/module-shipping (100.4.1): Downloading (100%) - Installing magento/module-sales-sequence (100.4.1): Downloading (100%) - Installing magento/module-captcha (100.4.1): Downloading (100%) - Installing magento/module-sales-rule (101.2.1): Downloading (100%) - Installing magento/module-sales (103.0.1): Downloading (100%) - Installing magento/module-media-storage (100.4.0): Downloading (100%) - Installing magento/module-config (101.2.1): Downloading (100%) - Installing magento/module-email (101.1.1): Downloading (100%) - Installing magento/module-url-rewrite (102.0.1): Downloading (100%) - Installing magento/module-quote (101.2.1): Downloading (100%) - Installing magento/module-directory (100.4.1): Downloading (100%) - Installing magento/module-checkout (100.4.1): Downloading (100%) - Installing magento/module-payment (100.4.1): Downloading (100%) - Installing magento/module-catalog (104.0.1): Downloading (100%) - Installing magento/module-eav (102.1.1): Downloading (100%) - Installing magento/module-page-cache (100.4.1): Downloading (100%) - Installing magento/module-customer (103.0.1): Downloading (100%) - Installing magento/module-cms (104.0.1): Downloading (100%) - Installing magento/module-newsletter (100.4.1): Downloading (100%) - Installing magento/module-security (100.4.1): Downloading (100%) - Installing magento/module-integration (100.4.1): Downloading (100%) - Installing magento/module-catalog-inventory (100.4.1): Downloading (100%) - Installing magento/module-product-alert (100.4.1): Downloading (100%) - Installing magento/module-gift-message (100.4.0): Downloading (100%) - Installing magento/module-downloadable (100.4.1): Downloading (100%) - Installing magento/module-msrp (100.4.0): Downloading (100%) - Installing magento/module-indexer (100.4.1): Downloading (100%) - Installing magento/module-import-export (101.0.1): Downloading (100%) - Installing magento/module-catalog-url-rewrite (100.4.1): Downloading (100%) - Installing magento/module-catalog-import-export (101.1.1): Downloading (100%) - Installing magento/module-rule (100.4.0): Downloading (100%) - Installing magento/module-catalog-rule (101.2.1): Downloading (100%) - Installing magento/module-cms-url-rewrite (100.4.1): Downloading (100%) - Installing magento/module-deploy (100.4.1): Downloading (100%) - Installing magento/module-cron (100.4.1): Downloading (100%) - Installing magento/module-review (100.4.1): Downloading (100%) - Installing magento/module-reports (100.4.1): Downloading (100%) - Installing magento/module-bundle (101.0.1): Downloading (100%) - Installing magento/module-contact (100.4.1): Downloading (100%) - Installing magento/module-rss (100.4.0): Downloading (100%) - Installing magento/module-developer (100.4.1): Downloading (100%) - Installing magento/module-translation (100.4.1): Downloading (100%) - Installing magento/module-backup (100.4.1): Downloading (100%) - Installing magento/module-webapi (100.4.0): Downloading (100%) - Installing magento/module-graph-ql (100.4.1): Downloading (100%) - Installing magento/module-customer-graph-ql (100.4.1): Downloading (100%) - Installing magento/module-quote-graph-ql (100.4.1): Downloading (100%) - Installing paypal/module-braintree (4.2.0) - Installing league/iso3166 (2.1.5): Downloading (100%) - Installing magento/module-vault (101.2.1): Downloading (100%) - Installing magento/module-instant-purchase (100.4.0): Downloading (100%) - Installing magento/module-paypal (101.0.1): Downloading (100%) - Installing paypal/module-braintree-graph-ql (4.1.1): Downloading (100%) - Installing braintree/braintree_php (5.2.0): Downloading (100%) - Installing paypal/module-braintree-core (4.2.0): Downloading (100%) - Installing magento/google-shopping-ads (4.0.1): Downloading (100%) - Installing vertex/sdk (1.2.7): Downloading (100%) - Installing vertex/module-tax (4.1.0): Downloading (100%) - Installing vertex/module-address-validation-api (1.0.0): Downloading (100%) - Installing vertex/module-address-validation (2.1.0): Downloading (100%) - Installing vertex/product-magento-module (4.1.0) - Installing magento/module-adobe-ims-api (2.1.0): Downloading (100%) - Installing magento/module-adobe-ims (2.1.0): Downloading (100%) - Installing magento/adobe-ims (2.1.0) - Installing magento/module-adobe-stock-image-api (1.2.0): Downloading (100%) - Installing magento/module-media-gallery-api (101.0.1): Downloading (100%) - Installing magento/module-media-content-api (100.4.1): Downloading (100%) - Installing magento/module-media-gallery-synchronization-api (100.4.0): Downloading (100%) - Installing magento/module-media-gallery-metadata-api (100.4.0): Downloading (100%) - Installing magento/module-media-gallery-ui-api (100.4.0): Downloading (100%) - Installing magento/module-media-gallery-ui (100.4.0): Downloading (100%) - Installing magento/module-adobe-stock-client-api (2.0.0): Downloading (100%) - Installing magento/module-adobe-stock-asset-api (1.2.0): Downloading (100%) - Installing magento/module-adobe-stock-image-admin-ui (1.2.0): Downloading (100%) - Installing magento/module-adobe-stock-image (1.2.0): Downloading (100%) - Installing astock/stock-api-libphp (1.1.4): Downloading (100%) - Installing magento/module-adobe-stock-client (1.2.0): Downloading (100%) - Installing magento/module-media-gallery (100.4.1): Downloading (100%) - Installing magento/module-adobe-stock-asset (1.2.0): Downloading (100%) - Installing magento/module-adobe-stock-admin-ui (1.2.0): Downloading (100%) - Installing magento/adobe-stock-integration (2.1.0) - Installing magento/module-inventory-api (1.1.0): Downloading (100%) ... ... ... codeception/codeception suggests installing stecman/symfony-console-completion (For BASH autocompletion) codeception/module-webdriver suggests installing codeception/phpbuiltinserver (Start and stop PHP built-in web server for your tests) aws/aws-sdk-php suggests installing aws/aws-php-sns-message-validator (To validate incoming SNS notifications) symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration) symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them) phpcompatibility/php-compatibility suggests installing roave/security-advisories (dev-master || Helps prevent installing dependencies with known security issues.) Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead. Package sebastian/finder-facade is abandoned, you should avoid using it. No replacement was suggested. Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested. Writing lock file Generating autoload files 87 packages you are using are looking for funding. Use the `composer fund` command to find out more! PHP CodeSniffer Config installed_paths set to ../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility

    Adjust file permissions of Magento files as follows.

    [root@magento-2 ~]# cd /var/www/magento [root@magento-2 magento]# find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + [root@magento-2 magento]# find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} + [root@magento-2 magento]# chown -R magento:apache /var/www/magento/ [root@magento-2 magento]# chmod u+x bin/magento

    Adjust SELinux file contexts and booleans.

    [root@magento-2 magento]# restorecon -R /var/www/magento [root@magento-2 magento]# setsebool -P httpd_unified 1

    Create Apache virtual host configurations for Magento.

    [root@magento-2 magento]# vi /etc/httpd/conf.d/magento.conf

    And add following directives in this file.

    <VirtualHost *:80> ServerName magento-2.centlinux.com DocumentRoot /var/www/magento ErrorLog /var/log/httpd/magento_error.log CustomLog /var/log/httpd/magento_access.log combined <Directory /var/www/magento > Options FollowSymLinks AllowOverride All </Directory> </VirtualHost>

    Restart Apache service to load newly added configurations.

    [root@magento-2 magento]# systemctl restart httpd.service

    Magento web setup is no longer available in Magento 2.4.0 (or later). You must use Magento Command Line to install it.

    [root@magento-2 ~]# php /var/www/magento/bin/magento setup:install \ > --base-url="http://magento-2.centlinux.com/magento/" \ > --db-host="localhost" \ > --db-name="magentodb" \ > --db-user="magento" \ > --db-password="Str0ngP@ssw0rd" \ > --search-engine="elasticsearch7" \ > --admin-firstname="admin" \ > --admin-lastname="admin" \ > --admin-email="admin@centlinux.com" \ > --admin-user="admin" \ > --admin-password="Ahmer@1234" \ > --language="en_US" \ > --currency="USD" \ > --timezone="America/Chicago" \ > --use-rewrites="1" \ > --backend-frontname="admin" Starting Magento installation: File permissions check... [Progress: 1 / 1270] Required extensions check... [Progress: 2 / 1270] Enabling Maintenance Mode... [Progress: 3 / 1270] Installing deployment configuration... [Progress: 4 / 1270] Installing database schema: Schema creation/updates: Module 'Magento_AdminAnalytics': [Progress: 5 / 1270] Module 'Magento_Store': [Progress: 6 / 1270] Module 'Magento_AdobeIms': [Progress: 7 / 1270] Module 'Magento_AdobeImsApi': [Progress: 8 / 1270] Module 'Magento_AdobeStockAdminUi': [Progress: 9 / 1270] ... [Progress: 1264 / 1270] Enabling caches: Current status: layout: 1 block_html: 1 full_page: 1 [Progress: 1265 / 1270] Installing admin user... [Progress: 1266 / 1270] Caches clearing: Cache cleared successfully [Progress: 1267 / 1270] Disabling Maintenance Mode: [Progress: 1268 / 1270] Post installation file permissions check... For security, remove write permissions from these directories: '/var/www/magento/app/etc' [Progress: 1269 / 1270] Write installation date... [Progress: 1270 / 1270] [SUCCESS]: Magento installation complete. [SUCCESS]: Magento Admin URI: /admin Nothing to import.

    Adjust SELinux file contexts for following Magento directories.

    [root@magento-2 magento]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/magento/var(/.*)?' [root@magento-2 magento]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/magento/generated(/.*)?' [root@magento-2 magento]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/magento/vendor(/.*)?' [root@magento-2 magento]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/magento/pub/static(/.*)?' [root@magento-2 magento]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/magento/pub/media(/.*)?' [root@magento-2 magento]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/magento/app/etc(/.*)?' [root@magento-2 magento]# restorecon -R /var/www/magento

    Magento Open Source has been installed.

     

    Conclusion:

    In this guide, you have successfully installed Magento eCommerce Platform on CentOS 8. Now its time to read Magento 2 Developer's Guide by Packt Publishing, if you want to start developing your eCommerce website.

    No comments:

    Post a comment