You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 26 Next »


CheatSheet for setting up CloudStack Dev environment on Windows

Step 1) Install Cygwin.

Cygwin will give you a unix like bash shell for your windows.

To install Cygwin, you download and run the setup.

  • Cygwin and many utilities do not like spaces in the path.  When asked for the path to install to, use a path such as 'c:\bin\cygwin' or 'c:\cygwin'.
  • The install option will download, cache, and install the packages that you have selected.
  • The selection of default packages to install is inadequate, because development and common editors are not included.
    • Under 'Devel', select git for 'Install'. Or set the whole 'Develop' category to install. This takes more time, but it is simpler.\
    • Under 'Editors', select vim or emacs depending on which you expect to be available from the Cygwin command line.
    • Under 'Utils', select genisoimage and mkisofs
    • Under 'Net', select ca-certificates
  • Unfortunately, the download can be slow depending on the mirror you select (~30 min or more).
    • Set unnecessary package categories to 'Uninstall', e.g. KDE and Games.\
  • After completing the install, you can run it again.  In that case, it will use the packages you last selected as the defaults.

NB: When you open a Cygwin shell, the Windows environment variables, including PATH, are imported into the shell environment. When we install the following items, we will update the Windows environment variables.

Step 2) Install the JDK.

You can download the latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html.

  • Pick the self-installing executable corresponding to your O/S type (32 or 64bits)
  • When asked about the install path, use something that doesn't have space in it.  e.g. c:\bin\Java
  • Note where you're installing it. Set the Windows System variable JAVA_HOME to this path.
    • I removed the user 'JAVA_HOME' variable to prevent the System variable from being overridden.

Step 3) Install the latest Eclipse

Eclipse is available from http://www.eclipse.org/downloads/

  • Eclipse does not have an O/S-specific installer. Thus, the .zip you download does not include an .MSI file
  • At the time of writing the latest version was Eclipse Juno (4.2)
  • Place the unzipped download in the folder you want to run Eclipse from.

Step 3a) Add Plugins to Eclipse

CloudStack includes portions of Python code, which is best edited with the PyDev Eclipse plug-in

OPTIONAL:   Install Python 2.7

When Eclipse is launched from the Windows shell, its PyDev plugin will not have access to the Cygwin installation of Python.  If you want to give PyDev access to Python, install it.

OPTIONAL:  Install PyDev using Eclipse

PyDev enhances the Eclipse environment Python specific features.

  • Open Eclipse, if it is not already open.
  • Navigate to tool bar menu Help --> Installing New Software...
  • Using the Add... button, add the site http://pydev.org/updates to the Work with dropdown list
    • 'PyDev' should appear in the window below, select and proceed through the Wizard.
    • Keep an eye on the install, you may be prompted to confirm that you trust the PyDev plug-in

The M2E plug-in allows Eclipse to import CloudStack's pom.xml Thus, pom.xml files become a substitute for the .project files that Eclipse normally uses.

Install M2E using Eclipse

  • Open Eclipse, if it is not already open.
  • Navigate to tool bar menu Help --> Installing New Software...
  • Select -All Available Sites- from the dropdown list.
    • Wait for 'Pending...' to disappear from the box with the Name and Version colums
  • Filter the results with the text 'm2e'

Add M2Eclipse

OPTIONAL: Install EGit to provide integration to git from Eclipse

  • Click on About
  • Click on Eclipse Market Place
  • Click on Popular tab
  • Find EGit - Git Team Provider

Step 4) OPTIONAL:  Install Apache Tomcat 6.0.33

For development purposes, you do not need Apache Tomcat.  There are Maven scripts available to launch the management server in Jetty, which provides Tomcat functionality.

Apache Tomcat is the open source web server and servlet container that hosts CloudStack's management server.

  • The web server portion is pure Java. In contrast, Apache web server is written in C
  • The servlet container conforms Java Servlet and the JavaServer Pages (JSP) specifications.

You can download Tomcat from http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.33/bin/apache-tomcat-6.0.33.exe

  • Unlike Eclipse, the downloaded Tomcat is a self-installing executable.
    • Leave the port at 8080 and the username/password empty
    • Your JRE may be auto detected. If not, it will probably be a JDK or JRE under C:\Program Files\Java\
  • Do not use default install folder. Folders under c:\Program Files are subject to special access control that creates problems later.
    • Use C:\cstoosls\Tomcat6.0 instead

To inform the Cygwin environment of where Tomcat is, update your Windows environment variables.

  • Define CATALINA_HOME as a Windows System environment variable, and give it the value of the install folder for Tomcat. E.g. C:\cstoosls\Tomcat6.0
    • Unlike JAVA, which an environment variable named after the product to locate its install directory (JAVA_HOME), Tomcat uses an environment variable named after the servlet container component (CATALINA_HOME)
  • Add '%CATALINA_HOME%\bin' to the Windows System environment variable PATH

NB: Test your environment variables by opening a Cygwin shell and typing 'which Tomcat6'. This should return the path to the Tomcat executable.

Step 5) Install MySQL for windows.

Download the self-installing exe from http://dev.mysql.com/downloads/mysql/5.0.html#downloads

  • The most recent 5.1.x is recommended; however, developers are also using 5.5
  • Check the box that asks whether you want to include mysql bin directory in the PATH. The option is a checkbox towards the end of the config wizard.
  • Also download the MySQL Workbench UI to give yourself an UI to the MySQL database.

Step 5a) Install Python bindings for MySQL for windows.

Download the self-installing exe for Python 2.7 from http://dev.mysql.com/downloads/connector/python/

Step 6) DEPRECATED:  Install Apache Ant

A manual installation of Ant is only required for building CloudStack 4.0.

Ant is available from http://ant.apache.org/bindownload.cgi

  • Ant does not have an O/S-specific installer. Thus, the .zip you download does not include an .MSI file
  • Place the unzipped download in the folder you want to run Ant from.

To inform the Cygwin environment of where Ant is, update your Windows environment variables.

  • Define ANT_HOME as a Windows System environment variable, and give it the value of the install folder for Tomcat. E.g. C:\Program Files\Apache Software Foundation\apache-ant-1.8.4
  • Add '%ANT_HOME%\bin' to the Windows System environment variable PATH

NB: Test your environment variables by opening a Cygwin shell and typing 'which ant'. This should return the path to the ant executable.

Step 7) Install Apache Maven 3.0

Maven is available from http://maven.apache.org/download.html

  • Version 3.x is preferred required for CloudStack
  • Maven does not have an O/S-specific installer. Thus, the .zip you download does not include an .MSI file
  • Place the unzipped download in the folder you want to run Maven from.
  • Choose folder such that there are no spaces in the path!  E.g. C:\bin\maven

To inform the Cygwin environment of where Maven is, update your Windows environment variables.

  • Define MAVEN_HOME M2_HOME as a Windows System environment variable e.g. C:\cstools\maven
  • Add '%M2_HOME%\bin' to the Windows System environment variable PATH

NB: Test your environment variables by opening a Cygwin shell and typing 'which mvn'. This should return the path to the maven executable.

Step 8) Download cloudstack-oss source

From a Cygwin window:

Step 9) Install "mkisofs"

Cygwin's mkisofs is a soft link. These do not work with the build.

Instead, downloan the .exe from http://svnpenn.blogspot.com/2011/06/mkisofs-for-windows_24.html

  • Place in /bin

NB: Test your environment variables by opening a Cygwin shell and typing 'which mkisofs'. This should return the path to the mkisofs executable.

Step 10) Tell CloudStack the password for mysql

Password is assigned to DBROOTPW= in the build/replace.properties file.

E.g.
{{$ cat build/override/replace.properties
DBUSER=cloud
DBPW=cloud
DBROOTPW=
MSLOG=vmops.log
APISERVERLOG=api.log
DBHOST=localhost
AGENTLOGDIR=logs
AGENTLOG=logs/agent.log
MSMNTDIR=/mnt
COMPONENTS-SPEC=components-premium.xml}}

Step 11) Build

To clean out existing artifacts, go to the cloudstack source folder and run:

mvn clean

To compile Apache CloudStack, go to the cloudstack source folder and run:

mvn install

To deploy the database:

mvn -P developer -pl developer -Ddeploydb

To run in a local Jetty server:

mvn -pl :cloud-client-ui jetty:run

Open the mgmt server console using http://localhost:8080 and configure it as required.

Step 12) OPTIONAL: Start working with DevCloud

DevCloud provides a self-contained CloudStack development environment, which runs in a VirtualBox VM. For details, refer to Setup CloudStack development environment in 8 steps

Troubleshooting

1) Problem: Server will not start and throw3s following exception

WARN utils.script.Script (main-) Exception: /usr/local/bin/bash
> > -c echo
> ~scvmm
> > java.io.IOException: Cannot run program "/usr/local/bin/bash":
> CreateProcess error=2, The system cannot find the file specified
> > at java.lang.ProcessBuilder.start(Unknown Source)
> > at com.cloud.utils.script.Script.execute(Script.java:184)
> >
> > ....
> > ....
> > ERROR cloud.servlet.CloudStartupServlet (main(smile) Exception starting
> management server
> > com.cloud.utils.exception.CloudRuntimeException: Cannot get home
> directory for account: scvmm

Workaround: The problem is that the windows environment just don't go through key generation and cloudstack works fine. The work aroiund is to set developer=true in the configuration table, by running the following SQL statement in MySQL
Update configuration set value='false' where key='developer';

This changes the developer mode to false which combined with a non 'cloud' username will skip the key generation.

Caveat: KVM stops working after this workaround. Any help from community on fixing KVM support as well is needed.

  • No labels