Table of contents
- Prerequisites
- Step 1: Update and Upgrade System
- Step 2: Add CloudStack Repository
- Step 3: Install and Configure MySQL Database
- Step 4: Configure SELinux
- Step 5: Set Up CloudStack Database
- Step 6: Configure NFS for Primary and Secondary Storage
- Step 7: Start CloudStack Services
- Step 8: Access CloudStack UI
- Conclusion
Apache CloudStack is an open-source cloud computing platform that allows you to deploy and manage large networks of virtual machines. This guide will walk you through the step-by-step installation process on Ubuntu 22.
Prerequisites
Ubuntu 22 (with hardware virtualization support)
A
/24
Network with a gateway***.***.***.1
and no DHCP to avoid dynamic IP assignment for VMs
Step 1: Update and Upgrade System
sudo apt update && sudo apt upgrade -y
Verify the hostname and network connectivity:
hostname --fqdn
ping 8.8.8.8
Install Chrony for time synchronization:
sudo apt install chrony -y
CloudStack requires Java 17 JRE, which is automatically installed. However, you can configure it beforehand:
sudo apt install openjdk-17-jre -y
Step 2: Add CloudStack Repository
echo "deb https://download.cloudstack.org/ubuntu focal 4.20" | sudo tee /etc/apt/sources.list.d/cloudstack.list
Add the repository key:
wget -O - https://download.cloudstack.org/release.asc | sudo tee /etc/apt/trusted.gpg.d/cloudstack.asc
Update package lists:
sudo apt update
Install CloudStack management server:
sudo apt install cloudstack-management -y
Step 3: Install and Configure MySQL Database
Install MySQL server:
sudo apt install mysql-server -y
Edit the MySQL configuration file:
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
Add the following under [mysqld]
:
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
Restart MySQL service:
sudo systemctl restart mysql
Secure MySQL installation:
sudo mysql_secure_installation
Provide โYโ for all options.
Step 4: Configure SELinux
Check if SELinux is installed:
dpkg -l | grep selinux
Modify the SELinux configuration:
sudo vi /etc/selinux/config
Change:
SELINUX=enforcing
To:
SELINUX=permissive
Apply changes immediately without reboot:
sudo setenforce permissive
Step 5: Set Up CloudStack Database
Use the CloudStack script:
cloudstack-setup-databases cloud:<dbpassword>@localhost --deploy-as=root:<password> -e file -m management_key -k database_key -i <management_server_ip>
Or manually configure MySQL:
CREATE DATABASE cloud;
CREATE DATABASE cloud_usage;
CREATE USER 'cloud'@'localhost' IDENTIFIED BY '<password>';
CREATE USER 'cloud'@'%' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON cloud.* TO 'cloud'@'localhost';
GRANT ALL PRIVILEGES ON cloud.* TO 'cloud'@'%';
GRANT ALL PRIVILEGES ON cloud_usage.* TO 'cloud'@'localhost';
GRANT ALL PRIVILEGES ON cloud_usage.* TO 'cloud'@'%';
GRANT PROCESS ON *.* TO 'cloud'@'localhost';
GRANT PROCESS ON *.* TO 'cloud'@'%';
Step 6: Configure NFS for Primary and Secondary Storage
Install NFS server:
sudo apt install nfs-kernel-server -y
Create storage directories:
mkdir -p /export/primary
mkdir -p /export/secondary
Edit the NFS exports file:
sudo vi /etc/exports
Add:
/export *(rw,async,no_root_squash,no_subtree_check)
Apply changes:
sudo exportfs -a
Edit NFS configuration:
sudo vi /etc/default/nfs-kernel-server
Uncomment:
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020
Allow ports :
sudo ufw allow from <NETWORK> to any proto udp port 111
sudo ufw allow from <NETWORK> to any proto tcp port 111
sudo ufw allow from <NETWORK> to any proto tcp port 2049
sudo ufw allow from <NETWORK> to any proto tcp port 32803
sudo ufw allow from <NETWORK> to any proto udp port 32769
Restart iptables:
sudo systemctl restart iptables
sudo systemctl save iptables
Step 7: Start CloudStack Services
Restart NFS and enable services:
sudo systemctl start rpcbind
sudo systemctl start nfs-kernel-server
sudo systemctl enable rpcbind
sudo systemctl enable nfs-kernel-server
cloudstack-setup-management
Install KVM
sudo apt update sudo apt install -y qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst
add your user to libvirt group
sudo usermod -aG libvirt $(whoami) sudo usermod -aG kvm $(whoami)
run
newgrp libvirt
enable kvm
sudo systemctl enable --now libvirtd sudo systemctl start libvirtd
systemctl status libvirtd
verify
sudo virsh list --all
Install CloudStack Agent and UI
Install CloudStack Agent:
sudo apt install cloudstack-agent -y
Install CloudStack UI:
sudo apt install cloudstack-ui -y
Reboot the management server:
sudo reboot
Start CloudStack management service:
sudo systemctl start cloudstack-management
Check service status:
systemctl status cloudstack-management
Open the required port:
sudo ufw allow 8080/tcp
Step 8: Access CloudStack UI
Once everything is set up, access the CloudStack UI via:
http://<Management-Server-IP>:8080/client
Default Credentials:
Username:
admin
Password:
password
Conclusion
You have successfully installed and configured Apache CloudStack on Ubuntu 22. Now, you can proceed with configuring zones, templates, and instances. ๐
For any issues, feel free to drop a comment below! Happy cloud computing! โ๏ธ๐ฅ