Category Archives: Ubuntu

Python 3.14 on Ubuntu 24.04

How to Install Python 3.14 on Ubuntu 24.04

Python is one of the most popular programming languages in the world, widely used for web development, data science, automation, and DevOps. With every new release, Python introduces performance improvements, security patches, and modern syntax features that make development smoother and faster.

This tutorial illustrates two methods of how to install it on your Ubuntu 24.04 OS.

  • Install Python 3.14 from the Deadsnakes PPA
  • Manually build Python 3.14 from the source code

Why Upgrade to Python 3.14?

Before diving into the commands, it’s worth understanding why upgrading to Python 3.14 is beneficial.

Some of the expected improvements in Python 3.14 include:

  • Performance boosts: Faster startup times and optimized memory usage.
  • Enhanced syntax features: Cleaner pattern matching and new language constructs.
  • Improved error messages: More readable and beginner-friendly tracebacks.
  • Security updates: Stronger hashing algorithms and better sandboxing support.

Python 3.14 is fully backward compatible with most 3.x scripts, but testing your projects in a virtual environment is still recommended before full migration.

Update and Upgrade Your System

Start by updating your Ubuntu 24.04 system to avoid package conflicts:

# apt update && sudo apt upgrade -y

Method 1: Install Python 3.14 Using Deadsnakes PPA (Recommended)

This method makes it easy to install Python 3.14 on Ubuntu 24.04 and be able to receive continued updates, bug fixes, and security updates.

The Deadsnakes PPA is a trusted third-party repository that provides newer versions of Python for Ubuntu systems.

First Add the Deadsnakes PPA to the APT package manager sources list:

# add-apt-repository ppa:deadsnakes/ppa -y

Press Enter to continue.

Once the repository has been installed, run an APT update to ensure that the newly imported PPA is reflected.

# apt update

Now you can  install Python 3.14 with the following command:

# apt install python3.14 -y

Then verify the installation with the following command:

# python3.14 --version

You should see output similar to:

Python 3.14.0

If you have installed Python 3.14 using the APT package manager, the PIP will not be installed by default. To install pip3.14, run the following command:

# curl -sS https://bootstrap.pypa.io/get-pip.py | python3.14 

You can check PIP for the Python 3.14 version using the following command:

# pip3.14 -V

pip 25.3 from /usr/local/lib/python3.14/site-packages/pip (python 3.14)

Method 2: Build Python 3.14 from Source

Also, you can compile Python 3.14 manually from the official source code. With this installation method, the main issue is that you cannot quickly update like the APT package manager and will need to recompile for any changes.

First, install the required prerequisite packages for the compilation of the Python 3.10 source code.

# apt install -y build-essential libssl-dev zlib1g-dev \
libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev \
libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev \
tk-dev libffi-dev uuid-dev wget

Now proceed and download the latest release version of Python from the Python official release page.

Alternatively, copy the download link for Python 3.14 gzipped tarball and use wget to pull it with the following command:

# cd /usr/src && wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0.tgz

Once done, extract the archive:

# tar -xf Python-3.14.0.tgz

Now navigate into the extracted directory and run the configure script to check the required dependencies.

# cd Python-3.14.0
# ./configure --enable-optimizations --enable-shared

You can speed up the build process by using all CPU cores:

 make -j 6

Remember, the (-j) corresponds to the number of cores in your system to speed up the build time.

To find out how many cores you have on your system, execute the following code:

# nproc

Output:

6

We have six cores, so in the (make) command, we used (-j 6).

Once the build process has been completed, run the following command to complete the Python installation. Instead of overwriting the system version, we’ll install Python 3.14 as an alternative:

# make altinstall

The altinstall target prevents replacing /usr/bin/python3 and keeps your default Python intact.

Verify your installation:

# python3.14 --version

If everything went smoothly, you’ll see:

Python 3.14.0

Install Python Modules|Extensions

Modules and extensions can be installed using the Python Package manager (PIP).

Use the syntax below to install a Python module of choice.

# pip3.14 install module-name

In this tutorial, We will show you how to install a Python module plotly.

# pip3.14 install plotly

Output:

Collecting plotly
  Downloading plotly-6.4.0-py3-none-any.whl.metadata (8.5 kB)
Collecting narwhals>=1.15.1 (from plotly)
  Downloading narwhals-2.10.2-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: packaging in /usr/lib/python3/dist-packages (from plotly) (24.0)
Downloading plotly-6.4.0-py3-none-any.whl (9.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.9/9.9 MB 11.3 MB/s  0:00:00
Downloading narwhals-2.10.2-py3-none-any.whl (419 kB)
Installing collected packages: narwhals, plotly
Successfully installed narwhals-2.10.2 plotly-6.4.0

You can verify your module installation using the following command:

# pip3.14 list | grep plotly
Package                Version             
---------------------- --------------------
..............
plotly 6.4.0
..............

Create a Virtual Environment

After successfully installing Python 3.14, it’s a best practice to create a virtual environment before installing any packages. Virtual environments allow you to isolate dependencies for each project preventing conflicts between system-wide and project-specific Python libraries.

The venv module is not included by default with the Python 3.14 installation, but you can install it manually:

# apt install python3.14-venv -y

This package provides the necessary tools to create and manage virtual environments.

You can create a virtual environment in your project directory. Navigate to your desired location and run:

# python3.14 -m venv myenv

Note: myenv is the name of your virtual environment (you can rename it).

To start using your isolated Python environment, activate it with the following command:

# source myenv/bin/activate

Once activated, your shell prompt should change to show the environment name, similar like this:

(myenv) root@linuxtuto:~#

To deactivate the virtual environment run the following command:

# deactivate

While the environment is active:

    • All installed Python packages will stay local to the project.
    • The global Python installation remains unaffected.

Optional: Set Python 3.14 as Default

Ubuntu 24.04 still ships with Python 3.12 by default. You can switch to Python 3.14 using update-alternatives safely:

# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.14 2
# update-alternatives --config python3

And choose which one to use as Python3 via command:

# update-alternatives --config python3

Select Python 3.14 when prompted, then verify:

# python3 --version

Expected output:

Python 3.14.0

Conclusion

Installing Python 3.14 on Ubuntu 24.04 is simple using the Deadsnakes PPA or by compiling from source. The new release delivers performance improvements, better syntax, and modern features that make development faster and safer.

With Python 3.14 installed, you’re ready to build powerful applications, automate workflows, or explore AI projects with the latest language tools.

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

How to Install OpenSearch 3.x on Ubuntu 24.04

OpenSearch is an open-source search and analytics engine developed as a fork of Elasticsearch and Kibana by AWS. It provides powerful search capabilities, log analytics, real-time monitoring, and observability, all built on Apache Lucene. OpenSearch 3.x is the latest major release, offering enhanced features, improved performance, and better scalability.

If you’re looking to set up OpenSearch 3.x on your Ubuntu 24.04 server, this step-by-step guide will walk you through the process.

Why Choose OpenSearch 3.x?

OpenSearch 3.x introduces several new features and improvements, including:

    • Improved Performance: Enhanced query execution and indexing capabilities.
    • Advanced Security Features: Built-in authentication, authorization, and encryption.
    • Enhanced Observability: Improved monitoring and alerting features.
    • Compatibility with OpenSearch Dashboards: Seamless integration for data visualization.

These features make OpenSearch 3.x a compelling choice for building scalable and secure search and analytics solutions.

Prerequisites

Before you begin, ensure your system meets the following requirements:

    • Ubuntu 24.04 server with at least 8GB of RAM (16GB recommended for production environments).
    • Root or sudo privileges.
    • Java OpenJDK 17 installed (OpenSearch 3.x requires Java 17).
    • Firewall configured to allow necessary ports.

Step 1: Update Your System

Start by updating your system’s package list and upgrading existing packages:

$ sudo apt update && sudo apt upgrade -y

This ensures all packages are up-to-date and reduces the risk of compatibility issues.

Step 2: Add the OpenSearch 3.x APT Repository

To install OpenSearch 3.x, you need to add its APT repository. First, install the necessary dependencies:

$ sudo apt install lsb-release ca-certificates curl gnupg2 -y

Download and add the OpenSearch GPG key:

$ sudo curl -o- https://artifacts.opensearch.org/publickeys/opensearch-release.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-release-keyring

Add the OpenSearch 3.x repository:

$ echo "deb [signed-by=/usr/share/keyrings/opensearch-release-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/3.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-3.x.list

Update your package list:

$ sudo apt update

With the repository information added, list all available versions of OpenSearch:

$ sudo apt list -a opensearch

Output:

Listing... Done
opensearch/stable 3.2.0 amd64
opensearch/stable 3.1.0 amd64
opensearch/stable 3.0.0 amd64

Step 3: Install OpenSearch 3.x

Before installation, yo need to set a new custom admin password  using the following command:

$ export OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password>

To install the latest version of OpenSearch run the following command:

$ sudo apt install opensearch -y

After installation, OpenSearch is set up as a systemd service and is ready to be started.

Step 4: Configure OpenSearch

Edit the main configuration file:

$ sudo nano /etc/opensearch/opensearch.yml

For a basic single-node setup, modify the following settings:

cluster.name: lonuxtuto-app
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
discovery.type: single-node
    • cluster.name: Name of your OpenSearch cluster.
    • node.name: Unique name for this node.
    • network.host: Set to 0.0.0.0 to allow external connections (use a private IP for production).
    • http.port: Default HTTP port (9200).
    • discovery.type: Set to single-node for a single-node setup.

Save and exit the editor.

Step 5: Start and Enable OpenSearch

Start the OpenSearch service:

$ sudo systemctl start opensearch

Enable OpenSearch to start on boot:

$ sudo systemctl enable opensearch

Check the status of the service:

$ sudo systemctl status opensearch

You should see that the service is active and running.

● opensearch.service - OpenSearch
Loaded: loaded (/usr/lib/systemd/system/opensearch.service; enabled; preset: enabled)
Active: active (running)
Docs: https://opensearch.org/
Main PID: 3425 (java)
Tasks: 55 (limit: 4548)
Memory: 1.3G (peak: 1.3G)
CPU: 1min 5.442s
CGroup: /system.slice/opensearch.service

Step 6: Test OpenSearch

Verify that OpenSearch is working by sending a request to the HTTP API:

$ curl -X GET https://localhost:9200 -u 'admin:<custom-admin-password>' --insecure 

Note that you need to use --insecure flag, which is required because the TLS certificates are self-signed.

You should receive a JSON response with information about your OpenSearch node, including its name, cluster name, and version.

{
"name" : "node-1",
"cluster_name" : "linuxtuto-app",
"cluster_uuid" : "pXKj1z87S3SnuJ7fjVs-TQ",
"version" : {
"distribution" : "opensearch",
"number" : "3.2.0",
"build_type" : "deb",
"build_hash" : "6adc0bf476e1624190564d7fbe4aba00ccf49ad8",
"build_date" : "2025-08-12T03:54:00.119899934Z",
"build_snapshot" : false,
"lucene_version" : "10.2.2",
"minimum_wire_compatibility_version" : "2.19.0",
"minimum_index_compatibility_version" : "2.0.0"
},
"tagline" : "The OpenSearch Project: https://opensearch.org/"
}

Step 7: Install OpenSearch Dashboards (Optional)

For a web-based interface to visualize your data, you can install OpenSearch Dashboards:

First create an APT repository for OpenSearch with the following command:

$ echo "deb [signed-by=/usr/share/keyrings/opensearch-release-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/3.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-dashboards-3.x.list

Verify that the repository was created successfully.

$ sudo apt-get update

Now install OpenSearch Dashboards with the following command:

$ sudo apt install opensearch-dashboards -y

Configure the dashboards:

$ sudo nano /etc/opensearch-dashboards/opensearch_dashboards.yml

Set the following parameters:

server.host: "0.0.0.0"
opensearch.hosts: ["http://localhost:9200"]

Start and enable the dashboards service:

$ sudo systemctl start opensearch-dashboards
$ sudo systemctl enable opensearch-dashboards

Access OpenSearch Dashboards by navigating to http://<your-server-ip>:5601 in your web browser.

Step 8: Configure Firewall

If you’re using UFW to manage your firewall, allow traffic on the necessary ports:

$ sudo ufw allow 9200/tcp
$ sudo ufw allow 5601/tcp
$ sudo ufw enable

Verify the firewall status:

sudo ufw status

Step 9: Secure OpenSearch (Optional)

For production environments, it’s crucial to secure your OpenSearch installation. Consider the following:

    • Enable TLS: Configure SSL/TLS to encrypt communication.
    • Set up Authentication: Use built-in security features to require authentication.
    • Configure User Roles: Define roles and permissions to control access.

Refer to the OpenSearch Security Documentation for detailed instructions on securing your OpenSearch cluster.

Conclusion

You’ve successfully installed OpenSearch 3.x on your Ubuntu 24.04 server. This setup provides a powerful, scalable, and secure platform for search and analytics. For more advanced configurations, such as setting up a multi-node cluster or integrating with other services, refer to the OpenSearch Documentation.

If you need assistance with securing your OpenSearch installation, configuring advanced features, or integrating with other tools, feel free to ask!

How to Install MySQL 8.4 on Ubuntu 24.04

MySQL is a fast, open-source relational database system used to store, manage, and retrieve structured data developed by Oracle. It stores data in tables organized by rows and columns and uses Structured Query Language (SQL) to manage and access that data.

MySQL is known for being fast, reliable, and easy to use, making it one of the most popular databases for web applications, mobile apps, and enterprise software. It supports a variety of storage engines, offers replication features for scaling and high availability, and ensures data integrity with ACID-compliant transactions.

In this tutorial, we will show you how to install MySQL 8.4 on a Ubuntu 24.04 OS.

Update Operating System

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

# apt update && apt upgrade -y

Add MySQL 8.4 Repository

MySQL 8.0 is the currently available version on the default Ubuntu 24.04 repositories.

Go to the download page for the MySQL 8.4 APT repository.

Also you can run the following command to download it to your Ubuntu 24.04 system:

# wget https://dev.mysql.com/get/mysql-apt-config_0.8.34-1_all.deb

Now install the downloaded .deb package with the following command:

# dpkg -i mysql-apt-config_0.8.34-1_all.deb

During the installation of the package, you will be asked to choose the versions of the MySQL server and other components that you want to install. Choose Ok to finish the configuration and installation of the release package.

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

# apt-get update

To check if MySQL 8.4 repo has been successfully installed run the following command:

# apt-cache policy mysql-server

Output:

mysql-server:
  Installed: (none)
  Candidate: 8.4.5-1ubuntu24.04
  Version table:
     8.4.5-1ubuntu24.04 500
        500 http://repo.mysql.com/apt/ubuntu noble/mysql-8.4-lts amd64 Packages
     8.0.41-0ubuntu0.24.04.1 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
     8.0.36-2ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages

Install MySQL 8.4 on Ubuntu 24.04

Now you are ready to install MySQL 8.4 with the following command:

# apt install mysql-server

You will be asked to set root password, you may go ahead and set one.

Then you can verify the installed version of MySQL with the following command:

# mysql --version

Output:

mysql  Ver 8.4.5 for Linux on x86_64 (MySQL Community Server - GPL)

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

# systemctl start mysql
# systemctl enable mysql

Check the status of the service:

# systemctl status mysql

Example output:

 ● mysql.service - MySQL Community Server
     Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: enabled)
     Active: active (running)
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
   Main PID: 5331 (mysqld)
     Status: "Server is operational"
      Tasks: 35 (limit: 2217)
     Memory: 433.7M (peak: 449.8M)
        CPU: 2.315s
     CGroup: /system.slice/mysql.service
             └─5331 /usr/sbin/mysqld

MySQL Create Database

We need to login to MySQL shell with the following command:

# mysql -u root -p

To create a database in MySQL you need to run the following command:

mysql> CREATE DATABASE your_db;

View the new database:

SHOW DATABASES;

To create a new MySQL user, run the following command:

mysql> CREATE USER 'your_user'@localhost IDENTIFIED BY 'password';

Note: You should replace password with a secure password.

Give the user full rights to the new database:

GRANT ALL PRIVILEGES ON your_db.* TO 'your_user'@'localhost';

Refresh privileges so they take effect:

FLUSH PRIVILEGES;

Exit the MySQL shell:

mysql> exit

Comments and Conclusion

That’s it. You have successfully installed MySQL 8.4 on Ubuntu 24.04.

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

If you have any questions please leave a comment below.

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 Node.js on Ubuntu 24.04

Node.js is a fast, open-source JavaScript runtime that lets you build scalable server-side and network applications.

It is known for its non-blocking, event-driven architecture, making it ideal for building scalable network applications like APIs, chat apps, and real-time services.

Ubuntu 24.04 offers several ways to install Node.js depending on your needs, whether you prefer stability or the latest features.

This blog post will guide you through three reliable methods to install Node.js on Ubuntu 24.04.

Method 1: Installing Node.js Using apt (Default Repository)

Ubuntu provides Node.js in its default repositories, but it may not be the latest version.

First, update the package list to ensure you have the latest repositories:

# apt update && sudo apt upgrade -y

Run the following command to install Node.js and npm:

# apt install nodejs npm -y

Verify the installed version of Node.js running the following command:

# node --version

You should see the following output:

v18.19.1

Verify the NPM version with the following command:

# npm --version

You should get the following output:

9.2.0

Method 2: Install Latest Node.js Using NodeSource

This method gives you access to the most recent versions of Node.js.

First, add the Node.js repository running the following command:

# curl -sL https://deb.nodesource.com/setup_22.x | bash -

Once added, install the Node.js with the following command:

# apt-get install nodejs

Verify the installed version of Node.js running the following command:

# node --version

You should see the following output:

v22.14.0

Verify the NPM version with the following command:

# npm --version

You should get the following output:

10.9.2

Method 3: Install Node.js Using NVM (Node Version Manager)

Use this method if you want to install and manage multiple Node.js versions easily.

# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
# source ~/.bashrc

To install the latest LTS version:

# nvm install --lts

To install a specific version you can use the following command:

# nvm install 20

Replace “20″ with the version number of Node.js you want to install.

Comments and Conclusion

Installing Node.js on Ubuntu 24.04 is straightforward with multiple flexible options:

  • Use apt for a quick setup
  • Use NodeSource for the latest stable versions
  • Use NVM for full control over Node.js versions

Now that Node.js is installed, you’re ready to start building apps and tools in JavaScript.

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

If you have any questions please leave a comment below.

How to Configure Cloudflare Tunnel on Ubuntu 24.04

Cloudflare Tunnels is a service offered by Cloudflare that allows you to securely expose web services running on your local machine or private network to the internet without needing to open ports, set up firewalls, or use a public IP address.

It creates a secure, encrypted tunnel between your origin server and Cloudflare’s network, enabling access to your applications from anywhere.

In this tutorial we will show you how to configure Cloudflare Tunnel on Ubuntu 24.04.

Step 1: Install and Configure Cloudflared

To create and manage tunnels, you will need to install and authenticate cloudflared on your server.

You can install cloudflared with the following command:

# wget -q wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
# dpkg -i cloudflared-linux-amd64.deb

After installing cloudflared, you need to authenticate it with your Cloudflare account:

# cloudflared tunnel login

You will get the following message:

Please open the following URL and log in with your Cloudflare account:
https://dash.cloudflare.com/argotunnel?aud=&callback=https%3A%2F%2Flogin.cloudflareaccess.org%2F94jJEwKkBV3dOOKv5oPBEj-B9lWITbj_Gk_9sVN1wnw%3D
Leave cloudflared running to download the cert automatically.

Copy the URL and log in to your Cloudflare account. Once you logged in you will get the following message:

Click on the Authorize button to authorize the tunnel. Cloudflare will download a certificate file to authenticate cloudflared with Cloudflare’s network.

You have successfully logged in.
If you wish to copy your credentials to a server, they have been saved to:
/root/.cloudflared/cert.pem

Once authorization is completed successfully, your cert.pem will be download to the default directory.

Step 2: Create a Cloudflare Tunnel

Now, you are ready to create a Cloudflare Tunnel that will connect cloudflared to Cloudflare’s edge. Running the following command will create a Tunnel:

# cloudflared tunnel create yourtunnel

Note: Replace yourtunnel with a name of your choice.

Next, you need to configure the tunnel to point to your local web server. The configuration file contains keys and values, which is written in YAML syntax.

# nano /root/.cloudflared/config.yml

You have to include the correct tunnel ID and credentials file gotten from the tunnel creation command.

tunnel: b8294c45-9cd1-40fe-b8f1-519da5d8dfd9
credentials-file: /root/.cloudflared/b8294c45-9cd1-40fe-b8f1-519da5d8dfd9.json
ingress:
- hostname: test.yourdomain.com
service: http://localhost:80
- service: http_status:404

Next, you have to configure your DNS settings on your Cloudflare account by adding a CNAME record.

Also, you can use this command will generate a CNAME record that points to the subdomain of a specific Tunnel.

# tunnel route dns b8294c45-9cd1-40fe-b8f1-519da5d8dfd9 test.yourdomain.com

Step 3: Start and Manage the Cloudflare Tunnel

By default, the tunnel expects to find the configuration file in the default directory, /root/.cloudflared/config.yml but to run tunnel as a service, you might need to move the config.yml file to the /etc/cloudflared/ directory.

# mkdir /etc/cloudflared/
# mv /root/.cloudflared/config.yml /etc/cloudflared/

Then, you have to install the tunnel as a service:

# cloudflared service install

Now, we can start and enable the cloudflared service so that it runs in the background and starts automatically upon server boot.

# systemctl start cloudflared
# systemctl enable cloudflared

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

# systemctl status cloudflared
Output:
● cloudflared.service - cloudflared
Loaded: loaded (/etc/systemd/system/cloudflared.service; enabled; preset: enabled)
Active: active (running)
Main PID: 2316 (cloudflared)
Tasks: 7 (limit: 2218)
Memory: 14.0M (peak: 16.1M)
CPU: 9.227s
CGroup: /system.slice/cloudflared.service
└─2316 /usr/bin/cloudflared --no-autoupdate --config /etc/cloudflared/config.yml tunnel run

Step 4: Add more services (optional)

If we have multiple services using the same tunnel, you have to create separate CNAME entries for each hostname.

# cloudflared tunnel route dns <UUID or NAME> test2.yourdomain.com

Then Add another ingress point to the config:

ingress:
- hostname: test.yourdomain.com
service: http://localhost:80
- hostname: test2.yourdomain.com
service: http://localhost:8080
- service: http_status:404

Comments and Conclusion

That’s it. You have successfully Configure Cloudflare tunnel on Ubuntu 24.04

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

If you have any questions please leave a comment below.

r

How to Install PHP 8.4 on Ubuntu 24.04

PHP (Hypertext Preprocessor) is a widely-used, open-source, server-side scripting language designed for web development. It is especially suited for creating dynamic web pages and applications.

In this tutorial, we will show you how to install PHP 8.4 on a Ubuntu 24.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.4 is not included in the Ubuntu 24.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.4

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

# apt-get install php8.4

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

# php8.4 --version

Output:

# PHP 8.4.1 (cli) (built: Nov 21 2024 14:54:00) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.1, Copyright (c), by Zend Technologies

Install PHP 8.4 for Apache

To install PHP as an Apache module, execute:

# apt install libapache2-mod-php8.4

Then, restart Apache to integrate the new PHP module:

# systemctl restart apache2

To verify that PHP is working with the Apache web server, you can create a test PHP file:

echo "<?php phpinfo(); ?>" | tee /var/www/html/info.php

Then open your web browser and type http://your-IP-address/info.php and you should see the PHP information page.

Install PHP 8.4 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.4-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.4-fpm

Output:

● php8.4-fpm.service - The PHP 8.4 FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php8.4-fpm.service; enabled; preset: enabled)
     Active: active (running)
       Docs: man:php-fpm8.4(8)
    Process: 11741 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.4/fpm/pool.d/www.conf 84 (code=exited, status=0/SUCCESS)
   Main PID: 11737 (php-fpm8.4)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0.00req/sec"
      Tasks: 3 (limit: 2218)
     Memory: 8.0M (peak: 9.0M)
        CPU: 116ms
     CGroup: /system.slice/php8.4-fpm.service
             ├─11737 "php-fpm: master process (/etc/php/8.4/fpm/php-fpm.conf)"
             ├─11739 "php-fpm: pool www"
             └─11740 "php-fpm: pool www"

Test PHP and PHP-FPM

To configure Nginx to use PHP-FPM, you need to edit the default Nginx configuration file:

# nano /etc/nginx/sites-available/default

Add the following configurations to the file.

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
}

Check Nginx syntax:

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

Then create a test PHP file similar to the Apache setup:

echo "<?php phpinfo(); ?>" | tee /var/www/html/info.php

To implement the changes, restart Nginx webserver:

# systemctl restart nginx

Then open your web browser and type http://your-IP-address/info.php and you should see the PHP information page.

Install PHP Extension

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

# sudo apt install php8.4-[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.4-mysql php8.4-imap php8.4-ldap php8.4-xml php8.4-curl php8.4-mbstring php8.4-zip

To check loaded PHP modules use the command:

# php8.4 -m

Example Output:

[PHP Modules]
..............
imap
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
..............

[Zend Modules]
Zend OPcache

Running PHP 8.4 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/php.default   100       auto mode
  1            /usr/bin/php.default   100       manual mode
  2            /usr/bin/php8.3        83        manual mode
  3            /usr/bin/php8.4        84        manual mode

To set the path without the interactive prompt:

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

Comments and Conclusion

In the tutorial, you have learned how to install PHP 8.4 on Ubuntu 24.04.

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

If you have any questions please leave a comment below.

How to Install Odoo 18 on Ubuntu 24.04

Odoo 18 is an open-source suite of business applications that provides a complete ERP (Enterprise Resource Planning) solution for organizations of various sizes. It offers a wide range of integrated tools and modules to help manage all aspects of a business, such as finance, sales, inventory, human resources, and more.

The open-source community edition is free, making it accessible to small businesses and developers. The enterprise edition, on the other hand, offers additional features, services, and support.

Odoo is highly customizable. Businesses can tailor modules to meet their specific needs, create custom workflows, or build entirely new apps using Odoo’s development framework.

In summary, Odoo is a versatile business management software that can streamline operations and provide real-time insights, making it an ideal solution for companies looking to optimize their business processes.

In this tutorial, we will show you how to install Odoo 18 on a Ubuntu 24.04 OS.

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

Then install all the required packages for the Odoo 18 setup on the Ubuntu 24.04 OS.

# apt install python3-minimal 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-utils libpq-dev libffi-dev fontconfig git wget

Step 2: Install PostgreSQL

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

Follow these steps to install and configure PostgreSQL server:

# apt-get install postgresql

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 (/usr/lib/systemd/system/postgresql.service; enabled; preset: enabled)
     Active: active (exited)
   Main PID: 19754 (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 Ubuntu 24.04 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 wkhtmltopdf

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  http://security.ubuntu.com/ubuntu/pool/universe/w/wkhtmltopdf/wkhtmltopdf_0.12.6-2build2_amd64.deb
# dpkg -i wkhtmltopdf_0.12.6-2build2_amd64.deb

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

# wkhtmltopdf --version
wkhtmltopdf 0.12.6

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 18

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 18.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/odoo18
# chown odoo:odoo /var/log/odoo18

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/odoo18/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: 21764 (python3)
      Tasks: 4 (limit: 2218)
     Memory: 73.3M (peak: 73.5M)
        CPU: 973ms
     CGroup: /system.slice/odoo.service
             └─21764 /opt/odoo/odoo-env/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf

Step 9: Access Odoo 18 server

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

Comments and Conclusion

That’s it. You have successfully installed Community version of Odoo 18 on Ubuntu 24.04.

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

If you have any questions please leave a comment below.