{"id":2731,"date":"2023-08-15T10:04:46","date_gmt":"2025-08-09T17:14:36","guid":{"rendered":""},"modified":"2025-02-02T00:46:19","modified_gmt":"2025-02-01T23:46:19","slug":"how-to-install-apache-cassandra-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-apache-cassandra-on-ubuntu-22-04\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 Apache Cassandra on Ubuntu 22.04"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<header>\n<h1>\u00a0<\/h1>\n<\/header>\n<article>\n<p><strong>Apache Cassandra<\/strong> is a powerful open-source NoSQL database designed for scalability, fault tolerance, and high availability. It is widely used in distributed environments to manage large amounts of data efficiently. In this guide, we will walk you through the steps to install Apache Cassandra on <strong>Ubuntu 22.04<\/strong>. For better performance and scalability, we recommend hosting Cassandra on a  server. A <strong>VPS server<\/strong> provides dedicated resources and ensures reliable database management.<\/p>\n<h2>Step 1: Update Your VPS Server<\/h2>\n<p>Before installing Apache Cassandra, ensure your <a href=\"https:\/\/ie.netcloud24.com\">VPS server<\/a> is up to date. Use the following commands to update the system:<\/p>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n<p>By hosting your database on a <strong>Windows VPS<\/strong>, you benefit from better resource management and the ability to scale as your data grows, ensuring optimal performance for Apache Cassandra.<\/p>\n<h2>Step 2: Add the Apache Cassandra Repository<\/h2>\n<p>Cassandra is not available in the default Ubuntu repositories, so you will need to add the official Apache Cassandra repository. First, install the required dependencies:<\/p>\n<pre><code>sudo apt install apt-transport-https ca-certificates -y<\/code><\/pre>\n<p>Next, import the GPG key for the Cassandra repository:<\/p>\n<pre><code>curl https:\/\/downloads.apache.org\/cassandra\/KEYS | sudo apt-key add -<\/code><\/pre>\n<p>Then, add the Apache Cassandra repository to your system:<\/p>\n<pre><code>\r\necho \"deb https:\/\/downloads.apache.org\/cassandra\/debian 40x main\" | sudo tee \/etc\/apt\/sources.list.d\/cassandra.list\r\n<\/code><\/pre>\n<h2>Step 3: Install Apache Cassandra<\/h2>\n<p>After adding the repository, install Apache Cassandra by running the following commands:<\/p>\n<pre><code>\r\nsudo apt update\r\nsudo apt install cassandra -y\r\n<\/code><\/pre>\n<h2>Step 4: Start and Enable the Cassandra Service<\/h2>\n<p>Once Cassandra is installed, start the service and enable it to run at boot:<\/p>\n<pre><code>\r\nsudo systemctl start cassandra\r\nsudo systemctl enable cassandra\r\n<\/code><\/pre>\n<p>You can check the status of the Cassandra service with this command:<\/p>\n<pre><code>sudo systemctl status cassandra<\/code><\/pre>\n<h2>Step 5: Verify the Installation<\/h2>\n<p>To verify that Cassandra is running correctly, connect to the Cassandra command-line interface (CLI) using the <code>cqlsh<\/code> tool:<\/p>\n<pre><code>cqlsh<\/code><\/pre>\n<p>Once in the Cassandra shell, run the following query to check the cluster name and version:<\/p>\n<pre><code>SELECT cluster_name, release_version FROM system.local;<\/code><\/pre>\n<p>If the installation is successful, you should see the cluster name and release version displayed.<\/p>\n<h2>Step 6: Configure Apache Cassandra<\/h2>\n<p>Cassandra\u2019s default configuration works well for basic setups, but you can modify the configuration files in the <code>\/etc\/cassandra\/<\/code> directory to suit your specific needs. For example, you can adjust the cluster name, set up multiple nodes, or tweak memory usage. After making any changes, restart the Cassandra service:<\/p>\n<pre><code>sudo systemctl restart cassandra<\/code><\/pre>\n<h2>Step 7: Create a Keyspace and Table<\/h2>\n<p>In Cassandra, a keyspace is similar to a database. To create a keyspace, open the <code>cqlsh<\/code> shell and run the following command:<\/p>\n<pre><code>\r\nCREATE KEYSPACE mykeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};\r\n<\/code><\/pre>\n<p>Switch to your new keyspace:<\/p>\n<pre><code>USE mykeyspace;<\/code><\/pre>\n<p>Create a table within the keyspace:<\/p>\n<pre><code>\r\nCREATE TABLE users (\r\n    id UUID PRIMARY KEY,\r\n    name text,\r\n    age int\r\n);\r\n<\/code><\/pre>\n<h2>Step 8: Insert Data and Query the Table<\/h2>\n<p>Insert some data into the table:<\/p>\n<pre><code>\r\nINSERT INTO users (id, name, age) VALUES (uuid(), 'Alice', 25);\r\n<\/code><\/pre>\n<p>Query the table to see the inserted data:<\/p>\n<pre><code>SELECT * FROM users;<\/code><\/pre>\n<p>The result should display the data you just inserted.<\/p>\n<h2>Step 9: Optimize Your VPS Server for Cassandra<\/h2>\n<p>Hosting Apache Cassandra on a  ensures that your database runs efficiently with dedicated resources, including CPU, RAM, and storage. A <strong>VPS server<\/strong> allows you to handle large-scale databases, distribute workloads, and maintain high availability. As your data grows, you can easily scale your infrastructure to meet increasing demands.<\/p>\n<h2>Conclusion<\/h2>\n<p>Installing Apache Cassandra on Ubuntu 22.04 provides a robust solution for managing distributed data in high-performance environments. By deploying Cassandra on a , you gain improved performance, scalability, and control over your database infrastructure, making it ideal for modern applications requiring fault tolerance and high availability.<\/p>\n<p>For more information about VPS hosting and optimizing your Apache Cassandra setup, visit  today.<\/p>\n<\/article>\n<footer>\n<p>\u00a9 2024 Windows VPS &#8211; All Rights Reserved<\/p>\n<\/footer>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 Apache Cassandra is a powerful open-source NoSQL database designed for scalability, fault tolerance, and high availability. It is widely used in distributed environments to manage large\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2731","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2731"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2731\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}