The official CloudStack release is always in source code form. You will
likely be able to find “convenience binaries,” the source is the
canonical release. In this section, we’ll cover acquiring the source
release and building that so that you can deploy it using Maven or
create Debian packages or RPMs.

Note that building and deploying directly from source is typically not
the most efficient way to deploy an IaaS. However, we will cover that
method as well as building RPMs or Debian packages for deploying
CloudStack.

The instructions here are likely version-specific. That is, the method
for building from source for the 4.7.x series is different from the
4.2.x series.

If you are working with a unreleased version of CloudStack, see the
INSTALL.md file in the top-level directory of the release.

If this successfully completes you should see no output. If there is any
output from them, then there is a difference between the hash you
generated locally and the hash that has been pulled from the server.

In addition to the MD5 hash, the CloudStack project provides a SHA512
cryptographic hash to aid in assurance of the validity of the downloaded
release. You can verify this hash by executing the following command:

If this command successfully completes you should see no output. If
there is any output from them, then there is a difference between the
hash you generated locally and the hash that has been pulled from the
server.

While we have defined, and you have presumably already installed the
bootstrap prerequisites, there are a number of build time prerequisites
that need to be resolved. CloudStack uses maven for dependency
resolution. You can resolve the buildtime depdencies for CloudStack by
running:

$ mvn -P deps

Now that we have resolved the dependencies we can move on to building
CloudStack and packaging them into DEBs by issuing the following
command.

$ dpkg-buildpackage -uc -us

This command will build the following debian packages. You should have
all of the following:

After you’ve created the packages, you’ll want to copy them to a system
where you can serve the packages over HTTP. You’ll create a directory
for the packages and then use dpkg-scanpackages to create
Packages.gz, which holds information about the archive structure.
Finally, you’ll add the repository to your system(s) so you can install
the packages using APT.

The first step is to make sure that you have the dpkg-dev package
installed. This should have been installed when you pulled in the
debhelper application previously, but if you’re generating
Packages.gz on a different system, be sure that it’s installed there
as well.

$ sudo apt-get install dpkg-dev

The next step is to copy the DEBs to the directory where they can be
served over HTTP. We’ll use /var/www/cloudstack/repo in the
examples, but change the directory to whatever works for you.

Now that we have created the repository, you need to configure your
machine to make use of the APT repository. You can do this by adding a
repository file under /etc/apt/sources.list.d. Use your preferred
editor to create /etc/apt/sources.list.d/cloudstack.list with this
line:

deb http://server.url/cloudstack/repo/binary ./

Now that you have the repository info in place, you’ll want to run
another update so that APT knows where to find the CloudStack packages.

As mentioned previously in “Prerequisites for building Apache CloudStack”, you will need to install
several prerequisites before you can build packages for CloudStack. Here we’ll
assume you’re working with a 64-bit build of CentOS or Red Hat Enterprise
Linux.

Next, you’ll need to install build-time dependencies for CloudStack with
Maven. We’re using Maven 3, so you’ll want to grab Maven 3.0.5 (Binary tar.gz) and uncompress it in
your home directory (or whatever location you prefer):

$ cd ~
$ tar zxvf apache-maven-3.0.5-bin.tar.gz

$ exportPATH=~/apache-maven-3.0.5/bin:$PATH

Maven also needs to know where Java is, and expects the JAVA_HOME
environment variable to be set:

$ exportJAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64

Verify that Maven is installed correctly:

$ mvn --version

You probably want to ensure that your environment variables will survive
a logout/reboot. Be sure to update ~/.bashrc with the PATH and
JAVA_HOME variables.

Building RPMs for CloudStack is fairly simple. Assuming you already have
the source downloaded and have uncompressed the tarball into a local
directory, you’re going to be able to generate packages in just a few
minutes.

Note

Packaging has Changed. If you’ve created packages for CloudStack
previously, you should be aware that the process has changed considerably
since the project has moved to using Apache Maven. Please be sure to follow
the steps in this section closely.

Now that your yum repository is populated with RPMs and metadata we need
to configure the machines that need to install CloudStack. Create a file
named /etc/yum.repos.d/cloudstack.repo with this information:

If you need support for the VMware, NetApp, F5, NetScaler, SRX, or any
other non-Open Source Software (nonoss) plugins, you’ll need to download
a few components on your own and follow a slightly different procedure
to build from source.

Warning

Some of the plugins supported by CloudStack cannot be distributed with
CloudStack for licensing reasons. In some cases, some of the required
libraries/JARs are under a proprietary license. In other cases, the
required libraries may be under a license that’s not compatible with
Apache’s licensing guidelines for third-party products.

To build the Non-OSS plugins, you’ll need to have the requisite JARs
installed under the deps directory.

Because these modules require dependencies that can’t be distributed
with CloudStack you’ll need to download them yourself. Links to the
most recent dependencies are listed on the *How to build CloudStack*
page on the wiki.

You may also need to download
vhd-util,
which was removed due to licensing issues. You’ll copy vhd-util to
the scripts/vm/hypervisor/xenserver/ directory.

Once you have all the dependencies copied over, you’ll be able to
build CloudStack with the noredist option: