Tag Archives: MariaDB

Craft CMS on Debian 12

How to Install Craft CMS on Debian 12

Craft CMS is a popular content management system (CMS) that allows users to create and manage websites and digital experiences. It is known for its flexibility, powerful features, and user-friendly interface. Craft CMS is developed by Pixel & Tonic, a software development company.

In terms of performance and scalability, Craft CMS is designed to handle websites of all sizes, from small blogs to large enterprise solutions. It utilizes a modern technology stack and provides caching mechanisms to optimize page loading times.

The Craft Plugin Store offers a wide range of plugins for various purposes, such as e-commerce, SEO optimization, analytics, and integrations with third-party services.

In this tutorial, we will guide you through the process of installing Craft CMS on Debian 12 OS.

Step 1: Update Operating System

The first step is to ensure that your system is up-to-date. You can do this by running the following command:

# apt update && sudo apt upgrade

Also, install necessary packages.

# apt install sudo nano wget unzip zip

Now create a new non-root user account with sudo privileges and switch to it.

# /usr/sbin/adduser craftcms

# /usr/sbin/usermod -aG sudo craftcms

# su - craftcms

NOTE: You can replace craftcms with your username.

Step 2: Install Nginx Web Server

Craft CMS requires a web server to run, and we will be using the Nginx web server in this tutorial. To install Nginx, run the following command:

$ sudo apt install nginx

You can start the Nginx service and configure it to run on startup by entering the following commands:

$ sudo systemctl start nginx
$ sudo systemctl enable nginx

Verify the status of the Nginx service using systemctl status command:

$ sudo systemctl status nginx

Step 3: Install PHP and PHP extensions for Craft CMS

To install PHP and additional PHP modules to support Craft CMS, run the following command:

$ sudo apt install php php-cli php-common php-json php-gmp php-fpm php-xmlrpc php-bcmath php-imagick php-curl php-zip php-gd php-mysql php-xml php-mbstring php-xmlrpc php-intl

Verify if PHP is installed.

php -v
Output:
PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies

After installing all the packages, edit the php.ini file:

$ sudo nano /etc/php/8.2/fpm/php.ini

Change the following settings per your requirements:

max_execution_time = 300
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 128M
date.timezone = America/Chicago

To implement the changes, restart the php-fpm service:

$ sudo systemctl restart php8.2-fpm

Step 4: Install Composer dependency manager

To install Composer, run the following commands:

$ sudo curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

Verify that Composer has been installed successfully by running the following command:

$ composer --version
Composer version 2.5.8 2023-06-09 17:13:21

Step 5: Install MariaDB database server

To install the MariaDB database server, run the following command:

$ sudo apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

$ sudo systemctl status mariadb

Step 6: Create a New Database for Craft CMS

Once you have installed MariaDB, you’ll need to create a new database and user for Craft CMS to use.

To do this, log in to your MariaDB server using the following command:

$ sudo mysql -u root

Run the following commands to create a new database and user:

MariaDB [(none)]> CREATE DATABASE craftcms;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON craftcms.* TO 'craft'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Note: Make sure to replace 'password' with a strong password of your choice.

Step 7: Download and Install Craft CMS

Create a new directory for your Craft CMS installation using the following command:

$ sudo mkdir /var/www/craftcms

Change ownership of the /var/www/craft directory to the craftcmsuser.

$ sudo chown -R craftcms:craftcms /var/www/craftcms

Then download the latest stable release of Craft CMS from the command line:

$ cd /var/www/craftcms
$ composer create-project craftcms/craft .

You will be asked to provide database details, admin username, password, site URL as shown below:

Are you ready to begin the setup? (yes|no) [no]:yes
Which database driver are you using? (mysql or pgsql) [mysql] mysql
Database server name or IP address: [127.0.0.1] 127.0.0.1
Database port: [3306] 3306
Database username: [root] craft
Database password: password
Database name: craftcms
Database table prefix:
Install Craft now? (yes|no) [yes]:yes

Username: [admin] admin
Email: admin@your-domain.com
Password:
Confirm:
Site name: Your Website
Site URL: http://your-domain.com
Site language: [en-US] 

Change ownership of the /var/www/craftcms directory to www-data.

$ sudo chown -R www-data:www-data /var/www/craftcms

Step 8: Configure Nginx for Craft CMS

Run the commands below to create a new VirtualHost file called craftcms in the /etc/nginx/conf.d/ directory.

$ sudo nano /etc/nginx/conf.d/craftcms.conf

Paste the content as shown below:

server {

  listen 80;

  server_name your-domain.com www.your-domain.com;
  root /var/www/craftcms/web;
  index index.html index.htm index.php;
  charset utf-8;

  location / {
    try_files $uri/index.html $uri $uri/ /index.php?$query_string;
  }

  location ~ [^/]\.php(/|$) {
    try_files $uri $uri/ /index.php?$query_string;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param HTTP_PROXY "";
  }
}

Remember to replace your-domain.com with the domain name of your server.

Save and exit the configuration file.

To implement the changes, restart Nginx webserver:

$ sudo systemctl restart nginx

Step 9: Access Craft CMS Web Interface

Open your web browser and type the URL http://your-domain.com. You should see the welcome screen:

To access Craft’s administrative interface type the URL http://your-domain.com/admin you should see the login page:

Provide your admin credential and click on the Sign in button, you should see the Craft CMS dashboard in the following page:

Comments and Conclusion

Congratulations! You have successfully installed Craft CMS with Nginx on Debian 12 OS. You can now create your own website easily using Craft CMS.

For additional help or useful information, we recommend you to check  the official Craft CMS documentation.

How to Install Elgg on Debian 12

Elgg is an open-source social networking platform that allows users to create and manage their own social networks and communities.

It provides a flexible architecture that allows developers to extend and customize its functionality according to their specific needs. Elgg also supports the creation of plugins and themes, enabling further customization and integration with other systems.

In this tutorial, we will show you how to install Elgg on Debian 12 OS.

Step 1: Update Operating System

Update your Debian 12 operating system to the latest version with the following command:

# apt update && apt upgrade

Step 2: Install Apache webserver

You can install it via apt package manager by executing the following command.

# apt install apache2

Verify the status of the Apache service using systemctl status command:

# systemctl status apache2

Output:

 apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 3682 (apache2)
      Tasks: 55 (limit: 2273)
     Memory: 8.6M
        CPU: 32ms
     CGroup: /system.slice/apache2.service
             ├─3682 /usr/sbin/apache2 -k start
             ├─3684 /usr/sbin/apache2 -k start
             └─3685 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions for Elgg

To install PHP and additional PHP modules to support Elgg, run the following command:

# apt install php php-cli php-common libapache2-mod-php php-curl php-zip php-gd php-mysql php-xml php-mbstring php-xmlrpc php-intl

Verify if PHP is installed.

php -v
Output:
PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies

After installing all the packages, edit the php.ini file:

# nano /etc/php/8.2/apache2/php.ini

Change the following settings per your requirements:

max_execution_time = 300
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 128M
date.timezone = America/Chicago

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 4: Install MariaDB and create a database

To install MariaDB run the following command:

# apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

# systemctl status mariadb

Output:

 mariadb.service - MariaDB 10.11.3 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
     Active: active (running)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 16734 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 12 (limit: 2273)
     Memory: 203.0M
        CPU: 464ms
     CGroup: /system.slice/mariadb.service
             └─16734 /usr/sbin/mariadbd

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script.

# mysql_secure_installation

Configure it like this:

- Enter current password for root (enter for none): Enter
- Switch to unix_socket authentication [Y/n] Y
- Change the root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y

Now run the command below to log in to the MariaDB shell.

# mysql -u root -p

Once you are logged in to your database server you need to create a database for the Elgg installation:

MariaDB [(none)]> CREATE DATABASE elgg;
MariaDB [(none)]> CREATE USER 'elgg'@'localhost' IDENTIFIED BY 'Str0ngPass2F';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON elgg. * TO 'elgg'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Step 5: Download Elgg

The latest version of Elgg is available to download from the official website. As of writing this tutorial, the latest version available is 5.0.1.

# wget https://elgg.org/download/elgg-5.0.1.zip

Then extract file into the folder /var/www/ with the following command:

# unzip elgg-5.0.1.zip -d /var/www/

Rename the extracted directory:

# mv /var/www/elgg-5.0.1 /var/www/elgg/

Create a data directory:

# mkdir /var/www/data/

Then enable permission for the Apache webserver user to access the files:

# chown -R www-data:www-data /var/www/data/
# chown -R www-data:www-data /var/www/elgg/

Step 6: Configure Apache for Elgg

Run the commands below to create a new VirtualHost file called elgg in the /etc/apache2/sites-available/ directory.

# nano /etc/apache2/sites-available/elgg.conf

Paste the content as shown below:

 <VirtualHost *:80>
    ServerAdmin admin@your-domain.com
    DocumentRoot /var/www/elgg/
    
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    <Directory /var/www/elgg/> 
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory> 

    ErrorLog /var/log/apache2/your-domain.com-error_log
    CustomLog /var/log/apache2/your-domain.com-access_log common

 </VirtualHost>

Remember to replace your-domain.com with the domain name of your server.

Save and exit the configuration file.

Then enable the "rewrite" module in Apache:

# a2enmod rewrite

To enable this site run the command:

# ln -s /etc/apache2/sites-available/elgg.conf /etc/apache2/sites-enabled/elgg.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 7: Install free Let’s Encrypt SSL certificate

First we need to install the Certbot client which is used to create Let’s Encrypt certificates:

# apt install certbot python3-certbot-apache

To get the SSL certificate using the Certbot, type the command given below:

# certbot --apache -d your-domain.com -d www.your-domain.com

If the SSL certificate is successfully obtained, certbot displays a message to show the configuration was successful:

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/your-domain.com.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/your-domain.com/privkey.pem
   Your cert will expire on 2023-09-02. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Now, you have successfully installed SSL on your website.

Step 8: Access Elgg Web Interface

Open your web browser and type the URL https://your-domain.com. You should see the following page:

Click on the Next button.

The installer will then check the requirements. Once all checks are passed, click on the Next button.

After that, you will have to write the credentials from the database, data directory, and site URL and then click on the Next button:

Then, you have to set up your site name and email and then click on the Next button:

Provide your admin username, password, email and click on the Next button. Once the installation has been completed, you should see the following page:

Click on the Go to site button you should see your administration panel:

Comments and Conclusion

Congratulations! You have successfully installed Elgg. Thanks for using this tutorial for installing Elgg on your Debian 12 OS.

For additional help or useful information, we recommend you to check  the official Elgg documentation.

How to Install CodeIgniter on Ubuntu 22.04

CodeIgniter is a fast, lightweight, and open-source PHP framework used for developing web applications. It follows the model-view-controller (MVC) architectural pattern, which separates the application logic into three interconnected components: the model, the view, and the controller.

In this tutorial, we will show you how to install CodeIgniter on Ubuntu 22.04 OS.

Step 1: Update Operating System

Update your Ubuntu 22.04 operating system to the latest version with the following command:

# apt update && sudo apt upgrade -y

Step 2: Install Apache webserver

You can install it via apt package manager by executing the following command.

# apt install apache2

You can start the Apache service and configure it to run on startup by entering the following commands:

# systemctl start apache2
# systemctl enable apache2

Verify the status of the Apache service using systemctl status command:

# systemctl status apache2

Output:

 apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 81008 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 81012 (apache2)
      Tasks: 7 (limit: 2193)
     Memory: 26.4M
        CPU: 671ms
     CGroup: /system.slice/apache2.service
             ├─81012 /usr/sbin/apache2 -k start
             ├─81013 /usr/sbin/apache2 -k start
             ├─81014 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions for CodeIgniter

To install PHP and additional PHP modules to support CodeIgniter, run the following command:

# apt-get install php php-cli php-common libapache2-mod-php php-curl php-zip php-gd php-mysql php-xml php-imagick php-json php-intl

Verify if PHP is installed.

php -v
Output:
PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies

Step 4: Install MariaDB and create a database

To install MariaDB run the following command:

# apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

# systemctl status mariadb

Output:

 mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 979 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 7 (limit: 2193)
     Memory: 72.6M
        CPU: 6.374s
     CGroup: /system.slice/mariadb.service
             └─979 /usr/sbin/mariadbd

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script.

# mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y

Now run the command below to log in to the MariaDB shell.

# mysql -u root -p

Once you are logged in to your database server you need to create a database for the CodeIgniter installation:

MariaDB [(none)]> CREATE DATABASE codeigniter;
MariaDB [(none)]> CREATE USER 'codeigniter'@'localhost' IDENTIFIED BY 'Str0ngP@ssf1';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON codeigniter. * TO 'codeigniter'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 5: Download CodeIgniter

The latest version of CodeIgniter is available to download from GitHub. As of writing this tutorial, the latest version available is 4.3.5.

Run the following command to download it from the GitHub page to your Ubuntu system:

# wget https://github.com/codeigniter4/CodeIgniter4/archive/refs/tags/v4.3.5.zip

After the download is complete, extract the file into the folder /var/www/ with the following command:

# unzip v4.3.5.zip -d /var/www 

Rename the extracted directory:

# cd /var/www/ && mv CodeIgniter4-*/ CodeIgniter

Then enable permission for the Apache webserver user to access the files:

# chown -R www-data:www-data /var/www/CodeIgniter/

Next, you need to edit the database configuration:

# cp CodeIgniter/env CodeIgniter/.env 
# nano CodeIgniter/.env

Set environment:

#-------------------------------------------------------------------- 
# ENVIRONMENT 
#-------------------------------------------------------------------- 
CI_ENVIRONMENT = development

Configure CodeIgniter base URL for accessing via your web browser:

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

app.baseURL = 'http://your-domain.com'

Set database connection:

#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

database.default.hostname = localhost
database.default.database = codeigniter
database.default.username = codeigniter
database.default.password = Str0ngP@ssf1
database.default.DBDriver = MySQLi

Save and close the file.

Step 6: Configure Apache for CodeIgniter

Run the commands below to create a new VirtualHost file called codeigniter in the /etc/apache2/sites-available/ directory.

# nano /etc/apache2/sites-available/codeigniter.conf

Paste the content as shown below:

 <VirtualHost *:80>
    ServerAdmin admin@your-domain.com
    DocumentRoot /var/www/CodeIgniter/public/
    
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    <Directory /var/www/CodeIgniter/public/> 
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory> 

    ErrorLog /var/log/apache2/your-domain.com-error_log
    CustomLog /var/log/apache2/your-domain.com-access_log common

 </VirtualHost>

Remember to replace your-domain.com with the domain name of your server.

Save and exit the configuration file.

To enable this site run the command:

# a2ensite codeigniter.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 7: Access CodeIgniter

Open your web browser and type the URL http://your-domain.com/. You should see the following page:

Comments and Conclusion

Congratulations! You have successfully installed CodeIgniter on Ubuntu 22.04 OS.

You can start your development with CodeIgniter. For additional help or useful information, we recommend you refer to the User guide.

How to Install Vtiger CRM on Ubuntu 22.04

Vtiger CRM is a cloud-based customer relationship management (CRM) software that helps businesses manage their sales, marketing, and customer support activities. It offers a range of features such as lead management, contact management, sales forecasting, email marketing, and customer support ticketing.

Vtiger CRM is designed to be highly customizable, allowing businesses to tailor the software to their specific needs. It also integrates with a variety of third-party applications, including Google Apps, Office 365, and Zapier, making it easy to sync data between different systems.

In this tutorial, we will show you how to install Vtiger CRM on Ubuntu 22.04.

Step 1: Update Operating System

Update your Ubuntu 22.04 operating system to the latest version with the following command:

# apt update && sudo apt upgrade -y

Step 2: Install Apache webserver

You can install it via apt package manager with the following command.

# apt install apache2

Verify the status of the Apache service using systemctl status command:

# systemctl status apache2

Output:

 apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 14406 (apache2)
      Tasks: 55 (limit: 2193)
     Memory: 4.8M
        CPU: 29ms
     CGroup: /system.slice/apache2.service
             ├─14406 /usr/sbin/apache2 -k start
             ├─14408 /usr/sbin/apache2 -k start
             └─14409 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions

By default, PHP 8.1 is included in the Ubuntu 22.04 default repository. You can install PHP 8.1 using the following command:

# apt-get install php libapache2-mod-php php-{cli,common,curl,zip,gd,mysql,xml,mbstring,json,intl,imap}

Verify if PHP is installed.

# php -v
Output:
PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies

Update php.ini file

Now it’s time to increase values in the php.ini file.

Open php.ini file:

# nano /etc/php/8.1/apache2/php.ini

Change the following data:

memory_limit = 256M
upload_max_filesize = 128M
display_errors = Off
log_errors = Off
short_open_tag = Off
max_execution_time = 60
date.timezone = America/Chichago

Then save this php.ini file.

After that, you should restart apache2 for the configuration to take effect:

# systemctl restart apache2

Step 4: Install MariaDB and create a database

To install MariaDB run the following command:

# apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

# systemctl status mariadb

Output:

 mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 58518 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 58519 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 58521 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && >
    Process: 58560 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 58562 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 58550 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 3623)
     Memory: 60.8M
        CPU: 1.720s
     CGroup: /system.slice/mariadb.service
             └─58550 /usr/sbin/mariadbd

Now Setup sql_mode:

# nano /etc/mysql/mariadb.conf.d/50-server.cnf

Insert below line under [mysqld] section.

sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Then restart the MariaDB server.

# systemctl restart mariadb

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script.

# mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y

Now run the command below to log in to the MariaDB shell.

# mysql -u root -p

Once you are logged in to your database server you need to create a database for the Vtiger CRM installation:

MariaDB [(none)]> CREATE DATABASE vtigercrm;
MariaDB [(none)]> CREATE USER 'vtigercrm'@'localhost' IDENTIFIED BY 'Str0ngPassf1';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON vtigercrm. * TO 'vtigercrm'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 5: Install Vtiger CRM

The latest version of Vtiger CRM is available to download from their website. You can download it with the following command:

# cd /var/www/
# wget https://tenet.dl.sourceforge.net/project/vtigercrm/vtiger%20CRM%207.5.0/Core%20Product/vtigercrm7.5.0.tar.gz

Extract the file with the following command:

# tar -xzvf vtigercrm7.5.0.tar.gz

Change the ownership of the directory with the command:

# chown -R www-data:www-data /var/www/vtigercrm/

Step 6: Configure Apache for Vtiger CRM

Navigate to /etc/apache2/sites-available directory and run the following command to create a configuration file for your Vtiger CRM installation:

# nano /etc/apache2/sites-available/vtigercrm.conf

Add the following content:

<VirtualHost *:80>

ServerName your-domain.com
ServerAlias www.your-domain.com

ServerAdmin webmaster@your-domain.com
DocumentRoot /var/www/vtigercrm

<Directory /var/www/vtigercrm/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined

</VirtualHost>

Save the file and Exit.

Enable the Vtiger CRM virtual host:

# a2ensite vtigercrm.conf

Enable Apache rewrite mode.

# a2enmod rewrite

Restart the Apache web server.

# systemctl restart apache2

Step 7: Access your Vtiger CRM Application

Open your web browser and type the URL http://your-domain.com. You should see the following page:

Click Install button to go through the setup wizard.

Accept the License Agreement by click “I Agree”. You should see the following page:

Verify installation prerequisites ensure that all pre-reqs are met. Otherwise fix them and then click on the Next button.

Provide your database name, database username, password, admin username and password.

Then, click on the Next button. You should see the following page:

Review the system configuration settings and click Next button.

On the Next page, select your Industry and click Next to proceed with installation.

Once the installation is done, Select the modules for the Vtiger CRM features you would like to have.

Click Next and you should see the Vitager CRM dashboard:

You can now add more widgets to your dashboard.

Comments and Conclusion

That’s it. You have successfully installed Vtiger CRM on Ubuntu 22.04.

For additional help or useful information, we recommend you to check the official Vtiger CRM documentation.

If you have any questions please leave a comment below.

How to Install PyroCMS on Ubuntu 22.04

PyroCMS is a popular open-source content management system (CMS) that is built on top of the Laravel PHP framework. It is a powerful and flexible CMS that can be used to create websites, blogs, and online stores.

In this tutorial, we will guide you through the process of installing PyroCMS on Ubuntu 22.04.

Step 1: Update Operating System

The first step is to ensure that your system is up-to-date. You can do this by running the following command:

$ sudo apt update && sudo apt upgrade -y

Step 2: Install Nginx Web Server

PyroCMS requires a web server to run, and we will be using the Nginx web server in this tutorial. To install Nginx, run the following command:

$ sudo apt install nginx

You can start the Nginx service and configure it to run on startup by entering the following commands:

$ sudo systemctl start nginx
$ sudo systemctl enable nginx

Verify the status of the Nginx service using systemctl status command:

$ sudo systemctl status nginx

Output:

 nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:nginx(8)
    Process: 64219 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 64220 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 64310 (nginx)
      Tasks: 2 (limit: 2200)
     Memory: 3.3M
        CPU: 181ms
     CGroup: /system.slice/nginx.service
             ├─64310 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             └─64313 "nginx: worker process"

Step 3: Install PHP and PHP extensions for PyroCMS

PyroCMS requires PHP version 7.4 or later to be installed on your Ubuntu system. By default, Ubuntu 22.04 comes with PHP version 8.1.

To install PHP and the necessary extensions, run the following command:

$ sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear

Once the installation is complete verify if PHP is installed:

php -v
Output:
PHP 8.1.2-1ubuntu2.10 (cli) (built: Jan 16 2023 15:19:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.10, Copyright (c), by Zend Technologies

Step 4: Install Composer dependency manager

Composer is a dependency manager for PHP that is required for installing PyroCMS. To install Composer, run the following commands:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Verify that Composer has been installed successfully by running the following command:

composer --version
Composer version 2.5.4 2023-02-15 13:10:06

Step 5: Install MariaDB database server

PyroCMS requires a database to store content and other information. In this tutorial, we will be using MariaDB, a popular open-source database server.

To install the MariaDB database server, run the following command:

$ sudo apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

$ sudo systemctl status mariadb

Output:

 mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 60189 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 60190 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 60192 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && >
    Process: 60235 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 60237 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 60221 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 2200)
     Memory: 61.0M
        CPU: 541ms
     CGroup: /system.slice/mariadb.service
             └─60221 /usr/sbin/mariadbd

Once the installation is complete, run the following command to secure your MariaDB server:

$ sudo mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y

Step 6: Create a New Database for PyroCMS

Once you have installed MariaDB, you’ll need to create a new database and user for PyroCMS to use.

To do this, log in to your MariaDB server using the following command:

$ sudo mysql -u root -p

You will be prompted to enter your root password. Once you have entered your password, you will be taken to the MariaDB prompt.

Run the following commands to create a new database and user:

MariaDB [(none)]> CREATE DATABASE pyrocms;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON pyrocms.* TO 'pyro'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Note: Make sure to replace 'password' with a strong password of your choice.

Step 7: Download and Install PyroCMS

Create a new directory for your PyroCMS installation using the following command:

$ sudo mkdir /var/www/pyrocms

Download the latest stable release of PyroCMS from the command line:

$ cd /var/www/pyrocms
$ sudo composer create-project pyrocms/pyrocms .

Change ownership of the /var/www/pyrocms directory to www-data.

$ sudo chown -R www-data:www-data /var/www/pyrocms

Step 8: Configure Nginx for PyroCMS

Run the commands below to create a new VirtualHost file called pyrocms in the /etc/nginx/conf.d/ directory.

$ sudo nano /etc/nginx/conf.d/pyrocms.conf

Paste the content as shown below:

server {
  listen 80;
  server_name your-domain.com www.your-domain.com;
  root /var/www/pyrocms/public;
  index index.php index.html;
  charset utf-8;
  location / {
    try_files $uri $uri/ /index.php?$args;
  }
  location ~ .php$ {
    fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

Remember to replace your-domain.com with the domain name of your server.

Save and exit the configuration file.

To implement the changes, restart Nginx webserver:

$ sudo systemctl restart nginx

Step 9: Access PyroCMS Web Interface

Open your web browser and type the URL http://your-domain.com. You should see the PyroCMS installation page.

Follow the on-screen instructions to complete the installation process. Agree to the license agreement and provide all the information like a database connection and creating an admin user.

Then click on the Install button, you should see the following page:

Now, click on Login button, you should see the following page:

Provide your admin credential and click on the Login button, you should see the PyroCMS dashboard in the following page:

Comments and Conclusion

That’s it! You have successfully installed PyroCMS on your Ubuntu 22.04 system. You can now start building your website using PyroCMS.

To access the PyroCMS admin area just append /admin to your site URL.

For additional help or useful information, we recommend you to check the official PyroCMS documentation.

How to Install Chamilo LMS on Ubuntu 22.04

Chamilo is an open-source learning management system (LMS) used for delivering online courses and training programs. It provides features such as course content management, student registration and progress tracking, online assessments, and collaboration tools. Chamilo is a free, web-based platform that can be customized to fit the needs of schools, businesses, and organizations.

In this tutorial, we will show you step-by-step how to install Chamilo on Ubuntu 22.04 OS.

Step 1: Update Operating System

Update your Ubuntu 22.04 operating system to the latest version with the following command:

# apt update && sudo apt upgrade -y

Step 2: Install Apache webserver

You can install it via apt package manager by executing the following command.

# apt install apache2

Verify the status of the Apache service using systemctl status command:

# systemctl status apache2

Output:

 apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 3489 (apache2)
      Tasks: 55 (limit: 2200)
     Memory: 4.8M
        CPU: 134ms
     CGroup: /system.slice/apache2.service
             ├─3489 /usr/sbin/apache2 -k start
             ├─3491 /usr/sbin/apache2 -k start
             └─3492 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions for Chamilo

Chamilo requirement PHP7.4. So you will need to add the DEB.SURY.ORG repository to APT.

# apt install software-properties-common
# add-apt-repository ppa:ondrej/php -y

To install PHP and additional PHP modules to support Chamilo, run the following command:

# apt-get install php7.4 libapache2-mod-php7.4 php7.4-{cli,common,curl,zip,gd,mysql,xml,mbstring,json,intl,ldap,apcu}

Verify if PHP is installed.

php7.4 -v
Output:
PHP 7.4.33 (cli) (built: Jan 13 2023 10:42:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

After installing all the packages, edit the php.ini file:

# nano /etc/php/7.4/apache2/php.ini

Change the following settings per your requirements:

memory_limit = 512M
max_execution_time = 360
post_max_size = 128M
upload_max_filesize = 128M
date.timezone = America/Chicago

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 4: Install MariaDB and create a database

To install MariaDB run the following command:

# apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

# systemctl status mariadb

Output:

 mariadb.service - MariaDB 10.6.11 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 22423 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 22424 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 22427 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && >
    Process: 22492 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 22495 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 22463 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 11 (limit: 2200)
     Memory: 61.0M
        CPU: 425ms
     CGroup: /system.slice/mariadb.service
             └─22463 /usr/sbin/mariadbd

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script.

# mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y

Now run the command below to log in to the MariaDB shell.

# mysql -u root -p

Once you are logged in to your database server you need to create a database for the Chamilo installation:

MariaDB [(none)]> CREATE DATABASE chamilo;
MariaDB [(none)]> CREATE USER 'chamilo'@'localhost' IDENTIFIED BY 'Str0ngPasrf1';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON chamilo. * TO 'chamilo'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 5: Download Chamilo

Download the latest version of Chamilo. Find the newest version of this software on the official download page.

As of writing this tutorial, the latest stable version is 1.11.18.

# wget https://github.com/chamilo/chamilo-lms/releases/download/v1.11.18/chamilo-1.11.18.zip

Extract the downloaded package:

# apt install unzip
# unzip chamilo-1.11.18.zip

Copy the extracted files to the Apache web root directory:

# mv chamilo-1.11.18 /var/www/html/chamilo

Set the ownership and permissions of the Chamilo directory:

# chown -R www-data:www-data /var/www/html/chamilo
# chmod -R 755 /var/www/html/chamilo

Step 6: Configure Apache for Chamilo

Run the commands below to create a new VirtualHost file called chamilo in the /etc/apache2/sites-available/ directory.

# nano /etc/apache2/sites-available/chamilo.conf

Paste the content as shown below:

 <VirtualHost *:80>
    ServerAdmin admin@your-domain.com
    DocumentRoot /var/www/html/chamilo/
    
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    <Directory /var/www/html/chamilo/> 
        AllowOverride All
        Require all granted
    </Directory> 

    ErrorLog /var/log/apache2/your-domain.com-error_log
    CustomLog /var/log/apache2/your-domain.com-access_log common

 </VirtualHost>

Remember to replace your-domain.com with the domain name of your server.

Save and exit the configuration file.

Then enable the "rewrite" module in Apache:

# a2enmod rewrite

To enable this site run the command:

# a2ensite chamilo.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 7: Access Chamilo Web Interface

To access the Chamilo installation wizard, go to your browser and visit http://your-domain.com.

Select the language you’d like to use when installing:

Then, you will see the system requirements screen:

At the bottom, you will see the New Installation button that you have to click:

Then, accept the application license:

Set your company name, your name, and email, as well as the language to use. This data will help the program to evolve.

Provide your database information and click on the Next.

Provide your site information and click on the Next.

You will see a summary of the installation:

Then, the installation will start and if everything went well, you will see the following screen:

To protect your config directory run the following command:

# chmod -R 555 /var/www/html/chamilo/app/config

To delete the installation folder, run the command below on the server:

# rm -r /var/www/html/chamilo/main/install

After deleting the folder go to http://your-domain.com/ and you will get the login page.

Provide your admin username and password and click on Login. You will be redirected to the dashboard:

 

Comments and Conclusion

Congratulations! You have successfully installed Chamilo LMS. Thanks for using this tutorial for installing the Chamilo LMS on Ubuntu 22.04 OS.

For additional help or useful information, we recommend you to check the official Chamilo LMS documentation.

How to Install Zen Cart on Ubuntu 22.04

Zen Cart is a free, open-source e-commerce application with wide community support. It is written in PHP and requires a MySQL database.

In this tutorial, we will show you how to install Zen Cart on Ubuntu 22.04 OS.

Step 1: Update Operating System

Update your Ubuntu 22.04 operating system to the latest version with the following command:

$ sudo apt update && sudo apt upgrade -y

Step 2: Install Apache webserver

You can install it via apt package manager by executing the following command.

$ sudo apt install apache2

You can start the Apache service and configure it to run on startup by entering the following commands:

$ sudo systemctl start apache2
$ sudo systemctl enable apache2

Verify the status of the Apache service using systemctl status command:

$ sudo systemctl status apache2

Output:

 apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 47636 (apache2)
      Tasks: 55 (limit: 2200)
     Memory: 4.8M
        CPU: 126ms
     CGroup: /system.slice/apache2.service
             ├─47636 /usr/sbin/apache2 -k start
             ├─47638 /usr/sbin/apache2 -k start
             └─47639 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions for Zen Cart

By default, Ubuntu 22.04 comes with PHP version 8.1. To install PHP and additional PHP modules to support Zen Cart, run the following command:

$ sudo apt-get install php php-cli php-common libapache2-mod-php php-curl php-zip php-gd php-mysql php-xml php-mbstring php-json php-intl

Verify if PHP is installed.

php -v
Output:
PHP 8.1.2-1ubuntu2.9 (cli) (built: Oct 19 2022 14:58:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.9, Copyright (c), by Zend Technologies

After installing all the packages, edit the php.ini file:

$ sudo nano /etc/php/8.1/apache2/php.ini

Change the following settings per your requirements:

memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 128M
date.timezone = America/Chicago

To implement the changes, restart Apache webserver:

$ sudo systemctl restart apache2

Step 4: Install MariaDB and create a database

To install MariaDB run the following command:

$ sudo apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

$ sudo systemctl status mariadb

Output:

 mariadb.service - MariaDB 10.6.11 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 59747 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 59748 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 59750 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && >
    Process: 59790 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 59792 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 59779 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 2200)
     Memory: 61.0M
        CPU: 415ms
     CGroup: /system.slice/mariadb.service
             └─59779 /usr/sbin/mariadbd

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script.

$ sudo mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y

Now run the command below to log in to the MariaDB shell.

$ sudo mysql -u root -p

Once you are logged in to your database server you need to create a database for the Zen Cart installation:

MariaDB [(none)]> CREATE DATABASE zencart;
MariaDB [(none)]> CREATE USER 'zencart'@'localhost' IDENTIFIED BY 'Str0ngWedrf1';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zencart. * TO 'zencart'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 5: Download Zen Cart

The latest version of Zen Cart is available to download from GitHub. As of writing this tutorial, the latest version available is 1.5.8.

$ sudo wget https://github.com/zencart/zencart/archive/refs/tags/v1.5.8.zip --no-check-certificate

Then extract file into the folder /var/www/ with the following command:

$ sudo apt -y install unzip 
$ sudo unzip v1.5.8.zip -d /var/www/

Rename the extracted directory:

$ sudo mv /var/www/zencart-1.5.8 /var/www/zencart/

Then enable permission for the Apache webserver user to access the files:

$ sudo chown -R www-data:www-data /var/www/zencart/

Step 6: Configure Apache for Zen Cart

Run the commands below to create a new VirtualHost file called zencart in the /etc/apache2/sites-available/ directory.

$ sudo nano /etc/apache2/sites-available/zencart.conf

Paste the content as shown below:

 <VirtualHost *:80>
    ServerAdmin admin@your-domain.com
    DocumentRoot /var/www/zencart/
    
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    <Directory /var/www/zencart/> 
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory> 

    ErrorLog /var/log/apache2/your-domain.com-error_log
    CustomLog /var/log/apache2/your-domain.com-access_log common

 </VirtualHost>

Remember to replace your-domain.com with the domain name of your server.

Save and exit the configuration file.

To enable this site run the command:

$ sudo a2ensite zencart.conf

To implement the changes, restart Apache webserver:

$ sudo systemctl restart apache2

Step 7: Install free Let’s Encrypt SSL certificate

First we need to install the Certbot client which is used to create Let’s Encrypt certificates:

$ sudo apt install certbot python3-certbot-apache

To get the SSL certificate using the Certbot, type the command given below:

$ sudo certbot --apache -d your-domain.com -d www.your-domain.com

If the SSL certificate is successfully obtained, certbot displays a message to show the configuration was successful:

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/your-domain.com.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/your-domain.com/privkey.pem
   Your cert will expire on 2023-04-02. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Now, you have successfully installed SSL on your website.

Step 8: Access Zen Cart Web Interface

Open your web browser and type the URL https://your-domain.com/zc_install/index.php. You should see the following page:

Accept the license and click on the Continue.

Provide your database information and click the checkbox next to the Load Demo Data option. Then click on the Continue.

Establish a username and email address for the admin of the Zen Cart backend and click Continue.

Once the installation has been completed, you should see the following page:

Now, open your terminal and remove the installation directory with the following command:

# rm -rf /var/www/zencart/zc_install/

Then if you click on the Your Storefront you should see your shop page:

Or if you click on the Your Admin Dashboard button you should see the login page:

Provide your admin username, password and click on the Submit button. You should see your administration panel.

Comments and Conclusion

Congratulations! You have successfully installed Zen Cart e-commerce platform. Thanks for using this tutorial for installing Zen Cart on your Ubuntu 22.04 OS.

For additional help or useful information, we recommend you to check the documentation at the official Zen Cart website.

How to Install OpenCart on Ubuntu 22.04

OpenCart is a popular open-source and free to use content management system (CMS) designed for building online stores.

It offers a lot of plugins that help you to extend the platform’s functionality and includes features like user management, multi-store functionality, affiliates, discounts, multiple payment gateways, product reviews, and more.

In this tutorial, we will explain how to install and configure the OpenCart e-commerce platform on Ubuntu 22.04.

Step 1: Update Operating System

Update your Ubuntu 22.04 operating system to the latest version with the following command:

$ sudo apt update && sudo apt upgrade -y

Step 2: Install Apache webserver

The Apache HTTP Server is a free and open-source cross-platform web server. You can install it via apt package manager by executing the following command.

$ sudo apt install apache2

You can start the Apache service and configure it to run on startup by entering the following commands:

$ sudo systemctl start apache2
$ sudo systemctl enable apache2

Verify the status of the Apache service using systemctl status command:

$ sudo systemctl status apache2

Output:

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 2975 (apache2)
      Tasks: 55 (limit: 2200)
     Memory: 4.8M
        CPU: 137ms
     CGroup: /system.slice/apache2.service
             ├─2975 /usr/sbin/apache2 -k start
             ├─2977 /usr/sbin/apache2 -k start
             └─2978 /usr/sbin/apache2 -k start

Step 3: Install PHP

To install PHP and additional PHP modules to support OpenCart, run the following command:

$ sudo apt-get install php php-cli libapache2-mod-php php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip php-curl php-xmlrpc

Verify if PHP is installed.

php -v
Output:
PHP 8.1.2 (cli) (built: Jun 13 2022 13:52:54) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Step 4: Install MariaDB and create a database

MariaDB is a free and opensource database engine that is flexible, robust and easy-to-use. To install MariaDB run the following command:

$ sudo apt install mariadb-server mariadb-client

Verify the status of the MariaDB service using systemctl status command:

$ sudo systemctl status mariadb

Output:

● mariadb.service - MariaDB 10.6.7 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 26067 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 26069 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 26072 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && >
    Process: 26149 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 26151 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 26109 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 7 (limit: 2200)
     Memory: 61.3M
        CPU: 2.585s
     CGroup: /system.slice/mariadb.service
             └─26109 /usr/sbin/mariadbd

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script.

$ sudo mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y

Now run the command below to log in to the MariaDB shell.

$ sudo mysql -u root -p

Once you are logged in to your database server you need to create a database for the OpenCart installation:

MariaDB [(none)]> CREATE DATABASE opencart;
MariaDB [(none)]> CREATE USER 'opencart'@'localhost' IDENTIFIED BY 'Your-Strong-Password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON opencart . * TO 'opencart'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 5: Download OpenCart

You can download the latest version of OpenCart from the Git repository using the following command:

$ sudo wget https://github.com/opencart/opencart/releases/download/4.0.0.0/opencart-4.0.0.0.zip

Then extract file into the folder /var/www/html/opencart/ with the following command:

$ sudo apt -y install unzip 
$ sudo unzip opencart-4.0.0.0.zip -d /var/www/html/opencart/

Copy OpenCart configuration files:

$ sudo cp /var/www/html/opencart/upload/{config-dist.php,config.php}

$ sudo cp /var/www/html/opencart/upload/admin/{config-dist.php,config.php}

Enable permission for the Apache webserver user to access the files:

$ sudo chown -R www-data:www-data /var/www/html/opencart/

Step 6: Create Virtualhost for Opencart

Then, create an virtual host configuration file to host OpenCart:

$ sudo nano /etc/apache2/sites-available/opencart.conf

Paste the content as shown below:

<VirtualHost *:80>
    ServerAdmin admin@your-domain.com
    DocumentRoot /var/www/html/opencart/upload/
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    <Directory /var/www/html/opencart/upload/>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/your-domain.com-error_log
    CustomLog /var/log/apache2/your-domain.com-access_log common
</VirtualHost>

Remember to replace your-domain.com with the domain name of your server.

Save and exit the configuration file.

To enable this site run the command:

$ sudo a2ensite opencart.conf

To implement the changes, restart Apache webserver:

$ sudo systemctl restart apache2

Step 7: Access OpenCart Web Interface

To access the OpenCart Web Interface, go to your browser and visit http://your-domain.com/.

The first page displays the license agreement. Scroll down and click Continue.

Make sure all the required PHP extensions are installed then click on the Continue button.

The next page will require you to fill in the database details. Enter the details you defined in the MariaDB database and click Continue.

Once the installation has been completed, you should see the following page:

Then if you click on the Go to your Online Shop you should see your shop page:

Or if you click on the Login to your Administration button you should see the login page:

Provide your admin username, password and click on the Login button. You should see your administration panel:

Now, open your terminal and remove the installation directory with the following command:

$ sudo rm -rf /var/www/html/opencart/upload/install/

Comments and Conclusion

Congratulations! You have successfully installed OpenCart. Thanks for using this tutorial for installing the OpenCart on Ubuntu 22.04 OS. For additional help or useful information, we recommend you to check the official OpenCart website.