Climbing into the cloud with Apache CloudStack
Setting Up an Initial Cluster
The best way to get started with CloudStack is to set up a small cluster. The host I used for this example is a fairly powerful workstation running Ubuntu 14.04. In addition to having sufficient RAM and hard disk space, the system also supports hardware-accelerated virtualization. In this article, I describe how to set up the management server. Once you get the management server running, you will find it is easy to set up the virtual machines.
As a first step, download the Network Time Protocol application OpenNTP. CloudStack assumes the clocks on all of the computers are in sync:
sudo apt-get install openntpd
Fortunately, you don't need to build CloudStack from scratch because Apache has a repository with prebuilt packages for Debian. Create an /etc/apt/sources.list.d/cloudstack.list
file with the following content:
deb http://cloudstack.apt-get.eu/ubuntu precise 4.4
You need a full-fledged root shell to add the repository key. In the case of Ubuntu, you can use sudo su
:
# wget -O - http://cloudstack.apt-get.eu/release.asc|apt-key add # apt-get update # apt-get install cloudstack-management cloudstack-agent
Note that both cloudstack-management
and cloudstack-agent
come with a large number of dependencies. If your Internet connection is slow, you can expect an interruption of several minutes. The next step is to download the MySQL service for your storage database:
apt-get install mysql-server
Apt-get will prompt you during deployment for a root password – in the following steps, I have used dbpw. Now open the configuration file, /etc/mysql/my.cnf
, in your choice of editor. Go to the [mysqld]
section, and set the following parameter. The snippet here assumes that the database only needs to support one management server – each server can cause up to 350 simultaneous connections:
innodb_rollback_on_timeout=1 innodb_lock_wait_timeout=600 max_connections=350 log-bin=mysql-bin binlog-format = 'ROW'
After saving the entries, you need to restart the database (service mysql restart
) in order to apply the new settings. The actual deployment of the schema is then handled using a tool provided by CloudStack:
cloudstack-setup-databases cloud:dbpw@localhost -deploy-as=root:dbpw -i <Server-IP-Address>
Some recent MySQL versions suffer from a bug that rears its ugly head on processing the installation command. But unfortunately, a fix is not on the roadmap until CloudStack 4.6. To fix the bug, open the file /usr/share/cloudstack-management/setup/create-schema-premium.sql
in an editor. Then change the lines shown in Listing 1 (`cloud`.
prefix added) and restart the command. You should then see:
Applying /usr/share/cloudstack-management/setup/templates.sql [ OK ] Processing encryption ... [ OK ] Finalizing setup ... [ OK ] CloudStack has successfully initialized database, check your database configuration in /etc/cloudstack/management/db.properties
The configuration shown here ignores the security functions implemented in CloudStack. You can encrypt the database if needed to hide the passwords and other information in its stores – see the Installation Guide for more details.
Listing 1
MySQL Bug Fix
Working Without a Host
If you do not want to create a host in the Wizard-supported setup, just enter meaningless information in the host window. The wizard will create a zone, a pod, and all the rest but stop before setting up the host. Wait until the session times out – the next time you log in, you will be taken to the management window. Note that you cannot set up your primary and secondary storage until you have registered a host.
Adding Storage
Before you can use the CloudStack management server, you need to set up the storage infrastructure. To do so, create the two folders for primary and secondary export and then download the NFS server package:
mkdir -p /export/primary /export/secondary apt-get install nfs-kernel-server
Open the /etc/exports
file and add the following:
/export *(rw,async,no_root_squash,no_subtree_check)
Apache CloudStack co-developer Rohit Yadav published the commands in his blog that automate the further configuration of the NFS server on Ubuntu (Listing 2).
Listing 2
Automating the NFS Configuration
The exportfs -a
command should run without any problems. In the case of very large images, another couple of changes are required [3]. First, create two mountpoints; then, mount the two NFS directories. This setup is useful for testing the server configuration:
mkdir -p /mnt/primary /mnt/secondary mount -t nfs Server:/export/primary /mnt/primary mount -t nfs Server:/export/secondary /mnt/secondary
If the mount process does not complete successfully, the NFS server is not configured correctly.
To launch the management server, you need a system image. CloudStack comes with a script that automatically downloads the 5GB image from the Internet. The following command creates an environment that is suitable for KVM – see the Installation Guide [1] for more details:
/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \ -m /mnt/secondary \ -u http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.1-7-kvm.qcow2.bz2 \ -h kvm -F
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.