Install Laravel Debian 12

How to Install Laravel on Debian 12

Laravel is a free, open-source PHP web application framework used for web development. It follows the Model-View-Controller (MVC) architectural pattern and provides an elegant syntax and tools for tasks such as routing, templating, authentication, and more. Laravel aims to make web development tasks more enjoyable and efficient by providing a clean and expressive syntax, along with a set of conventions and tools for common tasks.

Laravel has gained popularity in the PHP development community due to its elegant syntax, developer-friendly features, and active community. It is widely used for building web applications, APIs, and various other web-based projects.

In this tutorial, we will show you how to install Laravel on Debian 12 OS with Nginx web server and MariaDB database server.

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

Also, install necessary packages.

# apt install sudo nano wget unzip zip

Step 2: Install Nginx Web Server

To install Nginx web server, run the following command:

# apt install nginx

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

Step 3: Install PHP and PHP extensions

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

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

Verify if PHP is installed.

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

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

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

Change the following settings per your requirements:

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

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

# systemctl restart php8.2-fpm

Step 4: Install MariaDB and create a database

You can install MariaDB 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

Once the database server is installed, log into the MariaDB prompt:

# mysql -u root

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

MariaDB [(none)]> CREATE DATABASE laravel_db;
MariaDB [(none)]> CREATE USER 'laravel_user'@'localhost' IDENTIFIED BY 'Str0ngPa$$word';
MariaDB [(none)]> GRANT ALL ON laravel_db.* TO 'laravel_user'@'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.5.8 2023-06-09 17:13:21

Step 6: Install Laravel 

Navigate to the webroot directory, type:

# cd /var/www/html

Now, install Laravel using the composer command, type:

# composer create-project laravel/laravel laravelapp

The command creates a new directory called laravelapp and installs all the files and directories for Laravel.

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

# chown -R www-data:www-data /var/www/html/laravelapp
# chmod -R 775 /var/www/html/laravelapp/storage

Once the installation is done navigate to the installation directory and check the Laravel version:

# cd laravelapp
# php artisan

Step 7: Configure Nginx Web Server for Laravel

Navigate to /etc/nginx/conf.d directory and run the following command to create a configuration file:

# nano /etc/nginx/conf.d/laravel.conf

Add the following content:

server {
    listen 80;
    listen [::]:80;
    server_name your-domain.com;
    root /var/www/html/laravelapp/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

Save the file and Exit.

Check Nginx syntax:

# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

To implement the changes, restart Nginx webserver:

# systemctl restart nginx

Step 8: Access your Laravel Application

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

Comments and Conclusion

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

For additional help or useful information, we recommend you to check  the official Laravel 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 RainLoop on Debian 12

RainLoop is an open-source web-based email client that allows users to access their email accounts through a web browser. It provides a user-friendly interface for managing emails, contacts, and other related tasks without the need for a dedicated email client like Outlook or Thunderbird.

It is designed to be lightweight, fast, and easy to install, making it a popular choice for those who want a simple webmail solution.

In this tutorial, we will show you how to install RainLoop on Debian 12 OS with Nginx web server and MariaDB database server..

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 Nginx webserver

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

# apt install nginx

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

# systemctl status nginx

Step 3: Install PHP

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

# apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-imap php-mbstring php-curl php-xml

Once the installation is complete verify if PHP is installed:

php -v
Output:
PHP 8.2.12 (cli) (built: Oct 27 2023 13:00:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies

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

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

Change the following settings per your requirements:

max_execution_time = 300
memory_limit = 512M
post_max_size = 25M
upload_max_filesize = 25M

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

# systemctl restart php8.2-fpm

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

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 Roundcube installation:

mysql> CREATE DATABASE rainloop;
mysql> CREATE USER 'rainloopuser'@'localhost' IDENTIFIED BY 'Str0ngPa$$word';
mysql> GRANT ALL PRIVILEGES ON rainloop . * TO 'rainloopuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit;

Step 5: Download RainLoop

You can download the latest stable release version for RainLoop with the following command:

# https://www.rainloop.net/repository/webmail/rainloop-latest.zip

After that, you will need to decompress the RainLoop archive:

# unzip rainloop-latest.zip -d /var/www/rainloop/

Make Nginx the owner of the rainloop folder and grant it sufficient permissions.

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

Step 6: Configure Nginx for RainLoop

Then, create an virtual host configuration file:

# nano /etc/nginx/conf.d/rainloop.conf

Add the following lines:

server {

listen 80;

   server_name webmail.your-domain.com;
   root /var/www/rainloop;

   index index.php;

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

location ~ \.php$ {
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_keep_conn on;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

location ^~ /data {
        deny all;
    }

}

Save and exit the configuration file.

Check Nginx syntax:

# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

To implement the changes, restart Nginx webserver:

# systemctl restart nginx

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-nginx

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

# certbot --nginx -d webmail.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/webmail.your-domain.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/webmail.your-domain.com/privkey.pem
   Your cert will expire on 2024-03-06. 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: RainLoop Setup and Configurations

Now open your web browser and go to https://webmail.your-domain.com/?admin and you will see the following screen:

You can log in with the default username admin and default password 12345

You will see the Rainloop dashboard as below:

When you login for the first time, you need to change your admin password immediately.

Enter your new password and click on the Update Password button to change the password.

Then, open the Contacts menu and select MySQL from the dropdown menu:

Enter the database credentials you created earlier and press the Test button to check the connection and install the necessary tables.

If the button turns green, it means the connection is successful.

Comments and Conclusion

Congratulations. You have learned how to install RainLoop on Debian 12 OS.

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

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 PHP 8.3 on Ubuntu 22.04

PHP, which stands for “Hypertext Preprocessor,” is a server-side scripting language widely used for web development. PHP is often used to create dynamic web pages, handle forms, interact with databases, and perform various server-side tasks.

It has been a popular choice for web development for many years, and despite the emergence of other languages and frameworks, it continues to be widely used in the industry.

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

Update Operating System

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

# apt update && apt upgrade

Add PHP Repository

By default, PHP 8.3 is not included in the Ubuntu 22.04 default repository.  So you will need to add Ondrej Sury PPA into your system.

First, install the required packages using the following command:

# apt-get install ca-certificates apt-transport-https software-properties-common

Once all the packages are installed, add this PPA using the following command:

# add-apt-repository ppa:ondrej/php

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

# apt-get update

Install PHP 8.3

Now, you can install the PHP 8.3 using the following command:

# apt-get install php8.3

Once the PHP is installed, you can check the PHP version on your system with the following command:

# php8.3 --version

Output:

# PHP 8.3.0 (cli) (built: Nov 24 2023 08:50:08) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.0, Copyright (c), by Zend Technologies

Install PHP 8.3 for Apache

To install PHP as an Apache module, execute:

# apt install libapache2-mod-php8.3

Then, restart Apache to integrate the new PHP module:

# systemctl restart apache2

Install PHP 8.3 FPM for Nginx

For the Nginx web server, you need to install the FPM service, you can install it using the following command:

# apt install php8.3-fpm

Once the installation has been completed, you can confirm that the PHP-FPM service has been installed correctly with the following command:

# systemctl status php8.3-fpm

Output:

● php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php8.3-fpm.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: man:php-fpm8.3(8)
    Process: 58796 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.3/fpm/pool.d/www.conf 83 (code=exited, status=0>
   Main PID: 58793 (php-fpm8.3)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 2178)
     Memory: 7.5M
        CPU: 34ms
     CGroup: /system.slice/php8.3-fpm.service
             ├─58793 "php-fpm: master process (/etc/php/8.3/fpm/php-fpm.conf)
├─58794 php-fpm: pool www
└─58795 php-fpm: pool www

Install PHP Extension

Installing PHP extensions are simple with the below-mentioned syntax:

# sudo apt install php8.3-[extension]

Replace [extension] with the extension you want to install, if you want to add multiple extensions then include them in braces:

# apt install php8.3-mysql php8.3-imap php8.3-ldap php8.3-xml php8.3-curl php8.3-mbstring php8.3-zip

To check loaded PHP modules use the command:

# php8.3 -m

Example Output:

[PHP Modules]
..............
fileinfo
filter
ftp
gettext
hash
iconv
imap
json
ldap
libxml
mbstring
mysqli
mysqlnd
..............

[Zend Modules]
Zend OPcache

Running PHP 8.3 with Other Versions

Instead of removing old PHP versions, it is also possible to run multiple PHP versions side-by-side.

The update-alternatives command provides an easy way to switch between PHP versions for PHP CLI.

# update-alternatives --config php

This brings up a prompt to interactively select the alternative PHP binary path that php points to.

There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/php8.3   81        auto mode
  1            /usr/bin/php8.1   81        manual mode
  2            /usr/bin/php8.3   83        manual mode

To set the path without the interactive prompt:

# update-alternatives --set php /usr/bin/php8.1

Comments and Conclusion

In the tutorial, you have learned how to install PHP 8.3 on Ubuntu 22.04.

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

If you have any questions please leave a comment below.

How to Install Odoo 17 on Debian 12

Odoo is an open-source suite of business management software applications that encompasses a wide range of business needs, including customer relationship management (CRM), sales, project management, inventory management, manufacturing, financial management, and more.

It is widely used by businesses of various sizes and across different industries to streamline their operations, improve productivity, and manage their business processes more efficiently. Its flexibility, scalability, and cost-effectiveness make it a popular choice for organizations seeking comprehensive business management solutions.

In this tutorial, we will show you how to install Odoo 17 on Debian 12 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

Then install all the required packages for the Odoo 17 setup on the Debian 12 OS.

# apt install python3 python3-dev python3-pip python3-venv python3-setuptools build-essential libzip-dev libxslt1-dev libldap2-dev python3-wheel libsasl2-dev node-less libjpeg-dev xfonts-75dpi xfonts-base libpq-dev libffi-dev fontconfig git wget nodejs npm

Step 2: Install PostgreSQL

Odoo uses PostgreSQL as a database backend, so you will need to install PostgreSQL on your server.

You can run the following command to install the PostgreSQL server:

# apt-get install postgresql-15

After the successful installation, start the PostgreSQL service and enable it to start after the system reboot:

# systemctl start postgresql
# systemctl enable postgresql

Verify that is active and running on your server:

# systemctl status postgresql
Output
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; preset: enabled)
     Active: active (exited)
   Main PID: 18666 (code=exited, status=0/SUCCESS)
        CPU: 2ms

Now create an Odoo user in PostgreSQL:

# su - postgres -c "createuser -s odoo" 

This will add a new role odoo in the PostgreSQL server.

Step 3: Install Node.js

To install Node.js and npm on your Debian OS use the following command:

# apt install nodejs npm

Also, install the following module to enable RTL support:

# npm install -g rtlcss

Step 4: Installation of wkhtmltox

To generate PDF reports successfully, wkhtmltopdf is necessary. PDF reports are a crucial component of any organization.

First install the xfonts dependency before installing wkhtmltopdf:

# apt-get install xfonts-75dpi xfonts-base

Now download and install wkhtmltopdf using the following commands:

# wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
# dpkg -i wkhtmltox_0.12.6.1-3.bookworm_amd64.deb

Verify if the wkhtmltopdf installation is successful by checking the version:

# wkhtmltopdf --version
wkhtmltopdf 0.12.6.1 (with patched qt)

Step 5: Create an Odoo User

Create a new system user for managing the Odoo processes on the Odoo server.

# adduser --system --group --home=/opt/odoo --shell=/bin/bash odoo

Step 6: Install Odoo

Switch to the user that you have created before to avoid encountering issues related to access rights.

# su - odoo

Now, download the Odoo 17 source code from the git repository and install it:

# git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 /opt/odoo/odoo

Next run the following command to generate a new Python virtual environment.

# python3 -m venv odoo-env

Activate the virtual environment with the following command:

# source odoo-env/bin/activate

Then install the required Python packages:

(odoo-env) $ pip3 install wheel
(odoo-env) $ pip3 install -r odoo/requirements.txt

After completing the process of installing all requirements to deactivate the virtual environment run the following command:

(odoo-env) $ deactivate

Execute the following command to create a directory for custom addons:

# mkdir /opt/odoo/custom-addons

Next exit from the Odoo user:

# exit

Create an Odoo log directory and provide it the required write permissions.

# mkdir /var/log/odoo
# chown odoo:odoo /var/log/odoo

Step 7: Create Odoo Configuration File

Create the Odoo configuration file.

# nano /etc/odoo.conf

Then paste the following configuration into it.

[options]
admin_passwd = Strong_admin_Password
db_host = False
db_port = False
db_user = odoo
db_password = False
logfile = /var/log/odoo/odoo-server.log
addons_path = /opt/odoo/odoo/addons,/opt/odoo/custom-addons
xmlrpc_port = 8069

Remember to update the value of the “Strong_admin_Password” key above with a more secure password.

Step 8: Create a Systemd Service File

Create a systemd service file to manage the Odoo service:

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

Paste the following content into the odoo.service file:

[Unit]
Description=Odoo
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-env/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

Reload system daemon and start the service:

# systemctl daemon-reload
# systemctl start odoo
# systemctl enable odoo

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

# systemctl status odoo

Output:

● odoo.service - Odoo
     Loaded: loaded (/etc/systemd/system/odoo.service; enabled; preset: enabled)
     Active: active (running)
   Main PID: 2270 (python3)
      Tasks: 4 (limit: 2273)
     Memory: 110.0M
        CPU: 1.622s
     CGroup: /system.slice/odoo.service
             └─2270 /opt/odoo/odoo-env/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf

Step 9: Access Odoo server

Open your web browser and type http://your-IP-address:8069 and you will see the following screen:

Fill the required information and then click the “Create Database” button to complete the installation.

After successfully creating the Odoo database, you will be redirected to the login page.

Enter your login credentials and you will be redirected to apps page:

Comments and Conclusion

That’s it. You have successfully installed Odoo 17 on Debian 12. For additional information, you can check the official Odoo 17 documentation.

If you have any questions please leave a comment below.

How to Install Backdrop CMS on Debian 12

Backdrop CMS is an open-source content management system (CMS) that is designed to be a user-friendly and accessible alternative to other popular CMS platforms, especially Drupal.

It is built on the same PHP technology stack as Drupal, but it is intended to be more straightforward and more suitable for smaller organizations, non-profits, and individuals who want a powerful CMS without the complexity often associated with Drupal.

Overall, Backdrop CMS aims to strike a balance between being easy to use and having the capabilities necessary to build and manage websites effectively, making it a suitable choice for those looking for a middle ground between simplicity and customization.

To get started with installing Backdrop on Debian 12, follow the steps below:

Step 1: Update Operating System

Update and upgrade your system packages to the latest version with the following command:

# apt update && apt upgrade

Step 2: Install Nginx

You can install Nginx web server via apt package manager by executing the following command:

# apt install nginx

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

# systemctl status nginx

Output:

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: active (running)
       Docs: man:nginx(8)
   Main PID: 717 (nginx)
      Tasks: 2 (limit: 2273)
     Memory: 5.0M
        CPU: 71ms
     CGroup: /system.slice/nginx.service
             ├─717 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             └─718 "nginx: worker process"

Step 3: Install PHP

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

# apt install php php-cli php-fpm php-json php-common 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.12 (cli) (built: Oct 27 2023 13:00:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.12, 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: 772 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 2273)
     Memory: 249.5M
        CPU: 2.711s
     CGroup: /system.slice/mariadb.service
             └─772 /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 Backdrop installation:

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

Step 5: Download Backdrop

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

# wget https://github.com/backdrop/backdrop/releases/download/1.26.1/backdrop.zip

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

# unzip backdrop.zip -d /var/www/

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

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

Step 6: Configure Nginx for Backdrop

Create a new Nginx configuration file with the following command:

# nano /etc/nginx/conf.d/backdrop.conf

Paste the content as shown below:

server {
listen 80;

server_name your-domain.com;
root /var/www/backdrop;
index index.php index.html index.htm;

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

location = /favicon.ico {
    log_not_found off;
    access_log off;
   }

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
   }

location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
   }

location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   }
}

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

Save and exit the configuration file.

To implement the changes, restart Nginx webserver:

# systemctl restart nginx

Step 7: Access Backdrop Web Interface

To complete the setup go to your browser and visit http://your-domain.com/. Choose language and click on the SAVE AND CONTINUE button.

Provide your database details and click on the SAVE AND CONTINUE button.

Provide your admin username, password, email then click on the SAVE AND CONTINUE button.

You will get the Backdrop dashboard.

Comments and Conclusion

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

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

If you have any questions please leave a comment below.