Debian Apache CloudStack Installation Guide

Reference: Apache CloudStack

Reference: CloudStack Installation Documentation

Reference: Building from Source

Pre Process

  1. Install Oracle Java
  2. Install Maven 3
  3. Install dependency packages
    sudo aptitude install python-software-properties ant debhelper tomcat6 libws-commons-util-java genisoimage python-mysqldb libcommons-codec-java libcommons-httpclient-java liblog4j1.2-java

Building package Process

  1. Download CloudStack source code
  2. Use maven to install
    tar xjvf apache-cloudstack-*-src.tar.bz2
    cd apache-cloudstack-*
    mvn -P deps
    $ echo $?
  3. Ignore the build dependency openjdk-7-jdk and maven3
    dpkg-buildpackage -uc -us -d
    ls -l ../*.deb
    -rw-r--r-- 1 jssu jssu  42034768 Aug 20 22:42 cloudstack-agent_4.4.0-snapshot_all.deb
    -rw-r--r-- 1 jssu jssu  70056634 Aug 20 22:43 cloudstack-awsapi_4.4.0-snapshot_all.deb
    -rw-r--r-- 1 jssu jssu     63364 Aug 20 22:43 cloudstack-cli_4.4.0-snapshot_all.deb
    -rw-r--r-- 1 jssu jssu  45023502 Aug 20 22:41 cloudstack-common_4.4.0-snapshot_all.deb
    -rw-r--r-- 1 jssu jssu     63332 Aug 20 22:43 cloudstack-docs_4.4.0-snapshot_all.deb
    -rw-r--r-- 1 jssu jssu 162754846 Aug 20 22:42 cloudstack-management_4.4.0-snapshot_all.deb
    -rw-r--r-- 1 jssu jssu  40713684 Aug 20 22:42 cloudstack-usage_4.4.0-snapshot_all.deb
    cd ..

Installation Process

  1. Insalll dependency packages and cloudstack
    sudo aptitude install openjdk-7-jre libcommons-daemon-java libvirt0 libvirt-bin ebtables vlan jsvc ipset python-libvirt libmysql-java python-paramiko augeas-tools
    sudo dpkg -i *.deb
    Preparing to unpack cloudstack-agent_4.4.0-snapshot_all.deb ...
    Unpacking cloudstack-agent (4.4.0-snapshot) over (4.4.0-snapshot) ...
    Setting up cloudstack-agent (4.4.0-snapshot) ...
    Upgrade succeed
    /var/lib/dpkg/info/cloudstack-agent.postinst: line 44: /etc/init.d/libvirt-bin: No such file or directory
    dpkg: error processing package cloudstack-agent (--install):
     subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
  2. Modify /var/lib/dpkg/info/cloudstack-agent.postinst. Change /etc/init.d/libvirt-bin to /etc/init.d/libvirtd and then fix the installation
    sudo apt-get -f install
    Setting up cloudstack-agent (4.4.0-snapshot) ...
    Upgrade succeed
    [ ok ] Restarting libvirt management daemon: /usr/sbin/libvirtd. 

Management Server Installation

  1. Install NTP.
    sudo aptitude install openntpd
  2. Install the Management Server on the First Host
    sudo dpkg -i cloudstack-management_*-snapshot_all.deb 

Install the database server

  1. Install MySQL from the package repository of your distribution:
    sudo aptitude install mysql-server
  2. Create a file /etc/mysql/conf.d/cloudstack.cnf.
    sudo nano /etc/mysql/conf.d/cloudstack.cnf
    binlog-format = 'ROW'
  3. Start or restart MySQL to put the new configuration into effect.
    sudo service mysql restart
  4. Set up the database. The following command creates the “cloud” user on the database.
    cloudstack-setup-databases cloud:${dbpassword}@${ip address mysql server} \
    --deploy-as=root:${password} \
    -e ${encryption_type} \
    -m ${management_server_key} \
    -k ${database_key} \
    -i ${management_server_ip}
    Mysql user name:cloud                                                           [ OK ]
    Mysql user password:******                                                      [ OK ]
    Mysql server ip:                                                       [ OK ]
    Mysql server port:3306                                                          [ OK ]
    Mysql root user name:root                                                       [ OK ]
    Mysql root user password:******                                                 [ OK ]
    Checking Cloud database files ...                                               [ OK ]
    Checking local machine hostname ...                                             [ OK ]
    Checking SELinux setup ...                                                      [ OK ]
    Detected local IP address as, will use as cluster management server node IP[ OK ]
    Preparing /etc/cloudstack/management/                              [ OK ]
    Applying /usr/share/cloudstack-management/setup/create-database.sql             [ OK ]
    Applying /usr/share/cloudstack-management/setup/create-schema.sql               [ OK ]
    Applying /usr/share/cloudstack-management/setup/create-database-premium.sql     [ OK ]
    Applying /usr/share/cloudstack-management/setup/create-schema-premium.sql       [ OK ]
    Applying /usr/share/cloudstack-management/setup/server-setup.sql                [ OK ]
    Applying /usr/share/cloudstack-management/setup/templates.sql                   [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_db.sql                  [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_schema.sql              [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_multipart.sql           [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_index.sql               [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_multipart_alter.sql     [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_bucketpolicy.sql        [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_policy_alter.sql        [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_offering.sql            [ OK ]
    Applying /usr/share/cloudstack-bridge/setup/cloudbridge_offering_alter.sql      [ OK ]
    Processing encryption ...                                                       [ OK ]
    Finalizing setup ...                                                            [ OK ]
    CloudStack has successfully initialized database, you can check your database configuration in /etc/cloudstack/management/
  5. If you are running the KVM hypervisor on the same machine with the Management Server, edit /etc/sudoers and add the following line:
    Defaults:cloud !requiretty
  6. Now that the database is set up, you can finish configuring the OS for the Management Server. This command will set up iptables, sudoers, and start the Management Server.
    sudo cloudstack-setup-management
    Starting to configure CloudStack Management Server:
    Configure sudoers ...         [OK]
    Configure Firewall ...        [OK]
    Configure CloudStack Management Server ...[OK]
    CloudStack Management Server setup is Done!

Using the Management Server as the NFS Server

  • sudo aptitude install nfs-kernel-server
  • On the Management Server host, create two directories that you will use for primary and secondary storage. For example:
    sudo mkdir -p /export/primary
    sudo mkdir -p /export/secondary
  • To configure the new directories as NFS exports, edit /etc/exports.
    sudo nano /etc/exports
    	/export  *(rw,async,no_root_squash,no_subtree_check)
  • Export the /export directory.
    sudo exportfs -a
  • Edit the /etc/sysconfig/nfs file.

    Configuring your CloudStack Installation