April 25, 2024 by CodeFlowerHorn

Setting Up a Management Server in Apache CloudStack


The management server is a critical component responsible for managing the entire CloudStack infrastructure. It acts as the control plane for the cloud environment, handling tasks such as user authentication, resource provisioning, virtual machine lifecycle management, and monitoring.

Add the repository for Apache Cloudstack

The Apache CloudStack version we used is 4.19

                                    mkdir -p /etc/apt/keyrings
wget -O- http://packages.shapeblue.com/release.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/cloudstack.gpg > /dev/null

echo deb [signed-by=/etc/apt/keyrings/cloudstack.gpg] http://packages.shapeblue.com/cloudstack/upstream/debian/4.19 / > /etc/apt/sources.list.d/cloudstack.list
apt update -y
apt install cloudstack-management mysql-server net-tools -y
                                
Configure MySQL settings

Insert all this code below [mysqld]

nano /etc/mysql/mysql.conf.d/mysqld.cnf

                                    server_id = 1
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION"
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=1000
log-bin=mysql-bin
binlog-format = 'ROW'
                                
Login to MySQL

mysql -u root -p

                                    SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
use mysql;
UPDATE user SET plugin="mysql_native_password" WHERE User='root';
flush privileges;
\q
                                
Restart the MySQL service
                                    systemctl restart mysql
                                
Setup static ip using netplan.

After you paste the code below run netplan apply

                                    network:
version: 2
renderer: NetworkManager
ethernets:
    enp0s3:
        addresses: [192.168.1.100/24]
        nameservers:
            addresses: [8.8.8.8, 8.8.4.4]
        routes:
            - to: default
            via: 192.168.1.1
                                
Paste your static ip in /etc/hosts

Make sure to comment out the #127.0.1.1 ubuntu1

                                    127.0.0.1       localhost
#127.0.1.1      ubuntu1
192.168.1.100   ubuntu1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
                                
SSH Authorized key

cat /var/lib/cloudstack/management/.ssh/id_rsa.pub

                                    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC7BhkJlLiglLzgeOjPE+0FBy6q6ICOTFWvRODfqGuKnS4YbOebo5j0IdIVFnDuItAiEcTuEZxatr0osvZLD/zrG0HGLcNZgsV+EA8+xdGQgwQOS7LQa3diloAfTu/RGS2V3ZKRSK/mLKhBYyhJfKWAuo59MxfYm9XETja/cuN/1eCb0bFs65md6NwT/wL9JSM9x5WBJufB67gPBLRa06+alN13rHaqm2hB5P0/yd4lCmJMQLTe0FgejqG+mwjQt2fQTMtmBF2AyBvrQu8d5pbuPGwP+OfzMD3hQhrbrZZj5M4ctxHUhB9s57CVzB6CDFllRM8ASy2JVJMoE1AEEAVdgp8Dq/dmnvA3988lEEdRA4l8Tm4taLByAwbmH/WHwVlWv/mmGGiQ6UETYBw5Vx1SmPLxMFffgVxLdHVYYDLY/t+0oEFSC+gipD3nhhEkSIIFyjVirVaWe+zzhQpqt662F9xHzAWN72ln5TkCSL3qKZ4/MOg9hCyL7V0r6knYzos= cloud@ubuntu1
                                
Setup database for Apache CloudStack
                                    cloudstack-setup-databases cloud:machinepassword@localhost --deploy-as=root:password
                                
Setup management server
cloudstack-setup-management
                                    cloudstack-setup-management
                                
Open the dashboard
                                    http://192.168.1.100:8080/client