Apache Pulsar is a powerful distributed messaging and event streaming platform that supports multi-tenancy, high availability, and scalability. It’s often used for building modern messaging systems, stream processing applications, and event-driven microservices.
This blog will walk you through the steps of installing Apache Pulsar on Ubuntu 24.
Prerequisites
Before installing Apache Pulsar, you will need to ensure that your system is updated and has Java installed, as Pulsar requires Java 17 or later.
Update the system packages:
sudo apt update
sudo apt upgrade -y
Install Java:
Apache Pulsar requires Java, and we will use OpenJDK 11 here.
sudo apt install openjdk-17-jre-headless -y
Verify that Java is installed correctly:
java -version
Download and Install Apache Pulsar
Go to the Apache Pulsar Downloads page to get the latest version. Or, use wget to download it directly:
wget https://downloads.apache.org/pulsar/pulsar-4.0.1/apache-pulsar-4.0.1-bin.tar.gz
Extract the Pulsar tarball:
tar -xvzf apache-pulsar-4.0.1-bin.tar.gz
cd apache-pulsar-4.0.1
Start Pulsar in Standalone Mode
Start Pulsar in standalone mode:
Apache Pulsar can be run in “standalone” mode for development and testing. This mode runs both Pulsar brokers and a ZooKeeper instance locally. To start Pulsar, run:
./bin/pulsar-daemon start standalone
Use Pulsar’s CLI for Topic Management
Now that Pulsar is running, you can interact with it using the Pulsar Admin CLI.
Create a topic:
./bin/pulsar-admin topics create persistent://public/default/my-topic
Publish a message to the topic:
./bin/pulsar-client produce my-topic --messages "Hello, Pulsar!"
Consume the message from the topic:
./bin/pulsar-client consume my-topic -s "my-subscription" -n 1
This will consume a single message from the topic my-topic.
Pulsar as a service
You can create a systemd service to manage the Pulsar process.
Create a new file in /etc/systemd/system/pulsar.service:
sudo nano /etc/systemd/system/pulsar.service
Add the following content to the file:
[Unit]
Description=Apache Pulsar Service
After=network.target
[Service]
Type=forking
ExecStart=/path/to/apache-pulsar-4.0.1/bin/pulsar-daemon start standalone
ExecStop=/path/to/apache-pulsar-4.0.1/bin/pulsar-daemon stop
Restart=always
User=your-user
[Install]
WantedBy=multi-user.target
Reload systemd and enable the Pulsar service to start on boot:
sudo systemctl daemon-reload
sudo systemctl enable pulsar
sudo systemctl start pulsar
In just a few steps, you can have Apache Pulsar up and running on your Ubuntu 24 system. Pulsar’s powerful messaging system with high throughput, scalability, and low latency makes it ideal for real-time event streaming and distributed applications.
This installation guide sets up a standalone Pulsar instance, which is suitable for local development and testing. If you’re planning to deploy Pulsar in a production environment, you will need to configure it for multi-broker clusters, and consider factors like security, high availability, and replication.
Let us know if you encounter any issues. To guarantee a seamless Apache Pulsar installation and configuration for all of your requirements, our server management services offer professional help.