Home / How To / How to install X-Cart eCommerce platform on Debian 10

How to install X-Cart eCommerce platform on Debian 10



X-Cart is an extremely flexible open source e-commerce platform with lots of features and integrations. X-Cart source code is hosted on Github. This guide describes the process of installing X-Cart 5 on Debian 10 using Nginx as a web server and MariaDB as a database server.

Requirements

  • PHP version 7.2 or higher
  • PHP extension: pdo phar mysql mbstring curl
  • MySQL version 5.7.7 or higher or MariaDB equivalent [19659004] Nginx

Initial step

Check your Debian version:

  lsb_release -ds 

Set time zone:

  sudo dpkg-reconfigure tzdata 

Update your operative system (software). This is an important first step as it ensures that you have the latest updates and security fixes for your operating system's standard software packages:

  sudo apt update && sudo apt upgrade -y 

Install some important packages necessary for basic administration of Debian's operating system :

  sudo apt install -y curl wim git unzip socat bash-finishing 

Step 1
– Install PHP and PHP extensions

Install PHP as well as necessary PHP extensions:

  sudo apt install -y php php-cli php-fpm php-common php-mbstring php-curl php-mysql php-json php-xml php-phar php-pdo php-gd 

To display PHP compiled in modules, you can run:

   php -m 

ctype
curl
exif
fileinfo
. . .
. . .

Check the PHP version:

   php - version  # PHP 7.3.17-0debian0.18.04.1 (cli) (built: April 18, 2019 14:12 : 38) (NTS) 
# Copyright (c) 1997-2018 PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.2.17 -0debian0 .18.04.1, Copyright (c) 1999-2018, by Zend Technologies

PHP-FPM service is automatically started and activated upon restarting the Debian 10 system, so there is no need to start and activate it manually. We can move on to the next step, which is database installation and installation.

Step 2 – Install MariaDB and create a database

Install MySQL:

  sudo apt install -y mariadb server 

Check version:

  mysql - version 
# mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) with EditLine wrapper

Run mysql_secure_installation to improve the security of your MariaDB installation:

  sudo mysql_secure_installation 

Login to Maria as root user:

  sudo mysql -u root -p 
# Enter password:

Create a new MariaDB database and users and remember references:

  CREATE DATABASE dbname; 
SUPPORT EVERYONE on dbname. * TO "username" IDENTIFIED BY "password";
FLUSH PRIVILEGES;
exit;
exit; 19659035] Step 3 - Install the acme.sh client and obtain Let's # Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your website traffic. To get TLS certificates from Let & # 39; s Encrypt, we will use the acme.sh client. Acme.sh is a pure UNIX shell software to obtain TLS certificates from Let & # 39; s Encrypt with zero dependency.

Download and install acme.sh:ebrit19659009vardsudo su - root
gitklon https://github.com/Neilpang/acme.sh.gitebrit19459019??cd acme.sh
./ acme .sh - install - accountmail [email protected]
source ~ / .bashrc
cd ~

Check acme.sh version:

  acme.sh --version 
# v2.8.6

Get RSA and ECC / ECDSA certificate for your domain / host name:

  # RSA 2048 
acme.sh - question - standalone -d example.com - key length 2048
# ECDSA
acme.sh - query - standalone -d example.com - key length ec-256

If you want to get fake certificates for testing, you can add the flag [19659046] – staging to the commands above.

After running the above commands, your certificates and keys will be in:

  • For RSA : / home / username / example.com directory.
  • For ECC / ECDSA : /home/username/example.com_ecc directory.

To list your certificates you can run:

  acme.sh - list 

Create a directory to store your certificates. We will use the directory / etc / letsencrypt .

  mkdir -p /etc/letsecnrypt/example.com Chapter19659054 Dollsudo mkdir -p /etc/letsencrypt/example.com_ecc Chapter19659010 ????  Install / Copy Certificate to    / etc / letsencrypt    directory .  

  # RSA 
acme.sh --install-cert -d example. com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain .pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC / ECDSA
acme.sh --install-cert -d example.com --ecc --cert-file / etc / letsencrypt / example .com_ecc / cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service "

All certificates are automatically renewed every 60 days.

After obtaining certs exit from root user and return to normal sudo user:

  exit 

Step 4 - Install and configure Nginx

Install Nginx:

  sudo apt install -y nginx 

Check Nginx version:

  sudo nginx -v 
# nginx version: nginx / 1.14.0

Configure Nginx for X-Cart by running:

  sudo vim / etc / nginx / sites- available / xcart.conf 

And fill in the file with the config below.

  server {
listen 80;
listen [::]: 80;
root / var / www / xcart;
index index.php index.html index.htm;
server name example.com;
location @handler {
index cart.php;
write about ^ / sitemap.xml (?. +)? $ /cart.php?target=sitemap;
write about ^ / (. *) $ /cart.php?url=$1 last;
}
location / {
try_files $ uri $ uri / @handler;
}
location ~  .php $ {
try_files $ uri @handler;
fastcgi_split_path_info ^ (. + . php) (/.+) $;
fastcgi_index index.php;
fastcgi_pass unix: /var/run/php/php7.3-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $ fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
}
}

Enable the new xcart.conf configuration by linking the file to the website-enabled directory:

  sudo ln -s / etc / nginx / sites-available / xcart. conf / etc / nginx / sites-enabled 

Test configuration:

  sudo nginx -t 

Reload Nginx:

  sudo systemctl reload nginx 

Step 5 - Install X-Cart

Navigate to directory / var / www :

  cd / var / www / 

Download the latest version of X-Cart from https://www.x-cart.com/download.html and unpack it to your document root:

After downloading, change the ownership of directory / var / www / xcart to www-data:

  sudo chown - R www- data: www-data / var / www / xcart 

Navigate to example.com/install.php in your browser and follow the instructions to complete the installation.

Step 6 - Complete the installation

Accept the license agreement nt and click on Next .

  X-Cart Installation Wizard

Create an administrator account.

  Add Administrator Account

The Setup Wizard will check if your server meets the system requirements for X-Cart 5

  Check Requirements

Configure Database Settings:

  Database Login Information

Set up Directories + Step 6 Building Cache. All the information in these steps is fully automated, so you just have to wait and let X-Cart 5 do the job

  Installation process

Now the installation process is complete. You can use the links provided to access your store's customer front and admin area.

  x-Cart Installation successful


Source link