Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: September 3, 2025
Apache CloudStack is an open-source Infrastructure-as-a-Service (IaaS) platform that simplifies computing, storage, and networking resources across diverse data centers. It was initially developed by Cloud.com and later adopted by the Apache Software Foundation. It supports multiple hypervisors, including KVM, VMware, and XenServer, and provides a clean web interface and a powerful API. Whether we’re deploying a private or public cloud, CloudStack offers the tools to build a flexible, production-ready infrastructure with minimal overhead.
In this tutorial, we’ll look at Apache CloudStack, understand its functionality, and discover the way it interacts with other technologies.
Apache CloudStack is an open-source software platform that automates the deployment, management, and configuration of virtualized IT environments.
It serves as the control center of a cloud infrastructure, coordinating virtual machines, storage, and network resources to enable the building of scalable public and private clouds. Written in Java, CloudStack comprises a management server and lightweight agents that run on each hypervisor host, thus efficiently managing resources.
One of CloudStack’s key strengths is its broad hypervisor support:
The container technologies and seamless hypervisor interaction enable it to adapt to a wide range of infrastructure environments.
On the networking side, CloudStack provides two models:
Basic networking utilizes a single flat network, suitable for straightforward use, while advanced networking enables VLAN segmentation and integration with software-defined networking (SDN) solutions, such as Nicira NVP.
CloudStack organizes storage into primary and secondary tiers to ensure efficiency and scalability:
Furthermore, CloudStack simplifies interaction with these components through its web-based dashboard and REST-like API, which includes EC2 compatibility for easier migration and automation.
With built-in load balancing, failover, and multi-region support, CloudStack can manage tens of thousands of servers.
For example, an e-commerce company could dynamically spin up new VMs during high-traffic periods like holiday sales. This adaptability underpins CloudStack’s popularity among both small businesses and global enterprises.
The management server runs on Apache Tomcat and is supported by a MySQL database. It’s responsible for organising all operations, allocating IP addresses, assigning VMs to hosts, handling storage, and managing user access. In high-availability environments, we can deploy multiple management servers behind a load balancer.
CloudStack organizes its infrastructure hierarchically:
This way, the platform organizes dispersed physical hardware into coordinated logical units.
Getting Apache CloudStack up and running may seem daunting at first. However, with a clear strategy and the right environment, the process becomes manageable. While the full deployment process is quite extensive, especially for production-grade clouds, a streamlined setup is achievable for testing and small-scale use cases.
To begin, we prepare a compatible environment, typically using a stable Linux distribution such as Rocky Linux, AlmaLinux, or Oracle Linux.
The setup requires at least one management server and one or more hypervisor hosts. We can use KVM since it’s a common and well-supported choice. In addition, the servers must support hardware virtualization.
Once we’ve chosen a distro, let’s upgrade the system before making any configurations:
$ dnf -y upgrade
In fact, this is important for compatibility.
Before we install CloudStack, we need to configure basic networking with static IPs and ensure the system is updated and time-synchronized using NTP.
To begin, we need to create a bridge for CloudStack:
$ nmcli connection add type bridge con-name cloudbr0 ifname cloudbr0
$ nmcli connection modify eth0 master cloudbr0
$ nmcli connection up eth0
$ nmcli connection modify cloudbr0 ipv4.addresses '172.16.10.2/24' ipv4.gateway '172.16.10.1' ipv4.dns '8.8.8.8' ipv4.method manual && nmcli connection up cloudbr0
This configuration sets up a network bridge named cloudbr0, incorporating the physical network interface eth0 as a port within the bridge. Instead of assigning an IP address directly to eth0, we apply the static IP, gateway, and DNS settings to the bridge. This design enables the host and any connected virtual machines or containers to share the same physical network seamlessly.
Critically, CloudStack requires the hostname to be set. We can use the default one in the system, or we can change it:
$ hostname --fqdn
$ hostnamectl set-hostname server.local --static
Once this part of the networking setup is done, let’s reboot:
$ reboot
Next, we usually set SELinux to enforcing mode and ensure that the necessary SELinux policies are in place to allow the services to run correctly. However, in this case, the demonstration uses permissive mode, so SELinux policies aren’t required for services to operate.
Let’s configure SELinux to be permissive:
$ setenforce 0
To make this setting persistent, let’s edit the /etc/selinux/config file:
$ cat /etc/selinux/config
SELINUX=permissive
SELINUXTYPE=targeted
This way, we don’t need to change them after reboots.
Next, let’s ensure the machine time is synchronised.
In this case, we use chrony. Let’s install and start it:
$ dnf -y install chrony
$ systemctl enable chronyd
$ systemctl start chronyd
Now, the local time should be accurate.
Storage is also essential, so we set up directories for primary and secondary storage using NFS or alternatives like Ceph for more robust setups.
Let’s install nfs-utils:
$ dnf -y install nfs-utils
Next, we set up two NFS shares for both primary and secondary storage:
$ cat /etc/exports
/export/secondary (rw,async,no_root_squash,no_subtree_check)
/export/primary (rw,async,no_root_squash,no_subtree_check)
Now, let’s create the directories we specified in the export file:
$ mkdir -p /export/primary
$ mkdir /export/secondary
The domain setting should match in all clients. To achieve this, let’s modify the /etc/idmapd.conf file:
Domain = local
Further, to prevent connections from being blocked, we might need to configure the firewall. For troubleshooting purposes, we disable it:
$ systemctl stop firewalld
$ systemctl disable firewalld
Finally, let’s initialize the NFS server and ensure that it starts at boot:
$ systemctl enable rpcbind
$ systemctl enable nfs-server
$ systemctl start rpcbind
$ systemctl start nfs-server
We should now have a working NFS setup as the backbone of the environment.
The management server, acting as the brain of the cloud system, is installed with the CloudStack management package.
To begin with, we install MySQL:
$ dnf -y install mysql-server
Then, we make key adjustments to support database-intensive operations:
$ vi /etc/my.cnf.d/mysql-server.cnf
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
Let’s initialize the database and ensure it starts at boot:
$ systemctl enable mysqld
$ systemctl start mysqld
Now, we’re ready to deploy CloudStack.
So, let’s configure a CloudStack repository:
$ cat /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://download.cloudstack.org/centos/$releasever/4.20/
enabled=1
gpgcheck=0
Next, let’s download the management system:
$ dnf -y install cloudstack-management
Now that we’ve installed the management server, let’s set up the database:
$ cloudstack-setup-databases cloud:password@localhost --deploy-as=root
Then, we initialize and configure the management server:
$ cloudstack-setup-management
After these preparations, we need to install the required VM templates:
$ /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
-m /export/secondary -u http://download.cloudstack.org/systemvm/4.20/systemvmtemplate-4.20.1-x86_64-kvm.qcow2.bz2 -h kvm -F
CloudStack uses these templates to provide access to the console.
Now that we’ve configured the network, storage, and management server, let’s finalize the setup by installing and configuring KVM.
To that end, we first install the KVM agent:
$ dnf -y install cloudstack-agent
Then, we configure QEMU and libvirt for virtualization.
Let’s edit the /etc/libvirt/qemu.conf file and ensure the proper line exists and is uncommented, so that QEMU listens for connections:
$ cat /etc/libvirt/qemu.conf
...
vnc_listen=0.0.0.0
...
Next, let’s modify the /etc/libvirt/libvirtd.conf file and ensure it has the necessary parameters:
$ cat /etc/libvirt/libvirtd.conf
...
listen_tls = 0
listen_tcp = 1
tcp_port = "16509"
auth_tcp = "none"
mdns_adv = 0
...
The above settings enable libvirt to listen to insecure TCP connections.
Also, let’s uncomment the respective line in /etc/sysconfig/libvirtd:
$ cat /etc/sysconfig/libvirtd
...
LIBVIRTD_ARGS="--listen"
...
Lastly, we restart:
$ systemctl restart libvirtd
Thus, libvirt and QEMU should both be active and listening.
Although this summary covers the essentials, it only scratches the surface.
CloudStack’s architecture supports diverse environments, each requiring specific considerations. For a deeper walkthrough that includes multi-node setups, high availability, and production-ready configurations, we might need to refer to the official Apache CloudStack Installation Guide, which provides extensive instructions tailored to different needs.
Many organisations trust Apache CloudStack and utilize it to power a variety of cloud infrastructures. For instance, let’s look at how CloudINFra uses it.
ClouDINfra uses Apache CloudStack to manage a large-scale private cloud infrastructure based on KVM hypervisors and Ceph RBD for block storage. CloudStack’s native support for Ceph enables seamless integration, enabling efficient and scalable storage provisioning without the need for additional plugins.
This setup supports high-volume workloads and ensures data redundancy and fault tolerance across multiple availability zones.
The platform utilizes CloudStack’s advanced networking capabilities to manage tenant isolation, dynamic IP assignments, and virtual routing services. Infrastructure provisioning is fully automated using the CloudStack REST API in combination with tools like Ansible, enabling consistent and rapid deployment of services.
This high level of automation and coordination means ClouDINfra delivers flexible, multi-tenant environments while maintaining operational efficiency and control.
In conclusion, Apache CloudStack stands out as a comprehensive, production-ready solution for building and managing cloud environments. Its support for multiple hypervisors, advanced networking options, and robust storage handling provides the flexibility we need to tailor our infrastructure to specific goals. Whether deploying a small-scale test environment or scaling across global data centers, CloudStack’s architecture makes it possible without added complexity.