Skip to content

Install

Moe edited this page Jan 26, 2017 · 36 revisions

Find videos about Shinobi on YouTube : https://www.youtube.com/user/MrMoea92

Windows, Linux, Mac OS : Vagrant

This sets up an Ubuntu 16.04 Virtual Machine running on VirtualBox and uses Vagrant to setup and configure everything in one command.

  1. Open Terminal.

  2. Download the repo via GIT

git clone git@github.com:moeiscool/Shinobi.git -o origin
  1. Download and Install Vagrant https://www.vagrantup.com/downloads.html

  2. Go to the /Shinobi directory which you created in Step 2 Run vagrant up from the terminal or command line

Windows, Linux, Mac OS : Plain VirtualBox

VIDEO TUTORIAL : https://www.youtube.com/watch?v=kENOPPTA0Xg

  1. Once logged in

    cd shinobi
    
  2. Start server.

    pm2 start camera.js
    
  3. Open up http://localhost:8080 in your browser.

    • Note : if you are installed on a remote computer open up the IP in your web browser.
      • Username : ccio@m03.ca
      • Password : password
  • To get your IP you can run the following command.

    ifconfig
    

Mac OS : Native

  1. Open Terminal.

  2. Install the required system packages git nodejs npm mysql via brew. If you don't have brew, download it from here: http://brew.sh/ If you have these already on your system you can skip this step.

    brew install git nodejs npm mysql
    
  3. Install the ffmpeg package via brew.

    brew install ffmpeg
    
  4. Download the repo via GIT

    git clone git@github.com:moeiscool/Shinobi.git -o origin
    
  5. Import the sql/framework.sql SQL file, it will create a database called ccio

    cat sql/framework.sql | mysql -u root -p
    
  6. Import the sql/default_data.sql SQL file, it will create a default user and camera source

    cat sql/default_data.sql | mysql -u root -p ccio
    
  7. Run npm install from your Shinobi directory to install the required nodejs packages.

    npm install
    
  8. Copy conf.sample.json to conf.json in your Shinobi directory and enter your database connection details

    cp conf.sample.json conf.json
    
  9. Set your timezone in conf.json. This is important if your event times are not matching.

    "utcOffset":"-0800"
    
  10. Run npm start from your Shinobi directory to start the Shinobi App.

    npm start
    
  11. Open up http://localhost:8080 in your browser.

    • Note : if you are installed on a remote computer open up the IP in your web browser.
      • Username : ccio@m03.ca
      • Password : password

Ubuntu 16.04 : The Easier Way

VIDEO TUTORIAL : https://www.youtube.com/watch?v=CZSKV5gRd90

  1. Open Terminal.

  2. Download Shinobi with wget if you don't have git installed.

    • Do this only if you haven't already downloaded the files.
    wget https://github.com/moeiscool/Shinobi/tarball/master
    
  3. Untar the downloaded file. The extracted directory is the shinobi directory.

    tar -xzf master
    
  4. Rename the directory for easier access. The extracted folder name will be different. moeiscool-Shinobi-XXXXXXX is only an example.

    mv moeiscool-Shinobi-XXXXXXX shinobi
    
  5. Open Shinobi directory.

    cd shinobi
    
  6. Make INSTALL.sh an executable file.

    chmod +x INSTALL.sh
    
  7. Execute INSTALL.sh. Run :

  • This installs libav-tools, nodejs, npm, pm2, and mysql-server

    ./INSTALL.sh
    
  1. Packages will be installed. MySQL will ask to create a password on first installation.

  2. Then the installer will ask you for the credentials created. The default username is usually root.

  3. Copy conf.sample.json as another file named conf.json.

    cp conf.sample.json conf.json
    
  4. Set your timezone in conf.json. This is important if your event times are not matching.

    "utcOffset":"-0800"
    
  5. Edit conf.json to reflect your sql credentials. I don't reccommend using root.

    nano conf.json
    
  6. After installation is complete

    pm2 start camera.js
    
  7. Open up http://localhost:8080 in your browser.

    • Note : if you are installed on a remote computer open up the IP in your web browser.
      • Username : ccio@m03.ca
      • Password : password
  • To get your IP you can run the following command.

    ifconfig
    

Ubuntu 16.04 : The Harder Way

VIDEO TUTORIAL : https://www.youtube.com/watch?v=jfgUNfVEEEc

Dont have FFMPEG installed?

  1. Open Terminal.

  2. To install :

    apt-get install ffmpeg
    
    • If that doesn't work try :
    apt-get install libav-tools
    

Dont have Node.js installed?

  1. Open Terminal.

  2. Install Node.js and it's package manager

    • Note : #apt-get install node installs something else, not Node.js.
    apt-get install nodejs npm
    
  3. Create a symlink to use nodejs.

    • pm2 needs this. If you don't plan on using pm2, then ignore this step.
    ln -s /usr/bin/nodejs /usr/bin/node
    
  4. Not on Ubuntu? Other operating systems can be found here.

Dont have MySQL installed?

  1. Open Terminal. Run :

    apt-get install mysql-server
    
  2. Installation of MySQL prompt you to set a password for root user in MySQL on your first install.

Application Install

  1. Open Terminal.

  2. Download Shinobi with wget if you don't have git installed.

    • Do this only if you haven't already downloaded the files.
    wget https://github.com/moeiscool/Shinobi/tarball/master
    
  3. Untar the downloaded file. The extracted directory is the shinobi directory.

    tar -xzf master
    
  4. Rename the directory for easier access. The extracted folder name will be different. moeiscool-Shinobi-XXXXXXX is only an example.

    mv moeiscool-Shinobi-XXXXXXX shinobi
    
  5. Set permissions on the shinobi directory. Where camera.js is located.

    chmod -R 755 shinobi
    
  6. Open Shinobi directory.

    cd shinobi
    

Setup SQL

  1. Go to sql and install the SQL files in your database.

    cd sql
    
  2. Terminal SQL client can be accessed by running :

    • The password will have been set during the installation of MySQL.
    mysql -u root -p
    
  3. OPTIONAL : Create New SQL User with privileges. If you choose to use your own pre-defined credentials skip this step.

    source ./user.sql
    
    • or create your own
    CREATE USER 'majesticflame'@'127.0.0.1' IDENTIFIED BY '';
    GRANT ALL PRIVILEGES ON * . * TO 'majesticflame'@'127.0.0.1';
    FLUSH PRIVILEGES;
    
  4. while still in the SQL client. Install the Shinobi database. It will create a database called ccio.

    source ./framework.sql
    
  5. OPTIONAL : default_data.sql contains a demo user and a demo rtsp to mp4 monitor.

    source ./default_data.sql
    
  6. After importing the data. Exit the sql client.

    exit
    
  7. Go up one directory to enter the main directory. Where camera.js is located.

```
cd ..
```
  1. Copy conf.sample.json as another file named conf.json.

    cp conf.sample.json conf.json
    

14a. Edit conf.json to reflect your sql credentials. I don't reccommend using root.

```
nano conf.json
```

14b. Set your timezone in conf.json. This is important if your event times are not matching.

```
"utcOffset":"-0800"
```

Install Libraries

  1. Run npm install while in the main directory. This will install the libraries Shinobi needs.

    npm install
    

Launch Shinobi

  1. To start :

    node camera.js
    
    • If you did not make the symlink for nodejs then you must run nodejs camera.js instead.
  2. Open up http://localhost:8080 in your browser.

    • Note : if you are installed on a remote computer open up the IP in your web browser.
      • Username : ccio@m03.ca
      • Password : password
  • To get your IP you can run the following command.

    ifconfig
    

PM2 is needed to use UPDATE.sh and to Daeomonize the process

```
npm install pm2 -g
```
then to start : 
```
pm2 start camera.js
```
- run `pm2 logs` to see the console for any errors.
- `forever` is another program to daemonize, but i've had more success with `pm2`.

How to Update

These commands remove and recreate camera.js, web, and UPDATE.sh. If you have made any changes to the source code please back them up before running the update command.

By Terminal

navigate to your Shinobi directory, then run the following command. This command only works for those with builds from 8/Jan/2017 and after

chmod +x UPDATE.sh&&./UPDATE.sh

By API

updateKey can be set in conf.json. https://github.com/moeiscool/Shinobi/wiki/Configuration

http://xxx.xxx.xxx.xxx/[API KEY]/update/[UPDATE KEY]
Clone this wiki locally