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.
...
- 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'.
- Please use following mirror for proper download and install
- http://mirrors.kernel.org
- http://cygwin.mirrors.hoobly.com
- 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 'Libs', select libsasl2
- Under 'Net', select ca-certificates and openssh
- Select Python for 'Install'
- Under 'Utils', select genisoimage and mkisofs
- 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.
- Once installed, do the following. This will make sure the maven build can access the two utilities
- Open a CommandPrompt with admin privileges.
- cd to the directory where you installed cygwin, i.e. c:\cygwin\bin
- mklink mkisofs.exe genisoimage.exe
- mklink python.exe python2.7.exe
- Run Cygwin
- Add the following to your /etc/fstab: "none /cyg cygdrive binary,noacl,posix=0,user 0 0". This line does two things. Instead of /cygdrive/c to change to a different drive, you type /cyg/c which is much shorter. It also removes the posix acl semantics which causes problems with the build because the build tries to manipulate file permissions and causes big problems with the Windows file system.
- After completing the install, you can run cygwin setup again to update the packages. In that case, it will use the packages you last selected as the defaults.
...
- 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\jdk1.7.0_25
- 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 Python 2.7 for Windows
This step can be skipped if you made a symlink to python2.7.exe in the Cygwin installation.
CloudStack includes portions of Python code. I know you just installed the Cygwin Python but some parts of the maven build process also require a "native" python installation as it won't be able to access the Cygwin installation.
- Download from http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi and install
- Also download and install the setuptools from http://pypi.python.org/pypi/setuptools
- Add the path (typically C:\Python27) to the Windows System environment variable PATH
Step 4) 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.
- Modify the following things in eclipse.ini. The file can be found in the directory you installed eclipse to.
- Change launcher.XXMaxpermSize to 1024m
- Add or change to -Xms1024m
- Add or change to -Xmx2048m
Step 4a) Add Plugins to Eclipse
OPTIONAL: CloudStack includes portions of Python code, which is best edited with the PyDev Eclipse plug-in
-
- 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.
...
- Add %JAVA_HOME%\bin to the PATH system variable
Administrator@cc-svr10 ~
Verify the above by opening a cygwin terminal and using which to discover the location of java and javac. E.g.
Code Block |
---|
$ which java
/cyg/c/bin/Java/jdk1.7.0_25/bin/java
Administrator@cc-svr10 ~
$ which javac
/cyg/c/bin/Java/jdk1.7.0_25/bin/javac
|
Step 3) Install Python 2.7 for Windows
This step can be skipped if you made a symlink to python2.7.exe in the Cygwin installation.
CloudStack includes portions of Python code. I know you just installed the Cygwin Python but some parts of the maven build process also require a "native" python installation as it won't be able to access the Cygwin installation.
- Download from http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi and install
- Also download and install the setuptools from http://pypi.python.org/pypi/setuptools
- Add the path (typically C:\Python27) to the Windows System environment variable PATH
Step 4) 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.
- Modify the following things in eclipse.ini. The file can be found in the directory you installed eclipse to.
- Change launcher.XXMaxpermSize to 1024m
- Add or change to -Xms1024m
- Add or change to -Xmx2048m
Step 4a) Add Plugins to Eclipse
OPTIONAL: CloudStack includes portions of Python code, which is best edited with the PyDev Eclipse plug-in
-
- 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 columns
- 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 5) 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 6) 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 6a) Install Python connector for MySQL for Windows.
Download the self-installing exe for Python 2.7 from http://dev.mysql.com/downloads/connector/python/
...
- 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 columns
- 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 5) 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 6) 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
- Add the mysql bin directory in the PATH. This will provide access to the mysql executable when you are in Cygwin.
- Also download the MySQL Workbench UI to give yourself an UI to the MySQL database.
Step 6a) Install Python connector for MySQL for Windows.
Install varies depending on whether you are using Python2.7 distributed with Cygwin or Python2.7 installed via an MSI.
In both cases, go to the downloads page: http://dev.mysql.com/downloads/connector/python/#downloads
For .MSI, select Platform to be "Microsoft Windows", and use the ver. 2.7 MSI.
For Cygwin, it is easiest to use easy_install or pip (Source) E.g. .
Code Block |
---|
Administrator@cc-svr10 ~
$ easy_install mysql-connector-python
Searching for mysql-connector-python
Reading http://pypi.python.org/simple/mysql-connector-python/
Best match: mysql-connector-python 1.0.10
Downloading http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.10.zip
Processing mysql-connector-python-1.0.10.zip
Writing /tmp/easy_install-ZFHHNn/mysql-connector-python-1.0.10/setup.cfg
Running mysql-connector-python-1.0.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZFHHNn/mysql-connector-python-1.0.10/egg-dist-tmp-wICK6D
zip_safe flag not set; analyzing archive contents...
Adding mysql-connector-python 1.0.10 to easy-install.pth file
Installed /usr/lib/python2.7/site-packages/mysql_connector_python-1.0.10-py2.7.egg
Processing dependencies for mysql-connector-python
Finished processing dependencies for mysql-connector-python
|
tep 7) DEPRECATED: Install Apache Ant
A manual installation of Ant is only required for building CloudStack 4.0.
...
Generate ssh key in your $HOME directory (the CloudStack Management server will be looking for this at run time)
ssh-keygen -t rsa -q
...
server will be looking for this at run time)
ssh-keygen -t rsa -q
Step 11) DEPRECATED Install "mkisofs"
Ignore this step if you've already created a symlink under step #1. To check use 'which' to see if mkisofs is already available. E.g.
Code Block |
---|
Administrator@cc-svr10 ~
$ which mkisofs
/usr/bin/mkisofs
|
Cygwin's mkisofs is a soft link. These do not work with the build.
...
Password is assigned to DBROOTPW= in the build/replace.properties file.
E.g.
Code Block |
---|
$ 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
|
...
To compile Apache CloudStack, go to the cloudstack source folder and run:
mvn install -P developer,systemvm
To deploy the database:
mvn -P developer -pl developer -Ddeploydb
...
1) Problem: Log4j not properly configured
E.g.
Code Block |
---|
log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.params.DefaultHttpParams).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
|
Workaround 1
Change name of config file. e.g.
Code Block |
---|
cp client/target/cloud-client-ui-4.2.0-SNAPSHOT/WEB-INF/classes/log4j{-cloud,}.xml
,-cloud}.xml
|
Workaround 2
Set CATALINA_BASE e.g.
Code Block |
---|
|
export CATALINA_BASE=X:/path/to/dir/contains/conf/log4j-cloud.xml |
X: is the windows disk label , PropertiesUtil will find : CATALINA_HOME or CATALINA_BASE .
2) Problem: Server will not start and throws following exception
...
Workaround:
This problem can arise when launching the server with too small of a heap. If you are launching using Maven, use MAVEN_OPTS to increase the stack size.
E.g.
Code Block |
---|
export MAVEN_OPTS="-XX:MaxPermSize=256m -Xmx1g"
mvn -pl :cloud-client-ui jetty:run
|
...
Workaround:
Skip key generation and cloudstack works fine.
This is done by setting developer property in the configuration table as follows, by running the following SQL statement in MySQL
Code Block |
---|
use cloud;
update configuration set value='false' where name='developer';
|
...
By default system.vm.use.local.storage is set to false. If you want to use local storage, set it to true using the GUI. Alternatively, if the management server has started, you can update the database with the command below:
Code Block |
---|
use cloud;
update configuration set value='true' where name='system.vm.use.local.storage';
|
...
Go to Eclipse folder and Change following (towards the end) in .ini configuration file..ini configuration file.
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms384m
-Xmx2048m
7) Problem : can not find sudo command
Workaround , create a bash file named as /bin/sudo with script content :
Code Block |
---|
|
#!/usr/bin/bash
cygstart --action=runas "$@" |
then chmod +x /bin/sudo
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms384m
-Xmx2048m