Tag Archives: Apache

Apache Kafka on Ubuntu 24.04

How to Install Apache Kafka on Ubuntu 24.04

Apache Kafka is an open-source distributed event streaming platform used for building real-time data pipelines and applications. Originally developed by LinkedIn and now part of the Apache Software Foundation, Kafka is designed for high-throughput, low-latency, and fault-tolerant data processing across systems.

In this tutorial, we will show you the complete steps to install Apache Kafka on Ubuntu 24.04 OS.

Step 1: Update Operating System

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

# apt update && apt upgrade

Step 2: Install Java (OpenJDK) on Ubuntu 24.04

Java packages are available on Ubuntu 24.04 repositories and you can install it with the following command:

# apt install default-jdk

Check Java version after installation:

# java -version
openjdk version "21.0.6" 2025-01-21
OpenJDK Runtime Environment (build 21.0.6+7-Ubuntu-124.04.1)
OpenJDK 64-Bit Server VM (build 21.0.6+7-Ubuntu-124.04.1, mixed mode, sharing)

Step 3: Download Apache Kafka

Check the official Apache Kafka Download page to locate the latest version of the software.

The latest version at the moment is 4.0.0. You can download it with the following command:

# wget https://downloads.apache.org/kafka/4.0.0/kafka_2.13-4.0.0.tgz

Once that downloads, unpack the tarball file using the following command:

# tar xvf kafka_2.13-4.0.0.tgz

Then move this directory into the /usr/local/ directory and rename it kafka:

# mv kafka_2.13-4.0.0 /usr/local/kafka

Step 4: Create a systemd file for Apache Kafka

First navigate to Kafka’s directory:

# cd /usr/local/kafka

Then you need to generate a Cluster UUID:

# KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)"

Format Log Directories:

# bin/kafka-storage.sh format --standalone -t $KAFKA_CLUSTER_ID -c config/server.properties

Now create a systemd file so you can control the Kafka service. Create the file with the following command:

# nano /etc/systemd/system/kafka.service

In that file, paste the following content:

[Unit]
Description=Apache Kafka Server
Documentation=http://kafka.apache.org/documentation.html
Requires=zookeeper.service

[Service]
Type=simple
Environment="JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64"
ExecStart=/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties
ExecStop=/usr/local/kafka/bin/kafka-server-stop.sh

[Install]
WantedBy=multi-user.target

Save the changes and exit.

Reload system daemon and start the services:

# systemctl daemon-reload
# systemctl start kafka
# systemctl enable kafka

To confirm everything is working normally, check the status of service:

# systemctl status kafka

Output:

● kafka.service - Apache Kafka Server
     Loaded: loaded (/etc/systemd/system/kafka.service; enabled; preset: enabled)
     Active: active (running)
       Docs: http://kafka.apache.org/documentation.html
   Main PID: 11915 (java)
      Tasks: 99 (limit: 2217)
     Memory: 365.1M (peak: 365.4M)
        CPU: 16.435s
     CGroup: /system.slice/kafka.service

Step 5: Create a Kafka Topic

So before you can write your first events, you must create a topic. Create a topic named “my-events” with the following command:

# usr/local/kafka
# bin/kafka-topics.sh --create --topic my-events --bootstrap-server localhost:9092

Created topic my-events.

To verify the topic list run the following command:

# bin/kafka-topics.sh --list --bootstrap-server localhost:9092
my-events

The Kafka comes with a command-line client that will take input from a file or from standard input and send it out as events to the Kafka cluster.

By default, each line you enter will result in a separate event being written to the topic.

# bin/kafka-console-producer.sh --topic my-events --bootstrap-server localhost:9092

>Hello World!
>This is my first topic

You can stop the consumer client with Ctrl-C at any time.

If you also want to delete any data of your local Kafka environment including any events you have created along the way, run the command:

# rm -rf /tmp/kafka-logs /tmp/kraft-combined-logs

Comments and Conclusion

That’s it! You have now installed and started Apache Kafka on your Ubuntu 24.04 system.

Remember that this guide assumes you have administrative privileges on your system.

Always check the official Apache Kafka documentation for the most up-to-date installation instructions and any specific considerations related to your system configuration.

If you have any questions please leave a comment below.

How to Install Magento 2.4.7 on Ubuntu 24.04

Magento is an open-source e-commerce platform that provides online merchants with a flexible shopping cart system, as well as control over the look, content, and functionality of their online stores. It also has a large community of developers and users who contribute to its ongoing development and provide support through forums, documentation, and other resources.

Magento comes in two main editions: Magento Open Source (formerly known as Magento Community Edition) and Magento Commerce (formerly known as Magento Enterprise Edition). The Open Source edition is free to use and provides basic e-commerce functionality, while the Commerce edition is a paid version that includes more advanced features such as customer segmentation, targeted promotions, and advanced marketing tools.

In this tutorial we will show you how to install the Open Source version of Magento 2.4.7 on Ubuntu 24.04 OS.

Before starting the installation, you can check the system requirement for installing Magento 2.4.7.

Step 1: Update Operating System

Update your Ubuntu 24.04 operating system to make sure all existing packages are up to date:

# apt update && apt upgrade

Step 2: Install Apache web server

To install Apache web server, run 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 (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 22413 (apache2)
      Tasks: 6 (limit: 2130)
     Memory: 16.8M (peak: 17.0M)
        CPU: 658ms
     CGroup: /system.slice/apache2.service
             ├─22413 /usr/sbin/apache2 -k start
             ├─22468 /usr/sbin/apache2 -k start
             ├─22469 /usr/sbin/apache2 -k start
             ├─22470 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions

Magento 2.4.7 comes with support for the latest PHP 8.3, while PHP 8.2 remains fully supported. By default, PHP 8.3 is included in the Ubuntu 24.04 default repository.

You can install PHP 8.3 and required PHP extensions using the following command:

# apt install php php-exif php-bz2 php-bcmath php-intl php-soap php-zip php-curl php-mbstring php-mysql php-gd php-xml

Verify if PHP is installed.

php -v
Output:
PHP 8.3.0-1ubuntu1 (cli) (built: Jan 19 2024 14:00:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.0-1ubuntu1, 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.3/apache2/php.ini

Change the following data:

short_open_tag = On
memory_limit = 512M
upload_max_filesize = 128M
max_execution_time = 3600

Then save this php.ini file.

After that, you should restart the Apache web server for the configuration to take effect:

# systemctl restart apache2

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 (/usr/lib/systemd/system/mysql.service; enabled; preset: enabled)
     Active: active (running)
    Process: 2907 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 2919 (mysqld)
     Status: "Server is operational"
      Tasks: 37 (limit: 2130)
     Memory: 362.8M (peak: 379.2M)
        CPU: 1.737s
     CGroup: /system.slice/mysql.service
             └─2919 /usr/sbin/mysqld

By default, MySQL 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 run the command below to log in to the MySQL shell.

# mysql -u root -p

Once you are logged in to your database server to create a database, database user, and grant all privileges to the database user run the following commands:

mysql> CREATE DATABASE magentodb;
mysql> CREATE USER 'magentouser'@'localhost' IDENTIFIED BY 'Str0ngPa$$w0rd';
mysql> GRANT ALL ON magentodb.* TO 'magentouser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> EXIT

Step 5: Installing Elasticsearch

Starting Magento 2.4, all installations must be configured to use Elasticsearch as the catalog search engine.

Import the Elasticsearch GPG key:

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

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

Update the apt package manager and install Elasticsearch:

# apt update && apt install elasticsearch

Then start and enable the service:

# systemctl start elasticsearch
# systemctl enable elasticsearch

Open the elasticsearch.yml file:

# nano  /etc/elasticsearch/elasticsearch.yml

Then uncomment the lines and update the values:

node.name: "ubuntu"
cluster.name: magento 2.4.7
network.host: 127.0.0.1
http.port: 9200
xpack.security.enabled: false

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

# systemctl restart elasticsearch

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

# curl -X GET "localhost:9200/"

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

{
  "name" : "ubuntu",
  "cluster_name" : "magento 2.4.7",
  "cluster_uuid" : "nKzTibHRT_ahq6lCsWk6Ew",
  "version" : {
    "number" : "8.13.1",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "9287f29bba5e270bd51d557b8daccb7d118ba247",
    "build_date" : "2024-03-29T10:05:29.787251984Z",
    "build_snapshot" : false,
    "lucene_version" : "9.10.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Step 6: Install Composer

To download Composer, run the following 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
# chmod +x   /usr/local/bin/composer

Verify the Composer version installed:

# composer --version

Output:
Composer version 2.7.2 2024-03-11 17:12:18

Step 7: Install Magento 2.4.7

For most situation it is recommended to install Magento using the Marketplace by creating access key.

To get the access keys, you should create an account in the Magento marketplace.

Then for generating access keys go to:

My profile > Marketplace > My products > Access Keys

Once access keys are generated run the following  command to download Magento 2.4.7:

# composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.7 /var/www/magento2

Username : Your Public Key
Password : Your Private Key

Navigate to the Magento directory:

# cd /var/www/magento2

Chmod cache and static content folder:

# find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +

Change the ownership of the magento2 directory to the webserver user and also the permissions:

# chown -R www-data:www-data /var/www/magento2
# chmod -R 755 /var/www/magento2

Now, install Magento using the composer command, type:

# bin/magento setup:install \
--base-url=http://your-domain.com \
--db-host=localhost \
--db-name=magentodb \
--db-user=magentouser \
--db-password='Str0ngPa$$w0rd' \
--admin-firstname=Admin \
--admin-lastname=User \
--admin-email=admin@your-domain.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1

After the installation process you will see the admin link for your Magento site.

[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_nuqh2y
Nothing to import.

Step 8: Configure Apache for Magento 2.4.7

Run the command below to create a new VirtualHost file in the /etc/apache2/sites-available/ directory:

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

Paste the content as shown below:

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

    <Directory /var/www/magento2/> 
        AllowOverride 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.

Next run the following command to enable rewrite module:

# a2enmod rewrite

To enable this site run the command:

# a2ensite magento2.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 9: Access your Magento 2.4.7 Application

Open your browser and type your domain http://your-domain.com

Comments and Conclusion

That’s it. You have successfully installed Open Source version of Magento 2.4.7 on Ubuntu 24.04.

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

If you have any questions please leave a comment below.

How to Install Jupyter Notebook on Debian 12

Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It’s widely used in various fields such as data science, machine learning, scientific computing, and education.

The term “Jupyter” is derived from the combination of three programming languages: Julia, Python, and R. These were the first languages supported by the Jupyter project, but now it supports many other programming languages through its interactive computing protocol.

In this tutorial, we will show you how to install Jupyter Notebook on Debian 12 OS with Apache web server

Step 1: Update Operating System

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

# apt update && apt upgrade -y

Step 2: Install Pip on Debian 12

Python comes already installed by default on Debian 12. You can verify it by checking its version:

# python3 -V
Output:
Python 3.11.2

If it doesn’t, install Python with the following command:

# apt install python3

Then use the following command to install pip and venv on Debian 12:

# apt install python3-venv python3-pip

Verify your pip installation by checking its version:

# pip3 --version
Output:
pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)

Step 3: Install Jupyter Notebook Using Virtualenv

First, create a directory and switch to it with the commands below:

# mkdir /var/www/notebook 
# cd /var/www/notebook

Before you install Jupyter Notebook, you first need to create a Python virtual environment.

# python3 -m venv notebook_env

Next, activate the virtual environment with the following command:

# source notebook_env/bin/activate

Next, install Jupyter Notebook using the following command:

(notebook_env) # pip install jupyter

Once the installation is completed, run the Jupyter Notebook with the following command:

(notebook_env) # jupyter notebook --allow-root

Press the CTRL+C to stop the Jupyter Notebook.

Step 4: Generate Jupyter Notebook Password

First, generate a Jupyter Notebook configuration file with the following command:

(notebook_env) # jupyter notebook --generate-config

You should see the following output:

Writing default config to: /root/.jupyter/jupyter_notebook_config.py

Then run the following command and enter your preferred password:

(notebook_env) # jupyter notebook password

Set a password as shown below:

Enter password: 
Verify password: 
[JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json

This can be used to reset a lost password or if you believe your credentials have been leaked and desire to change your password.

You can prepare a hashed password manually, using the function jupyter_server.auth.passwd():

>>> jupyter_server.auth import passwd
>>> passwd()
Enter password:
Verify password:
'argon2:$argon2id$v=19$m=10240,t=10,p=8$WGqsBZQPacu0FwsczXPlIQ$VXMyCfkJJZETyjdB6aWNSu/t0OrLAVhpkM15wKJYQRU'

Then add the hashed password to your jupyter_notebook_config.py file:

nano /root/.jupyter/jupyter_notebook_config.py
c.ServerApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$WGqsBZQPacu0FwsczXPlIQ$VXMyCfkJJZETyjdB6aWNSu/t0OrLAVhpkM15wKJYQRU'

Now, deactivate from the Python virtual environment with the following command:

deactivate

Step 5: Create a Systemd service

Next, it is a good idea to create a systemd service file to handle the Jupyter Notebook service. You can create it with the following command:

# nano /lib/systemd/system/jupyter.service

Add the following lines:

[Unit]
Description=Jupyter Notebook

[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/var/www/notebook/notebook_env/bin/jupyter-notebook --config=/root/.jupyter/jupyter_notebook_config.py --allow-root
User=root
Group=root
WorkingDirectory=/var/www/notebook/notebook_env
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Save and close the file and then reload the systemd daemon with the following command:

# systemctl daemon-reload

Then start the jupyter service and activate it at system startup with the following command:

# systemctl start jupyter
# systemctl enable jupyter

Edit the configuration file and enable remote access:

nano /root/.jupyter/jupyter_notebook_config.py

Uncoment and change the following line to True:

c.ServerApp.allow_remote_access = True

To implement the changes, you need to restart the jupyter service:

# systemctl restart jupyter

Step 6: Configure Apache as a Reverse Proxy for Jupyter Notebook

Jupyter Notebook is started and running on port 8888.You can install it via apt package manager by executing the following command.

# apt install apache2

You can verify the status of the Apache service using the systemctl status command:

# systemctl status apache2

Next run the following commands to enable necessary modules:

# /usr/sbin/a2enmod proxy
# /usr/sbin/a2enmod proxy_http

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

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

Paste the content as shown below:

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

    ProxyPass / http://127.0.0.1:8888/
    ProxyPassReverse / http://127.0.0.1:8888/> 

    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.

Then save and exit the configuration file.

To enable this site run the following command:

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

To implement the changes, you need to restart the Apache webserver:

# systemctl restart apache2

Step 7: Accessing Jupyter Notebook Web Interface

Open your web browser using the URL http://your-domain.com. You should see the Jupyter login page:

Enter your password and click on the Login button. You should see the dashboard on the following screen:

Comments and Conclusion

That’s it. You have successfully installed Jupyter Notebook on Debian 12.

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

If you have any questions please leave a comment below.

How to Install Dolibarr ERP on Debian 12

Dolibarr ERP is an open-source software suite designed to help businesses and organizations manage various aspects of their operations. It provides modules for a wide range of business functions, making it a comprehensive solution for small and medium-sized enterprises (SMEs). Dolibarr is written in PHP and is often used as a web application, making it accessible from different devices with a web browser.

Dolibarr ERP is suitable for a variety of businesses, particularly those in the SME sector. It provides a cost-effective solution for managing key business processes and can be adapted to different industries and sectors. As an open-source solution, it offers flexibility and the ability to tailor the system to specific organizational needs.

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

Also, install necessary packages.

# apt install curl nano wget unzip zip

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/
    Process: 13773 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 13777 (apache2)
      Tasks: 7 (limit: 2273)
     Memory: 37.4M
        CPU: 494ms
     CGroup: /system.slice/apache2.service
             ├─13777 /usr/sbin/apache2 -k start
             ├─13778 /usr/sbin/apache2 -k start
             ├─13779 /usr/sbin/apache2 -k start
             ├─13780 /usr/sbin/apache2 -k start

Step 3: Install PHP and required extensions

By default, Debian12 comes with PHP version 8.2. To install PHP and the necessary extensions, run the following command:

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

Once the installation is complete 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

Then edit the php.ini file:

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

Change the following settings:

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

Restart the Apache service to apply the changes:

# 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.6 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: 10002 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 2273)
     Memory: 242.0M
        CPU: 1.918s
     CGroup: /system.slice/mariadb.service
             └─10002 /usr/sbin/mariadbd

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

# mysql -u root

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

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

Step 5: Download Dolibarr

The latest version of Dolibarr is available to download from GitHub. You can download it with the following command:

# wget https://github.com/Dolibarr/dolibarr/archive/refs/tags/19.0.0.zip

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

# unzip 19.0.0.zip -d /var/www/
# mkdir /var/www/dolibarr
# mv /var/www/dolibarr-19.0.0/htdocs/* /var/www/dolibarr

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

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

Step 6: Configure Apache for Dolibarr

To create a new VirtualHost file run the following commands:

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

Paste the content as shown below:

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

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

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:

# /usr/sbin/a2ensite dolibarr.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 7: Access Dolibarr Web Interface

To complete the setup go to your browser and visit http://your-domain.com.

Select your language and click on the Next step button. You should see the following page:

Validate the PHP checks and click on the Start button. You should see the following page:

Provide your database name, database username, password, admin username and password. Then, click on the Next step button.

Installation successful, click on the Next step button.

Click on the Next step button.

Set a new admin username and password. Then, click on the Next step button.

Click on the Go to Dolibarr button and you should see the login page:

Provide your admin username and password. Then, click on the LOGIN button.

To finalize the installation and remove the installation warnings on the dashboard, run the following commands:

# touch /var/www/dolibarr/documents/install.lock
# chown root:root /var/www/dolibarr/conf/conf.php

Comments and Conclusion

That’s it. You have successfully installed Dolibarr ERP on Debian 12.

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

If you have any questions please leave a comment below.

How to Configure Odoo with Apache as Reverse Proxy on Debian 12

Odoo is an open-source suite of integrated business applications that includes various modules for different business needs. Odoo is developed using the Python programming language and follows a modular architecture, allowing users to select and deploy the specific modules that suit their business requirements.

The system is highly customizable, and it covers a wide range of business functions. It provides a comprehensive set of tools to manage various aspects of a business, from sales and finance to human resources and inventory management.

In this tutorial, we will show you how to configure Odoo with Apache 2 as Reverse Proxy on Debian 12 OS.

If you do not have Odoo installed on your server you can follow our tutorial how to install Odoo 17 on Debian 12.

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

You can verify the status of the Apache service using the 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/
    Process: 1127 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 1131 (apache2)
      Tasks: 6 (limit: 2273)
     Memory: 18.4M
        CPU: 86ms
     CGroup: /system.slice/apache2.service
             ├─1131 /usr/sbin/apache2 -k start
             ├─1132 /usr/sbin/apache2 -k start
             ├─1133 /usr/sbin/apache2 -k start

Step 3: Enable Apache Modules

Next run the following commands to enable all necessary modules:

# /usr/sbin/a2enmod rewrite
# /usr/sbin/a2enmod proxy
# /usr/sbin/a2enmod proxy_http
# /usr/sbin/a2enmod proxy_html
# /usr/sbin/a2enmod headers

Then restart the Apache web server:

# systemctl restart apache2

Step 4: Configure Apache for Odoo

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

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

Paste the content as shown below:

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

    ProxyPass / http://127.0.0.1:8069/
    ProxyPassReverse / http://127.0.0.1:8069/> 

    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.

Then save and exit the configuration file.

To enable this site run the following command:

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

To implement the changes, you need to restart the Apache webserver:

# systemctl restart apache2

Step 5: Install free Let’s Encrypt SSL certificate (Optional)

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

# apt install certbot python3-certbot-apache

Then to get the SSL certificate using the Certbot, type the following command:

# 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 2024-03-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 6:  Odoo Proxy Configuration

Make sure that Odoo is configured to work behind a proxy. In the Odoo configuration file (/etc/odoo.conf), you need to set the proxy_mode parameter to True:

proxy_mode = True

After making the changes, it’s important to restart the Odoo service to ensure the changes take effect:

# systemctl restart odoo

Step 7: Access Odoo server

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

Comments and Conclusion

Congratulations! You have successfully configured Odoo with Apache 2 as Reverse Proxy on your Debian 12 OS.

For additional information, you can check the official Odoo documentation.

If you have any questions please leave a comment below.

How to Install MediaWiki on Debian 12

MediaWiki is a free and open-source wiki software platform used to power various wikis, including the most well-known one, Wikipedia.

MediaWiki is written in PHP and uses a backend database (usually MySQL or MariaDB) to store the content. It provides a powerful platform for creating collaborative websites, knowledge bases, documentation systems, and more.

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

Also, install necessary packages.

# apt install curl nano wget unzip zip

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/
    Process: 24002 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 24006 (apache2)
      Tasks: 6 (limit: 2273)
     Memory: 23.4M
        CPU: 13.701s
     CGroup: /system.slice/apache2.service
             ├─24006 /usr/sbin/apache2 -k start
             ├─24206 /usr/sbin/apache2 -k start
             ├─24207 /usr/sbin/apache2 -k start
             ├─24208 /usr/sbin/apache2 -k start

Step 3: Install PHP and required extensions

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

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

Once the installation is complete 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

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.4 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: 24964 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 12 (limit: 2273)
     Memory: 87.9M
        CPU: 4.312s
     CGroup: /system.slice/mariadb.service
             └─24964 /usr/sbin/mariadbd

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

# mysql -u root

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

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

Step 5: Install Composer dependency manager

To install Composer, run the following commands:

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

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

# composer --version
Composer version 2.6.6 2023-12-08 18:32:26

Step 6: Download MediaWiki

The latest version of MediaWiki is available to from the official website of MediaWiki. You can download it with the following command:

# wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.1.zip

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

# unzip mediawiki-1.40.1.zip -d /var/www/

Rename it to make it simpler:

# mv /var/www/mediawiki-1.40.1/ /var/www/mediawiki

Now, install all PHP dependencies using the following command:

# cd /var/www/mediawiki && composer install --no-dev

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

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

Step 7: Configure Apache for MediaWiki

To create a new VirtualHost file run the following commands:

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

Paste the content as shown below:

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

    <Directory /var/www/mediawiki/> 
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        allow from all
    </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.

To enable this site run the command:

# /usr/sbin/a2ensite mediawiki.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 8: Access MediaWiki Web Interface

To complete the setup go to your browser and visit http://your-domain.com.

Start the setup clicking on the link to “set up the wiki”.

Choose language and click on the Continue button.

If everything is OK, you will get the message “The environment has been checked. You can install MediaWiki”. Click “Continue” to advance to the next step.

Add the database information such as the Database name, username, and password that you have created in the previous step.

Click on the Continue button.

Provide your website name, admin username, password and click on the Continue button.

Click on the “Continue” button.

Click on the “Continue” button. and the system will generate a “LocalSettings.php” that contains all the configuration you have done.

Copy the file to the /var/www//mediawiki directory. Then, set the correct ownership using the following command:

# chown www-data:www-data /var/www/mediawiki/LocalSettings.php

Once you have completed this last step you will be redirected to the MediaWiki dashboard:

Comments and Conclusion

Congratulations! You have successfully installed Mediawiki with Apache on your Debian 12 OS.

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

If you have any questions please leave a comment below.

How to Install SuiteCRM on Debian 12

SuiteCRM is a free and open-source Customer Relationship Management (CRM) platform that is designed to help businesses to manage their customer relationships, sales, marketing, and customer support activities.

It is a popular choice for organizations looking for a cost-effective CRM solution with extensive customization options.

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

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 && apt upgrade

Step 2: Install Apache Web Server

To install Apache, run 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; preset: enabled)
     Active: active (running)
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 2024 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 2028 (apache2)
      Tasks: 7 (limit: 2273)
     Memory: 19.2M
        CPU: 180ms
     CGroup: /system.slice/apache2.service
             ├─2028 /usr/sbin/apache2 -k start
             ├─2029 /usr/sbin/apache2 -k start
             ├─2030 /usr/sbin/apache2 -k start

Step 3: Install PHP and PHP extensions for SuiteCRM

By default, Debian12 comes with PHP version 8.2. To install PHP and the necessary extensions, run the following command:

# apt install php php-cli libapache2-mod-php php-json php-common php-mysql php-zip php-gd php-imap php-mbstring php-curl php-xml php-ldap php-pear

Once the installation is complete 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

Then edit the php.ini file:

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

Change the following settings:

memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 32M

Restart the Apache service to apply the changes:

# systemctl restart apache2

Step 4: Install MariaDB and create a database

You can install the MariaDB server with the following command:

# apt install mariadb-server mariadb-client

Start the database server daemon, and also enable it to start automatically at the next boot with the following commands:

# systemctl start mariadb
# systemctl enable mariadb

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: 774 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 2273)
     Memory: 245.4M
        CPU: 5.791s
     CGroup: /system.slice/mariadb.service
             └─774 /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 SuiteCRM installation:

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

Step 5: Download SuiteCRM

Download the latest stable version of SuiteCRM from the SuiteCRM website using the following command:

# wget https://suitecrm.com/download/141/suite714/562969/suitecrm-7-14-0.zip

Unzip the downloaded release file with the following command:

# unzip suitecrm-7-14-0.zip

Rename it to make it simpler:

# mv /var/www/SuiteCRM-7.14.0/ /var/www/suitecrm

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

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

Step 6: Create Virtualhost for SuiteCRM

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

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

Paste the content as shown below:

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

    <Directory /var/www/suitecrm/>
	Options Indexes FollowSymLinks
	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 suitecrm.your-domain.com with the domain name of your server.

Save and exit the configuration file.

Then enable the "rewrite" module in Apache:

# /usr/sbin/a2enmod rewrite

To enable this site run the command:

To enable this site run the command:

# /usr/sbin/a2ensite suitecrm.conf

To implement the changes, restart Apache webserver:

# systemctl restart apache2

Step 7: Access SuiteCRM Web Interface

Go to your browser and visit http://suitecrm.your-domain.com. You should see the following page:

The first page displays the license agreement. Scroll down Accept the License agreement and click Next.

If everything is okay, click the Next button.

Provide your database name, database username, password, admin username and password. Then, click on the Next button.

You are presented with the details of SuiteCRM configuration completion. Click the Next button and you should see the login page:

Provide your admin credential and click on the LOG IN button, you should see the SuiteCRM dashboard in the following page:

Step 8: Set up Cron Jobs

SuiteCRM needs cron jobs to function properly. Edit the www-data user’s crontab file.

# sudo crontab -e -u www-data

Add the following line at the end of the file.

*    *    *    *    *     cd /var/www/suitecrm; php -f cron.php > /dev/null 2>&1

Save and close the file.

Comments and Conclusion

That’s it. You have successfully installed SuiteCRM on Debian 12.

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

If you have any questions please leave a comment below.

How to Install AWStats with Apache on Debian 12

AWStats (Advanced Web Statistics) is an open-source web analytics tool that analyzes and generates comprehensive reports about web server log files. It provides detailed information about various aspects of web traffic and visitor behavior on a website.

It’s important to note that AWStats relies on server log files, so it may not provide real-time data and requires proper configuration to work effectively.

In this tutorial, we will show you how to install AWStats 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/
    Process: 928 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 933 (apache2)
      Tasks: 56 (limit: 2273)
     Memory: 11.2M
        CPU: 1.891s
     CGroup: /system.slice/apache2.service
             ├─933 /usr/sbin/apache2 -k start
             ├─934 /usr/sbin/apache2 -k start
             ├─935 /usr/sbin/apache2 -k start
             └─936 /usr/sbin/apache2 -k start

Step 3: Install AWStats

To install AWStats, you need to run the following command:

# apt install awstats

This command will start the installation process. It will resolve dependencies, run a transaction check, and install the necessary packages.

To get GeoIP information install the following Perl packages:

# apt install libgeo-ip-perl libgeo-ipfree-perl

Step 4: Configure AWStats

Once the installation routine is completed, edit the file awstats.conf as follows:

LogFile="/var/log/apache2/access.log"
LogFormat=1
SiteDomain="your-domain.com"
HostAliases=”www.your-domain.com your-domain.com”
DNSLookup=0
AllowFullYearView=3
LoadPlugin="tooltips"

Step 5: Configure Apache for AWStats

Open the Apache configuration file /etc/apache2/conf-available/awstats.conf :

# nano /etc/apache2/conf-available/awstats.conf

Paste the content as shown below:

Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /awstats/ /usr/lib/cgi-bin/
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Save and exit the configuration file.

To enable this conf run the command:

# ln -s /etc/apache2/conf-available/awstats.conf /etc/apache2/conf-enabled/awstats.conf

Then enable the "cgi" module in Apache:

# /usr/sbin/a2enmod cgi

To implement the changes, restart Apache webserver:

# systemctl restart apache2

To implement the changes, restart Apache webserver:

# systemctl restart apache2

You can see how the installation is progressing by pointing your web browser to:

# http://your-domain.com/cgi-bin/awstats.pl

The top line displays the time when statistics were updated. It probably reads ‘Never updated’. It is all right, you just have to manually run the first update.

# /usr/lib/cgi-bin/awstats.pl -config=your-domain.com -update

After it is done, if it is successful, with no errors, you should get some output like:

Create/Update database for config "/etc/awstats/awstats.conf" by AWStats version 7.8 (build 20200416)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 4258
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 4258 new qualified records.

Step 6: Secure Your AWStats via .htaccess

A basic, simple way of restricting access is to set up a http password. Open your apache2 configuration file

# nano /etc/apache2/sites-available/your-domain.com.conf

Paste the content as shown below:

<Directory /usr/lib/cgi-bin/>
    Options +ExecCGI
    AddHandler cgi-script .cgi
    AuthType Basic
    AuthName 'Password Protected Area'
    AuthUserFile '/usr/lib/cgi-bin/.htpasswd'
    Require valid-user
</Directory>

If you don’t  have a password that can be used for this purpose, the command htpasswd can do it for you.

# htpasswd -cb /usr/lib/cgi-bin/.htpasswd admin Str0ngPassw0rd

Comments and Conclusion

Congratulations! You have successfully installed AWStats with Apache on your Debian 12 OS.

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