3. Installation
This document describes how to install and configure Apache Felix Karaf for both Unix and Windows' platforms.
Here you will find information about what are pre requisite software, where to download Karaf from and how to customize the installation to use custom ports other than the defaults.
This article contains the following sections:
Pre-Installation Requirements
Hardware:
- 7 MB of free disk space for the Apache Felix Karaf x.y binary distribution.
- 2 MB of free disk space for the Apache Felix Karaf x.y source or developer's distributions respectively around 7 MB for SVN checkout. The Maven build requires roughly 62 MB disk space and for the dependencies Maven downloads during building further 39 MB are required. As a lot of small files are produced, the exact space demands depend greatly on your cluster utilization ratio.
Operating Systems:
- Windows: Windows XP SP2, Windows 2000.
- Unix: Ubuntu Linux, Powerdog Linux, MacOS, AIX, HP-UX, Solaris, any Unix platform that supports Java.
Environment:
- Java Developer Kit (JDK) 1.5.x or greater (http://java.sun.com/).
- The JAVA_HOME environment variable must be set to the directory where the JDK is installed, e.g.,
c:\Program Files\jdk.1.5.0_06
. To accomplish that, press Windows key and Break key together, switch to "Advanced" tab and click on "Environment Variables". Here, check for the variable and, if necessary, add it. - Apache Maven 2.0.8 (http://maven.apache.org/download.html).
Installation Procedure for Windows
This section of the Getting Started guide explains how to install binary and source distributions of Karaf on a Windows system.
Handy Hint
In case you have to install Karaf into a very deep path or a path containing illegal characters for Java paths, e.g. !, % etc., you may add a bat file to start -> startup that executes
subst S: "C:\your very % problematic path!\KARAF"
so your Karaf root directory is S: — which works for sure and is short to type.
Windows Binary Installation
This procedure explains how to download and install the binary distribution on a Windows system.
- From a browser, navigate to http://servicemix.apache.org/kernel/download.html.
- Click the "Apache Felix Karaf x.y Release" link under the "Latest Releases" section. This brings up a new page.
- Under the "Download Here" section, select the desired distribution (you may have to scroll down to see the "Download Here" section).
For a binary distribution, the filename will be similar to:apache-felix-karaf-x.y.zip
. - Extract the files from the ZIP file into a directory of your choice. Please remember the restrictions concerning illegal characters in Java paths, e.g. !, % etc.
- Proceed to the #Starting Karaf section of this document.
- Following start-up, go to the #Testing the Installation section of this document.
- Optional: see 7.1. Enabling Colorized Console Output On Windows
Windows Source Installation
This procedure explains how to download and install the source distribution on a Windows system. NOTE: Karaf requires Java 5 is compile, build and run.
- From a browser, navigate to http://servicemix.apache.org/kernel/download.html
- Click the "ServiceMix Kernel x.y Release" link under the "Latest Releases" section. This brings up another page.
- Under the "Download Here" section, select the desired distribution (if necessary, scroll down to see the "Download Here" section).
For a source distribution, the filename will be similar to:apache-servicemix-kernel-x.y-src.zip
. - Extract Karaf from the ZIP file into a directory of your choice. Please remember the restrictions concerning illegal characters in Java paths, e.g. !, % etc.
- Build ServiceMix Kernel using Maven 2.0.8 or greater and Java 5.
The recommended method of building Karaf is the following:cd [servicemix_install_dir]\\src
where
[servicemix_install_dir]
is the directory in which Karaf was installed.Both steps take around 10 to 15 minutes.mvn
- Unzip the distribution using your favorite zip tool. The windows distribution is available at
[servicemix_install_dir]\assembly\target\apache-servicemix-kernel-x.y.zip
- Proceed to the #Starting Karaf section of this document.
- Following start-up, go to the #Testing the Installation section of this document.
- Optional: see 7.1. Enabling Colorized Console Output On Windows
Windows Developers Release
This procedure explains how to download and install the latest developers' snapshot. NOTE: ServiceMix Kernel requires Java 5 to compile, build and run ServiceMix.
- From a browser, navigate to http://servicemix.apache.org/kernel.
- Click the Download link in the navigation pane (the left pane).
- Click the "Current development SNAPSHOT release" link.
- Select the version of Karaf to download (if necessary, scroll down to see the Karaf snapshots).
- Extract the files from the ZIP file into a directory of your choice. Please remember the restrictions concerning illegal characters in Java paths, e.g. !, % etc.
- If a binary snapshot was downloaded proceed to the #Starting Karaf section of this document.
If a source snapshot was downloaded perform step 5 (building) and step 6 (unzipping) of the #Windows Source Installation procedure and proceed to the #Starting Karaf section of this document. - Following start-up, proceed to the #Testing the Installation section.
- Optional: see 7.1. Enabling Colorized Console Output On Windows
Installation Procedure For Unix
Unix Binary Installation
This procedure explains how to download and install the binary distribution on a Unix system.
- Download the Karaf gzip file to the Unix machine, either using a browser or using a tool, i.e., wget, scp, ftp, etc.
- If the Unix machine has a browser:
- Navigate to http://servicemix.apache.org/kernel.
- Click the "Download" link in the navigation pane (the left pane).
- Click the "Karaf x.y Release" link under the "Latest Releases" section. This brings up a new page.
- Under the "Download Here" section, select the desired distribution (if necessary, scroll down to see the "Download Here" section). For a binary Unix distribution, the filename will be similar to: apache-servicemix-kernel-x.y.tar.gz.
- OR, if the Unix machine does NOT have a browser, tools such as wget, scp, or ftp can be used to download the Karaf distribution. It is beyond the scope of this document to explain the use of those tools. For convenience an example is provided below using a Windows machine (that has a browser) and a Unix machine with "wget" installed on it. NOTE: There are several alternative ways to perform this type of installation.
- Obtain the link to the Karaf distribution file. On the Windows machine with a browser, navigate to servicemix.apache.org.
- Click the "Download" link in the left navigation pane.
- Click the "Karaf Kernel x.y Release" link under the "Latest Releases" section. This brings up a new page.
- Under the "Download Here" section, roll-over the desired distribution (if necessary, scroll down to see the "Download Here" section). For a binary Unix distribution the filename will be similar to: apache-servicemix-kernel-x.y.tar.gz.
- Right-click on the distribution name and "Copy Shortcut."
- On the Unix machine, change to the directory in which Karaf will be installed, e.g., /usr/local.
- Download the ServiceMix distribution to the Unix machine using the "wget" tool. For example, type "wget" followed by the saved shortcut:
wget http://www.apache.org/dist/servicemix/kernel/x.y/apache-servicemix-kernel-x.y.tar.gz
- If the Unix machine has a browser:
- Extract the files from the gzip file into a directory of your choice. For example:
Please remember the restrictions concerning illegal characters in Java paths, e.g. !, % etc.
gunzip apache-servicemix-kernel-x.y.tar.gz tar xvf apache-servicemix-kernel-x.y.tar
- Proceed to the #Starting Karaf section of this document.
- Following start-up, go to the #Testing the Installation section.
Unix Source Installation
This procedure explains how to download and install the source distribution on a Unix system. This procedure assumes the Unix machine has a browser. Please see the previous #Unix Binary Installation section for ideas on how to install Karaf without a browser. NOTE: Karaf requires Java 5 to compile, build and run.
- From a browser, navigate to http://servicemix.apache.org/kernel.
- Click the "Download" link in the navigation pane (the left pane).
- Click the "Karaf Kernel x.y Release" link under the "Latest Releases" section. This brings up a new page.
- Under the "Download Here" section, select the desired distribution (if necessary, scroll down to see the "Download Here" section).
For a source distribution, the filename will be similar to:apache-servicemix-kernel-x.y-src.tar.gz
. - Extract the files from the ZIP file into a directory of your choice. For example:
Please remember the restrictions concerning illegal characters in Java paths, e.g. !, % etc.
gunzip apache-servicemix-kernel-x.y-src.tar.gz tar xvf apache-servicemix-kernel-x.y-src.tar
- Build Karaf using Maven 2.0.8 or greater and Java 5:
The preferred method of building Karaf is the following: cd [servicemix_install_dir]/src where [servicemix_install_dir] is the directory in which Karaf was installed. mvn
- Uncompress the distribution that has just been created
cd [servicemix_install_dir]/assembly/target gunzip apache-servicemix-kernel-x.y.tar.gz tar xvf apache-servicemix-kernel-x.y.tar
- Proceed to the #Starting Karaf section of this document.
- Following start-up, go to the #Testing the Installation section.
Unix Developers Release
This procedure explains how to download and install the latest developers' snapshot. NOTE: Karaf requires Java 5 to compile, build and run.
- From a browser, navigate to http://servicemix.apache.org/kernel.
- Click the Download link in the navigation pane (the left pane).
- Click the "Current development SNAPSHOT release" link.
- Select the version of Karaf to download (you may have to scroll down to see the Karaf snapshots). The filename will be similar to:
apache-servicemix-kernel-x.y-tar.gz
orapache-servicemix-kernel-x.y-src.tar.gz
. - Extract the files from the gzip file into a directory of your choice. For example:
Please remember the restrictions concerning illegal characters in Java paths, e.g. !, % etc.
For a binary developer's snapshot: gunzip apache-servicemix-kernel-x.y.tar.gz tar xvf apache-servicemix-kernel-x.y.tar For a source developer's snapshot: gunzip apache-servicemix-kernel-x.y-src.tar.gz tar xvf apache-servicemix-kernel-x.y-src.tar
- For a binary snapshot, proceed to the #Starting Karaf section of this document.
If a source snapshot was downloaded perform steps 6 - 8 (building, uncompressing, starting) of the #Unix Source Installation procedure. - Proceed to the #Testing the Installation section.
Starting Karaf
On Windows
From a console window, change to the installation directory and run Karaf
. For the binary distribution, go to
cd [servicemix_install_dir]
and for the source distribution go to the target directory, for example:
cd [servicemix_install_dir]\src\assembly\target\apache-servicemix-kernel-x.y-SNAPSHOT
where servicemix_install_dir
is the directory in which Karaf was installed, e.g., c:\Program Files\apache-servicemix-kernel-x.y
.
Then type:
bin\karaf.bat
Note: Working directories get created relative to the current directory. For the working directories to be created in the proper place, Karaf must be launched from its home/installation directory.
On Unix
From a command shell, change to the installation directory and run Karaf
. For the binary distribution, go to
cd [servicemix_install_dir]
and for the source distribution go to the target directory, for example:
cd [servicemix_install_dir]/src/assembly/target/apache-servicemix-kernel-x.y
where servicemix_install_dir
is the directory in which Karaf was installed, e.g., /usr/local/apache-servicemix-kernel-x.y
.
Then type:
bin/karaf.sh
Warning
Do NOT close the console or shell in which Karaf was started, as that will terminate Karaf (unless Karaf was started with nohup).
Testing the Installation
If Karaf is up and running without problems, the Window's console window or the Unix command shell will display something similar to the following log line:
____ _ __ __ _ / ___| ___ _ ____ _(_) ___ ___| \/ (_)_ __ \___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ / ___) | __/ | \ V /| | (_| __/ | | | |> < |____/ \___|_| \_/ |_|\___\___|_| |_|_/_/\_\
ServiceMix Kernel (1.1.0) Type 'help' for more information. -------------------------------------------------------------------------------------------------------------------------------- smx@root:/>
Stopping Karaf
For both Windows and Unix installations, you can perform a clean shutdown of Karaf Kernel by using the following command:
osgi/shutdown
If Karaf was started in the background on Unix, the process can be killed, with the following:
ps -ef | grep karaf kill [PID] where [PID] is the process id of the Karaf process.