Skip to content

DaLaw2/CloudStack-4.20.0-Installation-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

CloudStack 4.20.0 Installation Guide

Requirement

  • Support OS: Ubuntu 24.04
  • Architecture: amd64, aarch64

Please enter the root environment first:

sudo su

To install these packages, run the following command:

apt install vim openntpd -y

Quick installation

Using the shell

bash -c "$(curl -fsSL https://raw.githubusercontent.com/ParrotXray/CloudStack-4.20.0-Installation-Guide/refs/heads/main/cloudstack_install.sh)"

Installation

Install SSH

  1. Install SSH by running the following command:
apt install openssh-server -y
  1. Configure the SSH configuration file by editing it with the following command:
vim /etc/ssh/sshd_config
  1. Append the following lines to the end of the file:
PermitRootLogin yes
KexAlgorithms=+diffie-hellman-group-exchange-sha1
PubkeyAcceptedKeyTypes=+ssh-dss
HostKeyAlgorithms=+ssh-dss
KexAlgorithms=+diffie-hellman-group1-sha1
  1. Save the file and exit.
  2. Restart the SSH service to apply the new configuration:
systemctl restart ssh

Configure Network

Before configuring the network, you need to install some required packages.

Run the following command to install net-tools and bridge-utils:

apt install net-tools bridge-utils -y

This will install the necessary tools for managing network interfaces and bridges on your Ubuntu.

To configure the network, follow these steps:

  1. Use the following command to get details about your network cards:
ifconfig

Make a note of the name of the network card that you want to use for the network bridge.

  1. Edit the network configuration file by running the following command:
vim /etc/netplan/01-network-manager-all.yaml
  1. Modify the file as follows:
network:
  version: 2
  renderer: networkd
  ethernets:
    $NATNIC:
      dhcp4: false
      dhcp6: false
      optional: true
  bridges:
    cloudbr0:
      dhcp4: false
      dhcp6: false
      interfaces: [$NATNIC]
      addresses: [$LANIP/$CIDR]
      routes:
       - to: default
         via: $GATEWAY
      nameservers:
        addresses: [$DNS1, $DNS2]
      parameters:
        stp: false
        forward-delay: 0

In the configuration file provided above, you need to replace the following parameters with your own settings:

  • $NATNIC: the name of your network card
  • $LANIP: This should be replaced with the IP address you want to set. For example, 192.168.4.100.
  • $CIDR: This should be replaced with the subnet mask of your network card, expressed in CIDR notation. To calculate the CIDR notation from the subnet mask, you can use an online subnet calculator or consult the documentation for your network equipment. For example, if your subnet mask is 255.255.248.0, the CIDR notation is /21.
  • $GATEWAY: This should be replaced with the IP address of your network gateway. For example, 192.168.0.1
  • $DNS: Enter the DNS server IP address. For example, 8.8.8.8, 8.8.4.4

Notice: Misconfiguration may cause the remote end to fail to connect

  1. Save the file and exit.
  2. Set correct permissions:
chmod 600 /etc/netplan/01-network-manager-all.yaml
chown root:root /etc/netplan/01-network-manager-all.yaml
  1. Check the configuration by running the following command:
netplan generate

If there are no errors, apply the configuration by running the following command:

netplan apply

This will apply the new network configuration and configure the network bridges with the specified settings.

Install NFS

  1. Install NFS server and client packages by running the following command:
apt install nfs-kernel-server nfs-common -y
  1. Create the directories for NFS mounts:
mkdir /export
mkdir -m 777 /export/primary
mkdir -m 777 /export/secondary
mkdir -m 777 /mnt/primary
mkdir -m 777 /mnt/secondary
  1. Set NFS exports by running the following commands:
echo "/export/secondary *(rw,async,no_root_squash,no_subtree_check)" >> /etc/exports
echo "/export/primary *(rw,async,no_root_squash,no_subtree_check)" >> /etc/exports
  1. Configure the NFS kernel server settings by editing the configuration file with the following command:
vim /etc/default/nfs-kernel-server
  1. Append the following lines to the end of the file:
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020
  1. Save the file and exit.
  2. Enable the NFS server and restart it to apply the new configuration by running the following commands:
systemctl enable nfs-kernel-server
systemctl restart nfs-kernel-server
  1. Mount NFS shares by running the following command:
exportfs -a
  1. Set up automatic NFS mounting during startup by editing the /etc/fstab file with the following command:
vim /etc/fstab
  1. Append the following lines to the end of the file:
$LANIP:/export/primary    /mnt/primary   nfs defaults 0 0
$LANIP:/export/secondary    /mnt/secondary   nfs defaults 0 0

Replace $LANIP with the IP address you set up in Configure Network step 3.

  1. Save the file and exit.
  2. Finally, restart systemd and mount NFS by executing the following commands:
systemctl daemon-reload
mount -a

Install CloudStack Management

  1. Install MySQL database before installing CloudStack Management with the following command:
apt install mysql-server -y
  1. Configure MySQL by editing the cloudstack.cnf file with the following command:
vim /etc/mysql/conf.d/cloudstack.cnf
  1. Add the following lines to the file:
[mysqld]
server-id=master-01
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
  1. Save the file and exit.
  2. Enable and start the MySQL service with the following commands:
systemctl enable mysql.service
systemctl start mysql.service
  1. Change MySQL password by running the following commands:
mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '$mysqlRootPassword';
exit

Replace $mysqlRootPassword with the root password you want to change

  1. Run the mysql_secure_installation command and answer the prompts as follows:
  • Enter the password you just set for the MySQL root user.
  • Would you like to setup VALIDATE PASSWORD component? N
  • Change the password for root? N
  • Remove anonymous users? N
  • Disallow root login remotely? Y
  • Remove test database and access to it? Y
  • Reload privilege tables now? Y
  1. Add the CloudStack Management package to the apt source with the following commands:
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.20 / > /etc/apt/sources.list.d/cloudstack.list
  1. Update apt with the following command:
apt update
  1. Install CloudStack Management with the following command:
apt install cloudstack-management -y
  1. Set up the CloudStack database with the following command:
cloudstack-setup-databases cloud:$mysqlCloudPassword@localhost \
--deploy-as=root:$mysqlRootPassword \
-e file \
-m $managementServerKey \
-k $databaseKey \
-i $LANIP
  • $mysqlCloudPassword is the password of the account created by CloudStack you need to set
  • $mysqlRootPassword is the password you just set in step 6
  • $managementServerKey is the management server key you need to set.
  • $databaseKey is the database key you need to set.
  • $LANIP is the IP address you set up in Configure Network step 3.
  1. Complete the configuration of CloudStack Management with the following command:
cloudstack-setup-management
  1. Install SystemVM for CloudStack Management with the following command:
/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
-m /mnt/secondary \
-u http://download.cloudstack.org/systemvm/4.20/systemvmtemplate-4.20.1-x86_64-kvm.qcow2.bz2 \
-h kvm \
-s $managementServerKey \
-F
  • $managementServerKey is the management server key you just set in step 12.
  1. Set sudoers to make sure everything works with the following command:
vim /etc/sudoers
  1. Append the following line to the end of the file:
Defaults:cloud !requiretty

Install CloudStack Agent

  1. Install CloudStack agent by running the following command:
apt install cloudstack-agent -y
  1. Enable CloudStack Agent service with the following commands:
systemctl enable cloudstack-agent.service
  1. Configure QEMU by editing the qemu.conf file with the following command:
vim /etc/libvirt/qemu.conf
  1. Find the identifier and uncomment, change or append to the configuration:
vnc_listen = "0.0.0.0"
  1. Save the file and exit.
  2. Configure the hypervisor by editing the libvirtd.conf file with the following command:
vim /etc/libvirt/libvirtd.conf
  1. Find the identifier and uncomment, change or append to the configuration:
listen_tls = 0
listen_tcp = 1
tcp_port = "16509"
auth_tcp = "none"
mdns_adv = 0
  1. Save the file and exit.
  2. Configure the hypervisor by editing the libvirtd file with the following command:
vim /etc/default/libvirtd
  1. Find the identifier and uncomment, change or append to the configuration:
LIBVIRTD_ARGS="--listen"
  1. Save the file and exit.
  2. Mask libvirt for listening with the following command:
systemctl mask libvirtd.socket libvirtd-ro.socket \
libvirtd-admin.socket libvirtd-tls.socket libvirtd-tcp.socketd
  1. Restart libvirtd to make the configuration take effect
systemctl restart libvirtd
  1. Disable AppArmor with the following commands:
ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
ln -s /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper /etc/apparmor.d/disable/
apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper

Start Using CloudStack

Setup Zone

Enter this URL in your browser to log in to cloudstack

$LANIP:8080

Replace $LANIP with the IP address you set up in Configure Network step 3.

Then you will see this screen Enter default account: admin and default password: password to log in

image

After login, you will come to this screen Press "Continue with Initlization" in the lower right corner

image

Cloudstack requires you to change the password for user admin Notice: If you forget your password, it will be irretrievable

image

Select the option "Core" and press "Next"

image

Select the option "Basic" and press "Next"

image

Please change as follows

  • Name: Zone1
  • IPv4 DNS1: 8.8.8.8
  • IPv4 DNS2: 8.8.4.4
  • Internal DNS1: 8.8.8.8
  • Internal DNS2: 8.8.4.4
  • Hypervisor: KVM

Then press "Next" to continue

image

No need to set here, press "Next"

image

Please change as follows

  • Pod Name: Pod1
  • Reserved system gateway: Please enter your $GATEWAY is what you entered in the Configure Network step 3
  • Reserved system netmask: Please enter your netmask, which is what you converted to $CIDR in step 3 of Configure Network
  • Start/End reserved system IP: Please enter a network segment for CloudStack to use

Then press "Next" to continue

image

Please change as follows

  • Guest gateway: Please enter your $GATEWAY is what you entered in the Configure Network step 3
  • Guest netmask: Please enter your netmask, which is what you converted to $CIDR in step 3 of Configure Network
  • Guest start/end IP: Please enter a network segment for CloudStack to use

Then press "Next" to continue

image

Please change as follows

  • Cluster name: Cluster1

Then press "Next" to continue

image

Please change as follows

  • Host name: Please enter your $LANIP is what you entered in the Configure Network step 3
  • Username: root
  • Password: Please enter your root password

If you don't know the root password, use the following commands to change root password:

passwd

Then press "Next" to continue

image

Please change as follows

  • Name: Primary1
  • Protocol: nfs
  • Server: Please enter your $LANIP is what you entered in the Configure Network step 3
  • Path: /export/primary

Then press "Next" to continue

image

Please change as follows

  • Protocol: NFS
  • Name: Secondary1
  • Server: Please enter your $LANIP is what you entered in the Configure Network step 3
  • Path: /export/secondary

Then press "Next" to continue

image

Press "Launch zone" to set the zone

image

After setting up the zone, click "Enable Zone".

image

Create Instance

Before creating an instance, a bootable iso must be available

Click "Images" on the left item and then click "ISOs" to come to this screen

image

Press "Register ISO"

After pressing "Register iso", you will come to this screen

image

Please change as follows

Then press "OK" to continue

image

Then wait until complete

image

In order to speed up, you need to add a Compute offerings setting

Click "Service offerings" on the left item and then click "Compute offerings" to come to this screen

image

Press "Add Compute offerings"

After pressing "Add Compute offerings", you will come to this screen

image

Please change as follows

  • Name: Large Instance
  • Description: Large Instance
  • CPU cores: Adjust to your needs
  • CPU (in MHz): Adjust to your needs
  • Memory (in MB): Adjust to your needs

Then press "OK" to continue

image

Completed adding Compute offerings Now to create instance

Click "Compute" on the left item and then click "Instance" to come to this screen

image

Press "Add Instance"

After pressing "Add Instance", you will come to this screen

image

Please change as follows

  • Select "ISOs" in "Template/ISO" and then select "Community"
  • Select "Large Instance" in "Compute offering"
  • Disk size is selected according to your needs

Then press "Launch instance" to continue After a while, you will see the instance successfully started

image

You can operate instance by press "View console" You need to install Ubuntu in the instance The installation process will not repeat

image

Now there is one instance with Ubuntu in it

Enable UEFI booting for Instance

Requirement

The host system must be installed in UEFI mode.

You can verify the current boot mode using the following command:

test -d /proc/device-tree && echo "U-Boot mode" || (test -d /sys/firmware/efi && echo "UEFI boot mode" || echo "Legacy BIOS boot")

Configuration file

  1. Configure QEMU by editing the qemu.conf file with the following command:
vim /etc/libvirt/qemu.conf
  1. Find the identifier and uncomment, change or append to the configuration:
nvram = [
  "/usr/share/OVMF/OVMF_CODE_4M.fd:/usr/share/OVMF/OVMF_VARS_4M.fd",
  "/usr/share/OVMF/OVMF_CODE_4M.secboot.fd:/usr/share/OVMF/OVMF_VARS_4M.fd",
  "/usr/share/OVMF/OVMF_CODE_4M.ms.fd:/usr/share/OVMF/OVMF_VARS_4M.ms.fd"
]
  1. UEFI related params information added in uefi.properties which is located /etc/cloudstack/agent
vim /etc/cloudstack/agent/uefi.properties
  1. Paste the specified content into the uefi.properties file
guest.nvram.template.secure=/usr/share/OVMF/OVMF_VARS_4M.ms.fd
guest.loader.secure=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd

guest.nvram.template.legacy=/usr/share/OVMF/OVMF_VARS_4M.fd
guest.loader.legacy=/usr/share/OVMF/OVMF_CODE_4M.fd

guest.nvram.path=/var/lib/libvirt/qemu/nvram/
  1. Restart the service using the following command:
systemctl restart libvirtd cloudstack-agent cloudstack-management
  1. Click on "Infrastructure" on the left side, then click on "Host" to enter this screen

image

  1. Click on the host in use to enter this screen

image

  1. Find "UEFI supported" below the "Details" section; if it shows true, it means the setup was successful

image

  1. When creating an "instance", enable "Advanced" mode and select "UEFI" as the "Boot type"

image

Access the VM via the public network

Requirement

A public IP address is required to do this

Steps

  1. Click on "Infrastructure" on the left side, then click on "System VMs" to enter this screen

image

  1. Copy the "IP address" next to "consoleproxy"

image

  1. Go into the router and use the copied "IP address" to set up "port forwarding"

image3

  1. Need to open ports 80 and 8080. If using HTTPS, also need to open ports 443 and 8443

image

  1. Now, to access View Console, simply replace the "internal IP" in the URL with the "public IP"

image

The following items are optional because they require a domain name to use

  1. Click on "Configuration" on the left side, then click on "Global Settings" to enter this screen

image

  1. Search for "Consoleproxy" in the search bar

image

  1. Scroll down to find the "Consoleproxy URL domain (consoleproxy.url.domain)" item

image

  1. Enter a valid domain name. Note that this field only accepts valid domain names and local IP addresses.

image

  1. If HTTPS connection is required, enable "Consoleproxy SSL Enabled (consoleproxy.sslEnabled)"

image

  1. After entering, press Enter and then restart the service
systemctl restart cloudstack-management
  1. Now, with this setup, you no longer need to manually replace the IP address to access View Console image

Some Problem Solutions

Secondary Not Found

If you encounter the "Secondary not found", you can try the following steps to resolve it:

  1. Restart the NFS server service using the following command:
systemctl restart nfs-server.service
  1. Export all filesystems using the following command:
exportfs -a
  1. Mount all filesystems listed in /etc/fstab using the following command:
mount -a
  1. Restart the CloudStack Agent using the following command:
systemctl restart cloudstack-agent.service
  1. Finally, restart the Secondary SystemVM in the CloudStack Management.

Reference

About

This is the CloudStack 4.20.0 Installation Guide

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages