Skip to content

install_dependencies

euf edited this page Aug 3, 2016 · 2 revisions

Install Stucco Dependencies

This was tested On Centos 6.8, but Ubuntu 12.04/14.04 and similar distros/versions should also work with only minor changes (eg apt-get vs yum)

Install epel:

wget http://mirrors.nl.eu.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
rm epel-release-6-8.noarch.rpm

Install Common Dependencies:

sudo yum install man man-pages screen
sudo yum install git mercurial
sudo yum install curl wget rsync unzip
sudo yum install python-setuptools python-setuptools-devel

install supervisord

sudo easy_install pip
sudo easy_install supervisor

Create the log dir
sudo mkdir /var/log/supervisor

Create config dir and basic config file
sudo mkdir /etc/supervisor
sudo echo_supervisord_conf > /etc/supervisor/supervisord.conf

Modify the supervisord section of that config file to this:

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

Modify the include section of that config file to this:

[include]
files = /etc/supervisor/conf.d/*.conf

start supervisord
sudo /usr/bin/supervisord

Install rabbitMQ

sudo yum install golang

Currently, this will install erlang R14B04 erts-5.8.5
sudo yum install erlang socat

Currently, this will install rabbitmq-server 3.1.5 (This is significantly outdated, but should work fine)
sudo yum install rabbitmq-server

(Optional) Instead of the versions above, you can install a more current version. There are rpm/deb files available from https://www.rabbitmq.com but they will also require a more recent erlang version.

create the following /etc/rabbitmq/rabbitmq.config

[
  {rabbit, [
    {tcp_listeners, [{"0.0.0.0", 5672}]}  ]}
].

and set its owner/group:
sudo chown rabbitmq /etc/rabbitmq/rabbitmq.config
sudo chgrp rabbitmq /etc/rabbitmq/rabbitmq.config

Start the service
sudo service rabbitmq-server start

Create the stucco user and set permissions
sudo rabbitmqctl add_user stucco stucco
sudo rabbitmqctl set_permissions -p / stucco ".*" ".*" ".*"

Install Java and Maven

Install Maven (also installs open-jdk java 1.7 and 1.8)
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo
sudo cp apache-maven/epel-apache-maven.repo /etc/yum.repos.d/
sudo yum install apache-maven

(Optional) Install Oracle Java instead of (or in addition to) open-jdk

(Database Option 1) Install PostgreSQL (Recomended for stucco 1.1 and above)

To exclude the default postgres packages in yum, add this line:
exclude=postgresql*
to the appropriate config file for your distro, described here: https://wiki.postgresql.org/wiki/YUM_Installation#Configure_your_YUM_repository

Install the postgres package repo:
sudo yum localinstall http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-1.noarch.rpm
Or similar, as described in link above.

Install PostgreSQL with:
sudo yum install postgresql95-server
sudo yum install postgresql95-contrib

Change allowed login types, by editing the /var/lib/pgsql/9.5/data/pg_hba.conf file to match:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5  
# IPv6 local connections:
host    all             all             ::1/128                 md5  

(Note that if this file is not at this location, it can be found with the SHOW hba_file; query.)

To initialize postgres, run:
sudo service postgresql-9.5 initdb
(Note that this is only needed once.)

To start postgres service:
sudo service postgresql-9.5 start

(Database Option 2) Install OrientDB (Required for stucco 1.0)

Note: This must match the OrientDB client libraries version, which is required by the stucco "graph" and "rt" components. Currently 2.1.2

wget "http://www.orientechnologies.com/[email protected]&file=orientdb-community-2.1.2.tar.gz&os=linux" -O orientdb-community-2.1.2.tar.gz

tar -xvf orientdb-community-2.1.2.tar.gz

make orientdb user:
sudo useradd orientdb

set owner and move orientdb dir
sudo chown -R orientdb orientdb-community-2.1.2
sudo chgrp -R orientdb orientdb-community-2.1.2
sudo mv orientdb-community-2.1.2 /opt/orientdb-community-2.1.2

set up log dir:
sudo mkdir /var/log/orientdb
sudo chown orientdb /var/log/orientdb

Configure orientdb root user (if needed.)
Modify the users section of /opt/orientdb-community-2.1.2/config/orientdb-server-config.xml to match the following:

  <users>
    <user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/>
    <user resources="*" password="root" name="root"/>
  </users>

create init script: /etc/init.d/orientdb

#!/bin/sh
# OrientDB service script
#
# Copyright (c) Orient Technologies LTD (http://www.orientechnologies.com)

# You have to SET the OrientDB installation directory here
ORIENTDB_DIR="/opt/orientdb-community-2.1.2"
ORIENTDB_USER="orientdb"

usage() {
        echo "Usage: `basename $0`: <start|stop|status>"
        exit 1
}

start() {
        status
        if [ $PID -gt 0 ]
        then
                echo "OrientDB server daemon was already started. PID: $PID"
                return $PID
        fi
        echo "Starting OrientDB server daemon..."
        cd "$ORIENTDB_DIR/bin"
        su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>/var/log/orientdb/orientdb.log 2>/var/log/orientdb/orientdb.err &"
}

stop() {
        status
        if [ $PID -eq 0 ]
        then
                echo "OrientDB server daemon is already not running"
                return 0
        fi
        echo "Stopping OrientDB server daemon..."
        cd "$ORIENTDB_DIR/bin"
        su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>/var/log/orientdb/orientdb.log 2>>/var/log/orientdb/orientdb.err &"
}

status() {
        PID=`ps -ef | grep 'orientdb.www.path' | grep java | grep -v grep | awk '{print $2}'`
        if [ "x$PID" = "x" ]
        then
                PID=0
        fi

        # if PID is greater than 0 then OrientDB is running, else it is not
        return $PID
}

if [ "x$1" = "xstart" ]
then
        start
        exit 0
fi

if [ "x$1" = "xstop" ]
then
        stop
        exit 0
fi

if [ "x$1" = "xstatus" ]
then
        status
        if [ $PID -gt 0 ]
        then
                echo "OrientDB server daemon is running with PID: $PID"
        else
                echo "OrientDB server daemon is NOT running"
        fi
        exit $PID
fi

usage

set this as executable, and start service:
sudo chmod a+x /etc/init.d/orientdb
sudo service orientdb start

Install Nodejs

curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum install -y nodejs

Update iptables (if needed)

The default centos install will block incoming connections, such that the ui will not be reachable.

An example of removing this rule is below:

[euf@localhost ui]$ sudo iptables -L INPUT --line-numbers 
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
2    ACCEPT     icmp --  anywhere             anywhere            
3    ACCEPT     all  --  anywhere             anywhere            
4    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
5    REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 
[euf@localhost ui]$ sudo iptables -D INPUT 5
[euf@localhost ui]$ sudo iptables -L INPUT --line-numbers 
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
2    ACCEPT     icmp --  anywhere             anywhere            
3    ACCEPT     all  --  anywhere             anywhere            
4    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
[euf@localhost ui]$

You are now ready to proceed to installing stucco components