Product SiteDocumentation Site

3.6. Building RPMs

As mentioned previously in Section 3.3, “Prerequisites for building Apache CloudStack”, you'll 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.
# yum groupinstall "Development Tools"
# yum install java-1.6.0-openjdk-devel.x86_64 ant ant-jdepend genisoimage mysql mysql-server ws-common-utils MySQL-python tomcat6
Next, you'll need to install build-time dependencies for CloudStack with Maven. We're using Maven 3, so you'll want to grab a Maven 3 tarball and uncompress it in your home directory (or whatever location you prefer):
$ tar zxvf apache-maven-3.0.4-bin.tar.gz
$ export PATH=/usr/local/apache-maven-3.0.4//bin:$PATH
Maven also needs to know where Java is, and expects the JAVA_HOME environment variable to be set:
$ export JAVA_HOME=/usr/lib/jvm/jre-1.6.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.
Now it's time to grab the dependencies to build CloudStack:
$ mvn -P deps
Now that we have resolved the dependencies we can move on to building CloudStack and packaging them into RPMs by issuing the following command.
$ ./waf rpm
Once this completes, you should find assembled RPMs in artifacts/rpmbuild/RPMS/x86_64

3.6.1. Creating a yum repo

While RPMs is an ideal packaging format - it's most easily consumed from yum repositories over a network. We'll move into the directory with the newly created RPMs by issuing the following command:
$ cd artifacts/rpmbuild/RPMS/x86_64
Next we'll issue a command to create the repository metadata by issuing the following command:
$ createrepo ./
The files and directories within our current working directory can now be uploaded to a web server and serve as a yum repository

3.6.2. Configuring your systems to use your new yum repository

Now that your yum repository is populated with RPMs and metadata we need to configure our machines that need to install CloudStack. We will create a file at /etc/yum.repos.d/cloudstack.repo with the following content:
[apache-cloudstack]
name=Apache CloudStack
baseurl=http://webserver.tld/path/to/repo
enabled=1
gpgcheck=0
Completing this step will allow you to easily install CloudStack on a number of machines across the network.