Install Elgg on Debian 12

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 CakePHP on Ubuntu 22.04

CakePHP is an open-source web application framework written in PHP. It follows the Model-View-Controller (MVC) architectural pattern, which provides a structured approach to developing web applications. CakePHP aims to simplify and speed up the development process by offering a set of conventions and built-in features.

CakePHP has gained popularity for its simplicity, convention-driven approach, and robust feature set. It has been used to build a wide range of web applications, from small websites to large-scale enterprise systems.

In this tutorial, we will show you how to install CakePHP 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

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: 2773 (apache2)
      Tasks: 55 (limit: 2193)
     Memory: 4.8M
        CPU: 35ms
     CGroup: /system.slice/apache2.service
             ├─2773 /usr/sbin/apache2 -k start
             ├─2775 /usr/sbin/apache2 -k start
             └─2776 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions for CakePHP

To install PHP and additional PHP extensions which are essential for create CakePHP project, run the following command:

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

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 MySQL and create a database

You can install the MySQL server with the following command:

# apt install mysql-server

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

# systemctl status mysql

Output:

 mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running)
    Process: 806 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 938 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 2193)
     Memory: 421.3M
        CPU: 3.314s
     CGroup: /system.slice/mysql.service
             └─938 /usr/sbin/mysqld

By default, MySQL server is not hardened. You can secure MySQL 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, log into the MySQL prompt:

#  mysql -u root -p

To create a database, database user, and grant all privileges to the database user run the following commands:

mysql> CREATE DATABASE cakephp_db;
mysql> CREATE USER 'cakephp_user'@'localhost' IDENTIFIED BY 'Str0Pa$$word';
mysql> GRANT ALL ON cakephp_db.* TO 'cakephp_user'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> EXIT

Step 5: Install Composer

CakePHP’s official installation method is through Composer.

Run the following command to download the Composer installer using curl command:

# curl -sS https://getcomposer.org/installer | php

Next, move the composer file to the /usr/local/bin path.

# mv composer.phar  /usr/local/bin/composer

Assign execute permission:

# chmod +x   /usr/local/bin/composer

Verify the Composer version installed:

# composer --version
Output:
Composer version 2.5.7 2023-05-24 15:00:39

Step 6: Create CakePHP Project

Now, using Composer it is quite simple to create CakePHP project. To do so, just run the following command:

# cd /var/www
# composer create-project --prefer-dist cakephp/app MyProject

In the final part of the installation, you will be asked to change the permissions of the folders.

Set Folder Permissions ? (Default to Y) [Y,n]? Y
Permissions set on /var/www/MyProject/tmp/cache
Permissions set on /var/www/MyProject/tmp/cache/models
Permissions set on /var/www/MyProject/tmp/cache/persistent
Permissions set on /var/www/MyProject/tmp/cache/views
Permissions set on /var/www/MyProject/tmp/sessions
Permissions set on /var/www/MyProject/tmp/tests
Permissions set on /var/www/MyProject/tmp
Permissions set on /var/www/MyProject/logs
Updated Security.salt value in config/app_local.php

Also, change the ownership of the MyProject directory with the following command:

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

Then edit MyProject/config/app_local.php configuration file and search for your database setting.

# nano /var/www/MyProject/config/app_local.php

Make necessary changes as per below details:

    'Datasources' => [
        'default' => [
            'host' => 'localhost',
            //'port' => 'non_standard_port_number',

            'username' => 'cakephp_user',
            'password' => 'Str0Pa$$word',

            'database' => 'cakephp_db',

Step 7: Deploy CakePHP (Development)

To check that CakePHP is properly installed, simply run PHP’s built-in webserver to serve your project.

# bin/cake server

By default, without any arguments provided, this will serve your application at http://localhost:8765/.

You can also specify your own host and port:

# bin/cake server -H 192.168.10.10 -p 4321

This will serve your application at http://192.168.10.10:4321/

Note: That this is done for development purposes and never for production.

Step 8: Configure Apache for CakePHP (Production)

To create a new VirtualHost file run the following commands:

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

Paste the content as shown below:

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

    <Directory /var/www/MyProject/> 
        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>

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 cakephp.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 9: Access CakePHP

To access your CakePHP project, go to your browser and visit http://your-domain.com.

You will see the database is connected properly.

Comments and Conclusion

That’s it. You can now create controllers, models and views to develop your project according to your requirements.

For additional help or useful information, we recommend you to check the official CakePHP 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 Portainer on Ubuntu 22.04

Portainer is an open-source container management tool that provides a web-based graphical user interface (GUI) for managing Docker containers, images, networks, and volumes.

Portainer supports multiple Docker environments, including Docker Swarm, Kubernetes, and Docker Desktop. It also provides features such as user authentication, role-based access control (RBAC), and multi-tenancy, making it a suitable tool for managing Docker resources in production environments.

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

Step 1: Update Operating System

Before we start, it is always a good practice to update your Ubuntu system to the latest packages. Open the terminal and run the following commands:

# apt-get update && sudo apt-get upgrade

Step 2: Install Docker

Portainer is a Docker management tool, so you need to have Docker installed on your Ubuntu system. If you don’t have Docker installed, you can install it by running the following commands:

# apt-get install docker.io

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

# systemctl start docker
# systemctl enable docker

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

# systemctl status docker

Output:

 docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running)
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 2449 (dockerd)
      Tasks: 7
     Memory: 22.7M
        CPU: 315ms
     CGroup: /system.slice/docker.service
             └─2449 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Step 3: Install Portainer

Once you have Docker installed on your system, you can proceed to install Portainer.

Run the following command to pull the Portainer image from Docker Hub:

# docker pull portainer/portainer-ce:latest

Then, start the Portainer container by running the following command:

# docker run -d -p 9000:9000 --restart always -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ce:latest

The above command will start a Portainer container in the background and bind it to the port 9000.

Step 4: Access Portainer Web Interface

You can now access the Portainer web interface by opening a web browser and visiting http://your-IP-address:9000.

You should get Portainer login page to create an admin password. Set your admin user and password and click on the Create user button.

You will be asked to select the Docker environment that you want to manage. Select “Proceed using the local environment which Portainer is running in”

You should see the following page:

Step 5: Deploy Container Using Portainer

Now you can test your Portainer setup by deploying a test Docker container. Follow the steps below to install an Nginx web server.

Select Containers in the menu on the left side:

Click the Add container button in the action bar.

Type information for the container you want to run, including the container name, the image name, and the connection ports. Then select the Deploy the container button.

After completing the above steps, to verify the creation of the defined container, one can check on the dashboard.

Open your browser and type http://your-IP-address:8080 . You will see the Nginx webserver welcome page.

Comments and Conclusion

Congratulations! You have successfully installed Portainer to manage Docker containers on Ubuntu 22.04.

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

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 Elasticsearch 8 on Debian 11

Elasticsearch is a highly scalable and distributed open-source full-text search and analytics engine tool. It is designed to store, search, and analyze large volumes of data in real-time, making it a popular tool for a variety of use cases such as log analytics, e-commerce product search, and security analytics.

Elasticsearch uses a document-oriented data model, which means that it stores data in JSON documents that can be easily searched and analyzed. It also provides a powerful query language called Elasticsearch Query DSL, which allows users to perform complex queries on the data stored in the engine.

In this tutorial, we will show you how to install Elasticsearch on Debian 11.

Step 1: Update Operating System

Update your Debian 11 operating system to make sure all existing packages are up to date:

# apt update && apt upgrade

Also, install:

# apt install curl wget gnupg apt-transport-https

Step 2: Add Elasticsearch Repository

By default, Elasticsearch is not included in the Debian 11 default repository. So you will need to add the Elasticsearch repository to APT.

First, import the Elasticsearch GPG key.

# wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

Then add the Elasticsearch repository.

# echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list

Once you are done, update the repository with the following command:

# apt update

Step 3: Install and Configure Elasticsearch

Now, you can install the Elasticsearch using the following command:

# apt install elasticsearch

After installation is completed, edit Elasticsearch configuration file “/etc/elasticsearch/elasticsearch.yml”:

# nano /etc/elasticsearch/elasticsearch.yml

Add the following content:

cluster.name: LinuxTuto
node.name: Debian 11
path.data: /var/lib/elasticsearch
network.host: 127.0.0.1 
xpack.security.enabled: false

Then start and enable the service.

# systemctl start elasticsearch
# systemctl enable elasticsearch

To confirm the status of the service of Elasticsearch, run the command:

$ sudo systemctl status elasticsearch.service
 elasticsearch.service - Elasticsearch
Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: active (running)
Docs: https://www.elastic.co
Main PID: 73979 (java)
Tasks: 100 (limit: 2301)
Memory: 1.3G
CPU: 53.939s
CGroup: /system.slice/elasticsearch.service
├─73979 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/share/elasticsearch/bin/elast>
├─74040 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manage>
└─74063 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Step 4: Test Elasticsearch

To verify that Elasticsearch is running correctly, you can use the curl command:

# curl -X GET "localhost:9200/"

If Elasticsearch is working properly, the result should be like this:

{
  "name" : "Debian 11",
  "cluster_name" : "LinuxTuto",
  "cluster_uuid" : "ezWPhn_fQLS5dcSiexroQA",
  "version" : {
    "number" : "8.7.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "09520b59b6bc1057340b55750186466ea715e30e",
    "build_date" : "2023-03-27T16:31:09.816451435Z",
    "build_snapshot" : false,
    "lucene_version" : "9.5.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

This means that Elasticsearch is active and running on your server.

Step 5: Uninstall Elasticsearch

Run the following script to remove Elasticsearch from your system.

# apt remove elasticsearch

Comments and Conclusion

In this tutorial we have installed the free version which is released under the Elastic license. You can check the Subscriptions page for more information about Elastic license levels.

For additional help or useful information, you can check the official Elasticsearch Documentation.

If you have any questions please leave a comment below.

How to Install Varnish with Nginx on AlmaLinux 9

Varnish is a popular open-source web application accelerator, also known as a caching HTTP reverse proxy, that is used to speed up dynamic web content delivery. It caches frequently accessed content and serves it directly from memory, reducing the load on the application servers and reducing the response time for users.

Varnish sits between the client and the web server and acts as an intermediary. When a user requests a web page, Varnish checks if the page is already in its cache. If it is, Varnish serves the page directly from its cache, without having to request it from the web server. If the page is not in the cache, Varnish requests it from the web server and caches it for future use.

Varnish also allows users to configure cache policies and rules to optimize caching behavior, and provides tools for monitoring and analyzing cache performance. It is commonly used by high-traffic websites to improve their performance and scalability.

In this tutorial, we will show you how to install  and configure Varnish with Nginx on AlmaLinux 9.

Step 1: Update Operating System

Update your AlmaLinux 9 operating system to make sure all existing packages are up to date:

# dnf update

Also, install the EPEL package manager to allow Varnish dependencies to be installed:

# dnf install epel-release 

Step 2: Install Nginx

You can install Nginx via dnf package manager by executing the following command.

# dnf install nginx

Nginx does not start automatically when it is installed. You can start the Nginx service and configure it to run on startup by entering the following commands:

# systemctl start nginx
# systemctl enable nginx

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

# systemctl status nginx

Output:

 nginx.service - The nginx HTTP and reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
    Drop-In: /usr/lib/systemd/system/nginx.service.d
             └─php-fpm.conf
     Active: active (running)
   Main PID: 1720 (nginx)
      Tasks: 2 (limit: 5740)
     Memory: 2.3M
        CPU: 28ms
     CGroup: /system.slice/nginx.service
             ├─1720 "nginx: master process /usr/sbin/nginx"
             └─1721 "nginx: worker process"

If firewalld is enabled consider allowing HTTP and HTTPS services:

$ sudo firewall-cmd --permanent --add-service={http,https}
$ sudo firewall-cmd --reload

Now you need to configure Nginx to work with Varnish Cache.

Open the Nginx config file /etc/nginx/nginx.conf :

 # nano /etc/nginx/nginx.conf

Search for the Listen line and change it to 8080:

.....   
    server {
        listen       8080;
        listen       [::]:8080;
        server_name  _;
        root         /usr/share/nginx/html;
 .....

Save and close the file. Then restart the Nginx service to apply the changes:

# systemctl restart nginx

Step 3: Install Varnish 7

First disable the Varnish service from the dnf package manager:

# dnf module disable varnish

By default, the latest version of Varnish is not available on the AlmaLinux 9 base repository.

So you need to run the following command to add the latest Varnish repository to your system:

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish73/script.rpm.sh | bash

After the repository is added, install Varnish using the following command:

# dnf install varnish

Check the installed version with the following command:

# varnishd -V

Output:

varnishd (varnish-7.3.0 revision 84d79120b6d17b11819a663a93160743f293e63f)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2023 Varnish Software

Now start and enable Varnish (to start automatically upon system boot):

# systemctl start varnish
# systemctl enable varnish

Verify the status using the following command:

# systemctl status varnish
● varnish.service - Varnish Cache, a high-performance HTTP accelerator
Loaded: loaded (/usr/lib/systemd/system/varnish.service; enabled; vendor preset: disabled)
Active: active (running)
Main PID: 4266 (varnishd)
Tasks: 217
Memory: 113.4M
CPU: 2.074s
CGroup: /system.slice/varnish.service
├─4266 /usr/sbin/varnishd -a :6081 -a localhost:8443,PROXY -f /etc/varnish/default.vcl -P /run/varnish/varnishd.pid -p feature=+http2 -s malloc>
└─4280 /usr/sbin/varnishd -a :6081 -a localhost:8443,PROXY -f /etc/varnish/default.vcl -P /run/varnish/varnishd.pid -p feature=+http2 -s malloc>

Step 4: Configure Varnish Cache

The default Varnish listening port is 6081. Now we need to configure Varnish to listen on port 80.

You can do it by editing /usr/lib/systemd/system/varnish.service file:

# nano /usr/lib/systemd/system/varnish.service

Add the configuration to change the port 6081 to 80 as shown below:

...
ExecStart=/usr/sbin/varnishd \
-a :80 \
-a localhost:8443,PROXY \
-f /etc/varnish/default.vcl \
-P %t/%N/varnishd.pid \
-p feature=+http2 \
-s malloc,256m
ExecReload=/usr/sbin/varnishreload
...

After the changes, restart the Varnish service for the changes to take effect.

# systemctl daemon-reload
# sudo systemctl restart varnish

Step 5: Test Varnish Cache

Test if Varnish cache is enabled and working with the Nginx service using the curl command:

# curl -I http://your-IP-address

Output:

HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Thu, 06 Apr 2023 11:22:04 GMT
Content-Type: text/html
Content-Length: 4681
Last-Modified: Sat, 09 Oct 2021 17:49:21 GMT
ETag: "6161d621-1249"
X-Varnish: 2
Age: 0
Via: 1.1 192.168.1.150 (Varnish/7.3)
Accept-Ranges: bytes
Connection: keep-alive

This means that your Varnish Cashe is active and running on your server.

Comments and Conclusion

In the tutorial, you have learned how to install and configure Varnish on AlmaLinux 9.

For additional help or useful information, you can check the official Varnish website.

How to Install and Configure CSF on AlmaLinux 9

ConfigServer Security & Firewall (CSF) is an iptables-based firewall that provides high-level security to the Linux system.

CSF includes a wide range of features, such as IP blocking, port blocking, and DoS protection. It also supports advanced security measures, such as rate limiting, connection tracking, and SSH login detection. In addition to its firewall features, CSF includes tools for system and file integrity checking, as well as email and login tracking.

Step 1: Update Operating System

Update your AlmaLinux 9 operating system to make sure all existing packages are up to date:

# dnf update

Also, install:

# dnf install wget nano tar

Step 2: Disable firewalld and any other iptables firewall

Run the following command below to sto p and disable the firewalld service:

# systemctl stop firewalld
# systemctl disable firewalld

Step 3: Install Required Perl Modules for CSF

Install the following Perl modules required by CSF.

# dnf install perl-libwww-perl.noarch perl-LWP-Protocol-https.noarch perl-GDGraph

If some modules are not available in the default repository install the epel repository using the following command:

# dnf install epel-release

Then try to install the modules again.

Step 4: Download CSF

By default, CSF is not available in the AlmaLinux standard repository, so you will need to download it from their official website.

# wget https://download.configserver.com/csf.tgz

Once downloaded, extract file with the following command:

# tar xzf csf.tgz

Change the directory to the extracted directory:

# cd csf

Install the CSF by running the installation script:

# sh install.sh

Then you can check the iptables mode using below command.

# perl /usr/local/csf/bin/csftest.pl

You should see the following output:

Testing ip_tables/iptable_filter…OK
Testing ipt_LOG…OK
Testing ipt_multiport/xt_multiport…OK
Testing ipt_REJECT…OK
Testing ipt_state/xt_state…OK
Testing ipt_limit/xt_limit…OK
Testing ipt_recent…OK
Testing xt_connlimit…OK
Testing ipt_owner/xt_owner…OK
Testing iptable_nat/ipt_REDIRECT…OK
Testing iptable_nat/ipt_DNAT…OK

RESULT: csf should function on this server

Step 5: Configuring the CSF

CSF runs in TEST mode by default. To disable it, you need to edit the /etc/csf/csf.conf file.

# nano /etc/csf/csf.conf

Locate the line TESTING = 1 and change the value to 0 or else LFD daemon fail to start.

TESTING = "0"

Locate the line RESTRICT_SYSLOG = 0 and change its value to 3. This means only members of the RESTRICT_SYSLOG_GROUP can access the syslog/rsyslog files.

RESTRICT_SYSLOG = "3"

Also, you can allow incoming and outgoing port as per your requirement:

# Allow incoming TCP ports
TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995"

# Allow outgoing TCP ports
TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995"

Once your done all the configuration, restart and enable CSF:

# systemctl restart csf && systemctl restart lfd
# systemctl enable csf && systemctl enable lfd
# systemctl status csf && systemctl status lfd

Step 6: Enable CSF GUI

By default, it is disabled in the CSF default configuration file, so you will need to enable it first. For enabling CSF GUI you need to setup Integrated User Interface section in csf.conf configuration file.

Open the CSF main configuration file with the following command:

# nano /etc/csf/csf.conf

Change the following lines:

###############################################################################
# SECTION:Integrated User Interface
###############################################################################

# 1 to enable, 0 to disable web ui 
UI = "1"

# Set port for web UI. The default port is 6666. 
UI_PORT = "8888"

# Leave blank to bind to all IP addresses on the server 
UI_IP = ""

# Set username for authetnication 
UI_USER = "admin"

# Set a strong password for authetnication 
UI_PASS = "Test@12345"

Next you need to allow the IP from where you are going to access CSF GUI. You can either allow the entire subnet or you can also choose to allow some specific IP Address like below.

# echo "YOUR_PUBLIC_IP_ADDRESS" >>  /etc/csf/ui/ui.allow

Then restart the CSF and LFD service to apply the changes.

# systemctl restart csf
# systemctl restart lfd

Step 7: Access CSF Web Interface

Open your web browser and type the URL https://your-server-IP:8888. You will be redirected to the CSF login page:

Provide your admin username and password and click on the Enter button. You should see the dashboard:

Step: 8: Manage CSF with Command Line

To list all firewall rules, run the following command:

# csf -l

To stop CSF, run the following command:

# csf -s

To allow a specific IP address, run the following command:

# csf -a IP-address

To deny an IP address, run the following command:

# csf -d IP-address

To remove blocked IP address from a CSF rule, run the following command:

# csf -dr IP-address

To verify whether the IP address is blocked or not, run the following command:

# csf -g IP-address

To flush the CSF firewall rules, run the following command:

# csf -f

To disable CSF, run the following command:

# csf -x

Step 9: Uninstall CSF and LFD on AlmaLinux

Run the following script to remove CSF and LFD from your system.

# sh /etc/csf/uninstall.sh

List of Important CSF Configuration Files

Below are the important configuration files that control the most of the rules in the CSF.

  • csf.conf – the main configuration file, it has helpful comments explaining what each option does
  • csf.allow – a list of IP’s and CIDR addresses that should always be allowed through the firewall
  • csf.deny – a list of IP’s and CIDR addresses that should never be allowed through the firewall
  • csf.ignore – a list of IP’s and CIDR addresses that lfd should ignore and not not block if detected
  • csf.*ignore – various ignore files that list files, users, IP’s that lfd should ignore. See each file for their specific purpose and tax

If you manually modify these files, you will need to restart csf and then lfd them to take effect.

Conclusion

Congratulations! You have successfully installed CSF Firewall. Thanks for using this tutorial for installing ConfigServer Security & Firewall (CSF) on your AlmaLinux 9 OS. For additional help or useful information, you can check the official CSF Firewall website.