How To Configure PredictionIO on CentOS/RHEL 6x
What is PredictionIO ?
-- PredictionIO is an open source Machine Learning Server. It empowers programmers and data engineers to build smart applications. With PredictionIO, you can add the following features to your apps instantly: predict user behaviors.
Step: 1. Set Host Name :
# hostname predictionio.domain.com
# vi /etc/sysconfig/network
HOSTNAME=predictionio.domain.com
-- Save & Quit (:wq)
Step: 2. Bind Host File :
# vi /etc/hosts
192.168.72.140 predictionio.domain.com predictionio
-- Save & Quit (:wq)
Step: 3. Stop Firewall & Disable Selinux :
# service iptables stop
# chkconfig iptables off
# vi /etc/sysconfig/selinux
SELINUX=disabled
-- Save & Quit (:wq)
Step: 4. Install NTP Server For Time Synchronization :
# yum -y install ntp ntpdate
# service ntpd restart
# chkconfig ntpd on
# ntpdate pool.ntp.org
Step: 5. Reboot the System :
# init 6
Step: 6. Download Oracle JAVA :
# cd /opt/
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.tar.gz"
# tar -zxvf jdk-8u5-linux-i586.tar.gz
Step: 7. Install JAVA using Alternatives :
# cd jdk1.8.0_05/
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_05/bin/java 2
# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /opt/jdk1.8.0/bin/java
+ 2 /opt/jdk1.7.0_55/bin/java
3 /opt/jdk1.8.0_05/bin/java
Enter to keep the current selection[+], or type selection number which you want to make default. : 3
Step: 8. Check Version of JAVA :
# java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode)
Note: If it shows error, Then install the following Package :
# yum -y install glibc.i686
Step: 9. Setup Environment Variables :
Setup JAVA_HOME Variable:
# export JAVA_HOME=/opt/jdk1.8.0_05
Setup JRE_HOME Variable:
# export JRE_HOME=/opt/jdk1.8.0_05/jre
Setup PATH Variable:
# export PATH=$PATH:/opt/jdk1.8.0_05/bin:/opt/jdk1.8.0_05/jre/bin
Step: 10. Change the Environment Variable :
# cd
# vi .bash_profile
-- Add the following lines :
PATH=$PATH:/opt/jdk1.8.0_05/bin:/opt/jdk1.8.0_05/jre/bin
export JAVA_HOME=/opt/jdk1.8.0_05
export JRE_HOME=/opt/jdk1.8.0_05/jre
-- Save & Quit (:wq)
Step: 11. Execute the Bash Profile :
# . .bash_profile
Step: 12. Download and prepare for the PredictionIO :
# yum -y install zip unzip
# cd /opt/
# wget http://download.prediction.io/PredictionIO-0.7.3.zip
# unzip PredictionIO-0.7.3.zip
Step: 13. Setting Up PredictionIO (Run the 3rd-party software setup script) :
# cd /opt/PredictionIO-0.7.3/bin
# sh setup-vendors.sh
Cannot find mongod from process list, search path, nor vendors area. Do you want to automatically install MongoDB 2.4.9? [y/n] y
Cannot find hadoop from search path nor vendors area. Do you want to automatically install Apache Hadoop 1.2.1? (Please make sure you can SSH to the localhost without a password.) [y/n] n
Step: 14. Make data & logs directory for PredictionIO :
# cd ..
# mkdir -p vendors/mongodb/data
# mkdir -p vendors/mongodb/logs
# vendors/mongodb-linux-x86_64-2.4.9/bin/mongod --config conf/mongodb/mongodb.conf >/dev/null 2>&1 &
Step: 15. Afterwards, Start all PredictionIO Services :
# cd /opt/PredictionIO-0.7.3/bin
# sh start-all.sh
Found MongoDB in vendors area. Do you want to start it? [y/n] y
Step: 16. Now Create a user For PredictionIO :
# cd /opt/PredictionIO-0.7.3/bin
# sh users
PredictionIO CLI User Management
1 - Add a new user
2 - Update email of an existing user
3 - Change password of an existing user
Please enter a choice (1-3): 1
Adding a new user
Email: kchatterjee@domain.com
Password: Passw0rd
Retype password: Passw0rd
First name: admin
Last name:
User added...
Step: 17. Now, you should be able to access PredictionIO :
http://192.168.72.140:9000
Step: 18. Install Apache Server :
# yum -y install httpd httpd-devel
Step: 19. Restart Apache Server :
# chkconfig httpd on
# service httpd restart
Step: 20. Make Reverse Proxy Setting for PredictionIO :
# vi /etc/httpd/conf.d/192.168.72.140.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin support@domain.com
ServerName 192.168.72.140
# ServerAlias
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php index.html
DocumentRoot /var/www/html
# Custom log file locations
LogLevel warn
ErrorLog /logs/192.168.72.140-error_log
SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
CustomLog /logs/192.168.72.140-access_log combined Env=!DontLog
</VirtualHost>
-- Save & Quit (:wq)
# vi /etc/httpd/conf.d/predictionio.domain.com.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin support@domain.com
ServerName www.predictionio.domain.com
ServerAlias predictionio.domain.com
ProxyRequests On
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://localhost:9000/
</VirtualHost>
-- Save & Quit (:wq)
# vi /etc/httpd/conf/httpd.conf
-- Find the Line & Uncomment :
NameVirtualHost *:80
-- Save & Quit (:wq)
# mkdir /logs
# service httpd restart
Step: 21. Now, Point your Web Browser :
http://predictionio.domain.com
User: admin
Pass: Passw0rd
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog