blob: adc52a52603d6f14535ef0393382712f6a62ae40 [file] [log] [blame]
---
title: Installing Apache PredictionIO® from Source Code
---
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
INFO: Assuming you are following the directory structure in the following,
replace `/home/abc` with your own home directory wherever you see it.
## Downloading Binary Distribution
You can use pre-built binary distribution for Apache PredictionIO® if you are
building against
* Scala 2.11.8
* Spark 2.1.1
* Hadoop 2.7.3
* Elasticsearch 5.6.9
Download and extract binary release.
```
$ curl -L https://dist.apache.org/repos/dist/release/predictionio/<%= data.versions.pio %>/apache-predictionio-<%= data.versions.pio %>-bin.tar.gz > PredictionIO-<%= data.versions.pio %>.tar.gz
$ tar zxvf PredictionIO-<%= data.versions.pio %>.tar.gz
```
Proceed to [Installing Dependencies](#installing-dependencies).
## Downloading Source Code
Download Apache PredictionIO <%= data.versions.pio %> from an
Apache [mirror](https://www.apache.org/dyn/closer.cgi/predictionio/<%=
data.versions.pio %>/apache-predictionio-<%= data.versions.pio %>.tar.gz).
Verify this release using [signatures and checksums]
(https://www.apache.org/dist/predictionio/<%= data.versions.pio %>/)
and [project release KEYS](https://www.apache.org/dist/predictionio/KEYS).
```
$ gpg --import KEYS
$ gpg --verify apache-predictionio-<%= data.versions.pio %>.tar.gz.asc apache-predictionio-<%= data.versions.pio %>.tar.gz
```
You should see something like this.
```
gpg: Signature made Tue Sep 26 22:55:22 2017 PDT
gpg: using RSA key 7E2363D84719A8F4
gpg: Good signature from "Chan Lee <chanlee@apache.org>" [ultimate]
```
## Building
Run the following at the directory where you downloaded the source code to build
Apache PredictionIO®. By default, the build will be against
* Scala 2.11.8
* Spark 2.1.1
* Hadoop 2.7.3
* Elasticsearch 5.6.9
```
$ tar zxvf apache-predictionio-<%= data.versions.pio %>.tar.gz
$ cd apache-predictionio-<%= data.versions.pio %>
$ ./make-distribution.sh
```
You should see something like the following when it finishes building
successfully.
```
...
PredictionIO-<%= data.versions.pio %>/sbt/sbt
PredictionIO-<%= data.versions.pio %>/conf/
PredictionIO-<%= data.versions.pio %>/conf/pio-env.sh
PredictionIO binary distribution created at PredictionIO-<%= data.versions.pio %>.tar.gz
```
Extract the binary distribution you have just built.
```
$ tar zxvf PredictionIO-<%= data.versions.pio %>.tar.gz
```
### Building against Different Versions of Dependencies
Starting from version 0.11.0, PredictionIO can be built against different
versions of dependencies. As of writing, one could build PredictionIO against
these different dependencies:
* Scala 2.10.x, 2.11.x
* Spark 1.6.x, 2.0.x, 2.1.x
* Hadoop 2.4.x to 2.7.x
* Elasticsearch 1.7.x, 5.x
As an example, if you want to build PredictionIO to support Scala 2.11.8,
Spark 2.1.0, and Elasticsearch 5.3.0, you can do
```
$ ./make-distribution.sh -Dscala.version=2.11.8 -Dspark.version=2.1.0 -Delasticsearch.version=5.3.0
```
## Installing Dependencies
Let us install dependencies inside a subdirectory of the Apache PredictionIO
installation. By following this convention, you can use
Apache PredictionIO's default configuration as is.
```
$ mkdir PredictionIO-<%= data.versions.pio %>/vendors
```
### Spark Setup
<%= partial 'shared/install/spark' %>
### Storage Setup
#### <a name="pgsql"></a>PostgreSQL Setup
WARNING: You may skip this section if you are not using PostgreSQL.
<%=partial 'shared/install/postgres' %>
#### HBase and Elasticsearch Setup
##### Elasticsearch Setup
WARNING: You may skip this section if you are not using Elasticsearch.
<%= partial 'shared/install/elasticsearch' %>
##### <a name="hbase"></a>HBase Setup
WARNING: You may skip this section if you are not using HBase.
<%= partial 'shared/install/hbase' %>
In addition, you must set your environment variable `JAVA_HOME`. For example, in
`/home/abc/.bashrc` add the following line:
```
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
```
<%= partial 'shared/install/dependent_services' %>
Now you have installed everything you need!
<%= partial 'shared/install/proceed_template' %>