How To Install Apache Cassandra on openSUSE
Apache Cassandra stands as one of the most powerful distributed NoSQL database systems available today, offering unparalleled scalability and reliability for organizations handling massive data volumes. For openSUSE users looking to leverage this robust database solution, proper installation and configuration are critical first steps toward building resilient data infrastructure. This comprehensive guide walks you through the complete process of installing and configuring Apache Cassandra on openSUSE Linux, covering multiple installation methods and essential post-installation steps.
Understanding Apache Cassandra
Apache Cassandra is an open-source, distributed NoSQL database management system designed to handle large amounts of data across many commodity servers while providing high availability with no single point of failure. Originally developed at Facebook to power their inbox search feature, Cassandra was released as an Apache open-source project in 2008.
Key architectural features
Cassandra’s architecture employs a masterless, ring-based design where all nodes are equal. This peer-to-peer distribution model eliminates bottlenecks and ensures there’s no single point of failure. Data is automatically replicated across nodes in a cluster, providing fault tolerance and reliability even when individual nodes fail.
Unlike traditional relational databases that use a master-slave architecture, Cassandra’s decentralized approach allows for linear scalability – simply add more nodes to increase capacity. The system uses a partition-tolerant, eventually consistent model based on Amazon’s Dynamo and Google’s BigTable.
Common use cases for Cassandra include:
- Time-series data storage
- Large-scale event logging
- Product catalogs and inventory management
- Messaging platforms
- Fraud detection systems
- IoT data management
The latest stable version of Cassandra (as of March 2025) is 4.1.x, which includes significant performance improvements, virtual tables, and enhanced security features over previous versions.
Prerequisites for Installation
Before proceeding with Cassandra installation on openSUSE, ensure your system meets these requirements:
Hardware requirements:
- CPU: Minimum 2 cores (4+ cores recommended for production)
- RAM: Minimum 4GB (8GB+ recommended for production)
- Disk space: Minimum 30GB of free space (SSD storage highly recommended)
- Network: Stable network connection with static IP address
openSUSE compatibility:
- Supported on both openSUSE Leap (15.4 and newer) and Tumbleweed
- Server or desktop editions can run Cassandra, though server edition is preferred for production
System preparation:
- Update your system packages:
sudo zypper update
- Install necessary system utilities:
sudo zypper install wget curl tar unzip net-tools
Java requirements:
Cassandra requires Java to run. Specifically:
- Cassandra 4.0 and later: Java 11 (OpenJDK or Oracle JDK)
- Cassandra 3.x: Java 8 (OpenJDK or Oracle JDK)
The following sections will guide you through the complete installation process, starting with setting up the required Java environment.
Installing Java on openSUSE
Cassandra relies heavily on Java for its operation, making proper Java installation a critical prerequisite. Follow these steps to install and configure Java on your openSUSE system:
Check existing Java installation:
First, verify if Java is already installed on your system:
java -version
If Java is already installed, check the version to ensure compatibility with your target Cassandra version.
Installing OpenJDK 11 on openSUSE:
If Java isn’t installed or you need a different version, install OpenJDK 11 using zypper:
sudo zypper install java-11-openjdk java-11-openjdk-devel
For Cassandra versions requiring Java 8, use:
sudo zypper install java-1_8_0-openjdk java-1_8_0-openjdk-devel
Setting JAVA_HOME environment variable:
Cassandra requires the JAVA_HOME environment variable to be set properly:
- Find your Java installation path:
which java
- Determine the actual Java home directory (usually the path before “/bin/java”):
readlink -f $(which java) | sed "s:/bin/java::"
- Set JAVA_HOME by adding it to /etc/profile.d/java.sh:
sudo echo 'export JAVA_HOME=$(readlink -f $(which java) | sed "s:/bin/java::")' > /etc/profile.d/java.sh sudo chmod +x /etc/profile.d/java.sh source /etc/profile.d/java.sh
- Verify JAVA_HOME is set correctly:
echo $JAVA_HOME
Troubleshooting Java installation:
If you encounter issues with Java:
- Ensure PATH includes Java binary directory:
echo $PATH
- Verify Java alternatives are configured correctly:
sudo update-alternatives --config java
- Check for any error messages in your shell startup scripts (.bashrc, .bash_profile)
With Java properly installed, you’re ready to proceed with Cassandra installation using one of the three methods described in the following sections.
Method 1: Installing Cassandra via RPM Packages
The RPM package installation method offers a clean, manageable way to install Cassandra on openSUSE with proper system integration. While openSUSE uses zypper instead of yum/dnf, we can still utilize the Apache Cassandra repositories with some modifications.
Adding the Cassandra repository:
- Create a new repository file:
sudo nano /etc/zypp/repos.d/cassandra.repo
- Add the following configuration to the file:
[cassandra] name=Apache Cassandra baseurl=https://www.apache.org/dist/cassandra/redhat/41x/ gpgcheck=1 repo_gpgcheck=1 gpgkey=https://www.apache.org/dist/cassandra/KEYS enabled=1 autorefresh=1
- Save and exit the editor (Ctrl+X, Y, Enter)
Importing repository GPG keys:
Import the Apache Cassandra repository GPG keys to ensure package integrity:
sudo wget -qO - https://www.apache.org/dist/cassandra/KEYS | sudo gpg --import
Installing Cassandra with zypper:
- Refresh the package repositories:
sudo zypper refresh
- Install Cassandra:
sudo zypper install cassandra
- During installation, zypper might report dependency issues. Accept the suggested solutions when prompted.
openSUSE-specific considerations:
Unlike RHEL-based systems, openSUSE uses different system paths and service management approaches:
- System configuration files are typically located in:
- /etc/cassandra/ for configuration
- /var/lib/cassandra/ for data
- /var/log/cassandra/ for logs
- Adjust permissions if needed:
sudo chown -R cassandra:cassandra /var/lib/cassandra /var/log/cassandra /etc/cassandra
- Enable and start the Cassandra service:
sudo systemctl enable cassandra sudo systemctl start cassandra
Verifying the installation:
Ensure Cassandra is running properly:
sudo systemctl status cassandra
nodetool status
If everything is working correctly, you should see the Cassandra service active and one node in the “UN” (Up/Normal) state in the nodetool output.
Method 2: Installing Cassandra via Binary Tarball
The binary tarball installation offers greater flexibility and control over Cassandra’s location and configuration. This method is ideal when you need to:
- Install multiple Cassandra versions side by side
- Use a non-standard installation location
- Customize the installation without package manager constraints
Downloading the tarball:
- Visit the Apache Cassandra download page: https://cassandra.apache.org/download/
- Download the latest stable release tarball:
wget https://dlcdn.apache.org/cassandra/4.1.3/apache-cassandra-4.1.3-bin.tar.gz
Note: Replace the version number with the latest available version.
Verifying download integrity:
It’s important to verify the tarball’s integrity before installation:
- Download the checksum file:
wget https://downloads.apache.org/cassandra/4.1.3/apache-cassandra-4.1.3-bin.tar.gz.sha256
- Verify the checksum:
sha256sum -c apache-cassandra-4.1.3-bin.tar.gz.sha256
Extracting and positioning the tarball:
- Create a dedicated directory for Cassandra:
sudo mkdir -p /opt/cassandra
- Extract the tarball:
sudo tar -xzf apache-cassandra-4.1.3-bin.tar.gz -C /opt
- Create a symbolic link for easier version management:
sudo ln -s /opt/apache-cassandra-4.1.3 /opt/cassandra
Configuring environment variables:
- Create a profile file for Cassandra:
sudo nano /etc/profile.d/cassandra.sh
- Add the following environment variables:
export CASSANDRA_HOME=/opt/cassandra export PATH=$PATH:$CASSANDRA_HOME/bin export CASSANDRA_CONF=$CASSANDRA_HOME/conf
- Make the file executable and apply changes:
sudo chmod +x /etc/profile.d/cassandra.sh source /etc/profile.d/cassandra.sh
Understanding directory structure:
The Cassandra tarball installation includes several key directories:
- bin/ – Contains executable scripts like cassandra, nodetool, cqlsh
- conf/ – Contains configuration files (cassandra.yaml, cassandra-env.sh)
- lib/ – Contains JAR dependencies
- tools/ – Contains additional utilities
- data/ – Default data directory (configureable)
- logs/ – Default logs directory (configurable)
Starting Cassandra manually:
- Create a dedicated cassandra user:
sudo useradd -r -d /opt/cassandra cassandra
- Adjust ownership of Cassandra directories:
sudo chown -R cassandra:cassandra /opt/apache-cassandra-4.1.3 sudo chown -R cassandra:cassandra /opt/cassandra
- Start Cassandra as the cassandra user:
sudo -u cassandra /opt/cassandra/bin/cassandra -f
The -f flag keeps Cassandra in the foreground. For background operation, omit this flag.
Method 3: Using Docker for Cassandra Installation
Docker provides a containerized approach to running Cassandra, offering isolation, portability, and simplified deployment. This method is particularly useful for development environments or when you need to quickly spin up Cassandra instances.
Installing Docker on openSUSE:
- Update your system:
sudo zypper refresh sudo zypper update
- Install Docker:
sudo zypper install docker
- Start and enable the Docker service:
sudo systemctl enable docker sudo systemctl start docker
- Add your user to the docker group (optional, for running docker without sudo):
sudo usermod -aG docker $(whoami)
Note: Log out and back in for the group change to take effect.
Pulling the official Cassandra image:
Pull the official Cassandra Docker image from Docker Hub:
docker pull cassandra:latest
You can also specify a particular version:
docker pull cassandra:4.1
Running a Cassandra container:
- Start a basic Cassandra container:
docker run --name cassandra-node -d cassandra:latest
- For a more production-like setup with persistent data:
docker run --name cassandra-node -v /data/cassandra:/var/lib/cassandra -p 9042:9042 -d cassandra:latest
This command:
- Names the container “cassandra-node”
- Mounts the local /data/cassandra directory to store data persistently
- Maps the CQL native port (9042) to the host
- Runs the container in detached mode
Connecting to Cassandra inside Docker:
- Use docker exec to run cqlsh within the container:
docker exec -it cassandra-node cqlsh
- Check the status of the Cassandra node:
docker exec -it cassandra-node nodetool status
Docker networking considerations:
For multi-node Cassandra clusters, proper network configuration is essential:
- Create a dedicated network for your Cassandra cluster:
docker network create cassandra-network
- Run Cassandra containers with the custom network:
docker run --name cassandra-node1 --network cassandra-network -d cassandra:latest
- When adding additional nodes, specify the first node as a seed:
docker run --name cassandra-node2 --network cassandra-network -e CASSANDRA_SEEDS=cassandra-node1 -d cassandra:latest
This Docker-based approach provides flexibility and isolation, making it ideal for development, testing, or when you need to quickly deploy Cassandra instances without affecting your host system.
Configuring Cassandra After Installation
Proper configuration is crucial for Cassandra’s performance, security, and stability. The main configuration file is cassandra.yaml, and its location depends on your installation method:
- RPM installation: /etc/cassandra/cassandra.yaml
- Tarball installation: /opt/cassandra/conf/cassandra.yaml
- Docker installation: Inside the container at /etc/cassandra/cassandra.yaml
Essential configuration parameters:
- Cluster name – Sets the logical cluster name:
cluster_name: 'My Cassandra Cluster'
- Seeds – Lists seed nodes for cluster discovery:
seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "127.0.0.1"
- Listen address – IP address for Cassandra to bind to:
listen_address: 192.168.1.10
- Data storage locations – Where data files are stored:
data_file_directories: - /var/lib/cassandra/data commitlog_directory: /var/lib/cassandra/commitlog saved_caches_directory: /var/lib/cassandra/saved_caches hints_directory: /var/lib/cassandra/hints
- Memory settings – Configure heap memory allocation in cassandra-env.sh:
# For systems with 8GB+ RAM, set values to 1/4 of total memory MAX_HEAP_SIZE="2G" HEAP_NEWSIZE="512M"
- Endpoint snitch – Determines network topology:
endpoint_snitch: SimpleSnitch
Use GossipingPropertyFileSnitch for production multi-datacenter deployments.
After making changes to configuration files, restart Cassandra for the changes to take effect:
sudo systemctl restart cassandra
Or for tarball installations:
sudo -u cassandra /opt/cassandra/bin/nodetool drain
sudo -u cassandra kill $(pgrep -f CassandraDaemon)
sudo -u cassandra /opt/cassandra/bin/cassandra
Running Cassandra as a Service on openSUSE
For production deployments, you’ll want Cassandra to run as a system service that starts automatically at boot. The process differs depending on your installation method.
For RPM installations:
The service file is automatically installed. Simply enable and start it:
sudo systemctl enable cassandra
sudo systemctl start cassandra
For tarball installations:
You’ll need to create a custom systemd service file:
- Create the service file:
sudo nano /etc/systemd/system/cassandra.service
- Add the following content:
[Unit] Description=Apache Cassandra Database After=network.target [Service] Type=forking User=cassandra Group=cassandra ExecStart=/opt/cassandra/bin/cassandra -p /var/run/cassandra/cassandra.pid Environment="JAVA_HOME=/usr/lib64/jvm/java-11-openjdk" PIDFile=/var/run/cassandra/cassandra.pid Restart=always StandardOutput=journal StandardError=journal LimitNOFILE=100000 LimitMEMLOCK=infinity LimitNPROC=32768 [Install] WantedBy=multi-user.target
- Create the necessary directory for the PID file:
sudo mkdir -p /var/run/cassandra sudo chown cassandra:cassandra /var/run/cassandra
- Reload systemd, enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable cassandra sudo systemctl start cassandra
Managing the Cassandra service:
Common service management commands include:
- Check status:
sudo systemctl status cassandra
- Start service:
sudo systemctl start cassandra
- Stop service:
sudo systemctl stop cassandra
- Restart service:
sudo systemctl restart cassandra
- View logs:
sudo journalctl -u cassandra
Troubleshooting service issues:
If Cassandra fails to start as a service, check:
- Service logs for detailed error messages:
sudo journalctl -u cassandra -n 100
- Cassandra system logs:
sudo tail -f /var/log/cassandra/system.log
- Permissions on data and log directories:
ls -la /var/lib/cassandra ls -la /var/log/cassandra
- Java compatibility issues:
java -version echo $JAVA_HOME
Ensure the service file correctly references your Java installation and Cassandra paths.
Post-Installation Verification
After installation, it’s essential to verify that Cassandra is running properly and can perform basic operations.
Verifying Cassandra status:
sudo systemctl status cassandra
Checking cluster health:
nodetool status
You should see an output showing “UN” (Up/Normal) status for your node.
Connecting with cqlsh:
The Cassandra Query Language Shell (cqlsh) allows you to interact with your database:
cqlsh
Running basic CQL commands:
Once connected with cqlsh, try these basic commands:
- View cluster information:
DESCRIBE CLUSTER;
- Create a test keyspace:
CREATE KEYSPACE test_keyspace WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};
- Switch to the new keyspace:
USE test_keyspace;
- Create a test table:
CREATE TABLE users ( user_id uuid PRIMARY KEY, first_name text, last_name text, email text );
- Insert test data:
INSERT INTO users (user_id, first_name, last_name, email) VALUES (uuid(), 'John', 'Doe', 'john.doe@example.com');
- Query the data:
SELECT * FROM users;
If all these operations work successfully, your Cassandra installation is verified and operational.
Security Considerations
Securing your Cassandra deployment is critical, especially for production environments.
Authentication configuration:
- Enable password authentication in cassandra.yaml:
authenticator: PasswordAuthenticator authorizer: CassandraAuthorizer
- Restart Cassandra:
sudo systemctl restart cassandra
- Login with the default superuser (default password is “cassandra”):
cqlsh -u cassandra -p cassandra
- Change the default password:
ALTER USER cassandra WITH PASSWORD 'new_secure_password';
Network security:
- Configure listen_address and rpc_address in cassandra.yaml to bind to specific interfaces, not 0.0.0.0
- Use firewall rules to restrict access to Cassandra ports:
sudo firewall-cmd --permanent --add-port=7000/tcp # Internode communication sudo firewall-cmd --permanent --add-port=7001/tcp # TLS internode sudo firewall-cmd --permanent --add-port=9042/tcp # CQL native sudo firewall-cmd --reload
File permissions:
Ensure proper ownership and permissions:
sudo chown -R cassandra:cassandra /var/lib/cassandra /var/log/cassandra /etc/cassandra
sudo chmod 750 /var/lib/cassandra /var/log/cassandra /etc/cassandra
sudo chmod 600 /etc/cassandra/cassandra.yaml
TLS/SSL encryption:
For production environments, configure client-to-node and node-to-node encryption:
- Generate keystore and truststore files
- Configure client_encryption_options and server_encryption_options in cassandra.yaml
- Use cqlsh with SSL options for secure connections
These security measures provide a baseline level of protection for your Cassandra deployment on openSUSE.
Troubleshooting Common Issues
Even with careful installation, issues may arise. Here are solutions to common problems:
Cassandra won’t start:
- Check system logs:
sudo journalctl -u cassandra -n 100
- Verify Java compatibility:
java -version
- Check for port conflicts:
sudo netstat -tulpn | grep -E '7000|7001|9042'
- Inspect Cassandra logs:
sudo tail -f /var/log/cassandra/system.log
OOM (Out of Memory) errors:
- Check current heap settings in /etc/cassandra/conf/cassandra-env.sh
- Adjust MAX_HEAP_SIZE and HEAP_NEWSIZE to appropriate values
- Ensure swap is enabled but not overused
Connection issues:
- Verify Cassandra is running:
nodetool status
- Check network configuration:
ip addr
- Test connectivity:
telnet localhost 9042
- Verify firewall settings:
sudo firewall-cmd --list-all
Permission errors:
- Check directory ownership:
ls -la /var/lib/cassandra
- Fix permissions if necessary:
sudo chown -R cassandra:cassandra /var/lib/cassandra
Performance Tuning for openSUSE
To optimize Cassandra performance on openSUSE:
File system considerations:
- Use XFS file system for Cassandra data directories
- Disable atime updates for better I/O performance:
sudo mount -o remount,noatime /cassandra_mount_point
Memory and JVM tuning:
- Adjust heap space in cassandra-env.sh:
# For an 8GB system, allocate 4GB to Cassandra MAX_HEAP_SIZE="4G" HEAP_NEWSIZE="800M"
- Enable G1GC for better garbage collection:
JVM_OPTS="$JVM_OPTS -XX:+UseG1GC"
Kernel parameters:
Add these settings to /etc/sysctl.conf:
# Increase file handles
fs.file-max = 100000
# Increase network performance
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.optmem_max = 40960
Apply changes:
sudo sysctl -p
Disk I/O optimization:
- Use separate disks for commitlog and data where possible
- Enable deadline I/O scheduler for SSDs:
echo deadline > /sys/block/sda/queue/scheduler
- Adjust readahead settings:
sudo blockdev --setra 128 /dev/sda
These optimizations can significantly improve Cassandra’s performance on openSUSE, especially for production workloads.
Congratulations! You have successfully installed Apache Cassandra. Thanks for using this tutorial for installing Apache Cassandra on your openSUSE Linux system. For additional help or useful information, we recommend you check the official Apache website.