Skip to content

Geraldlim91/onDemandNetworkEncryption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onDemandNetworkEncryption

  1. Writing OS img file on SD Card:

  1. Download the latest Raspbian image from http://www.raspberrypi.org/downloads

on Windows:

  1. Use win32diskimager to write image on to sd card.

on Linux/Mac OSX:

  1. use the following command:
dd if='full path of image location' of='full path of sd card location' bs=4M
  1. Required Installation:

Upon booting up Raspbian you will be brought to the a startup page, edit the setting if require, else move to finish.

After booting into Raspbian:

1) Do a sudo apt-get update 
2) Follow by a sudo apt-get upgrade
3) Reboot

Install the following packages after reboot:

1) sudo apt-get install glusterfs-server python-dev python-pip python-mpi4py
2) pip install Django=1.5.5
3) pip install -e git+https://github.com/scholrly/neo4django/#egg=neo4django
4) download the lastest PyCrypto package using 'wget http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz'
5) tar zxf 'extract location'/pycrypto-2.6.1.tar.gz
6)  cd 'pycrypto dir',  python setup.py install
7) Reboot
  1. Obtain project from Git repository and save it to the home dir '/home/pi'

  2. Cloning of sd card image:


on Windows:

  1. Use Win32DiskImager to create the img file for the sd card by using the "read function" and also not forgetting to input a file name, example: C:\Users\Jack\Desktop\onDemandEncrypt.img

on Linux/Mac OSX:

  1. using the dd if='sd card location' of=/home/pi/onDemandEncrypt.img bs=4M note: the sd card when mounted have 2 partition (example: sda, sda1), shown in /dev, select the whole sd card (sda)

After obtaining the image file, follow section 1 to write the image onto SD card.

  1. Configure the communication between pi:

rename the hostname for raspberry pi to prevent confusion between devices. 
sudo nano /etc/hostname
After changing the hostname, edit the hosts file to allow other device able to ping to this raspberry pi
sudo vi /etc/hosts and edit the line that include 127.0.1.1, change the default hostname to the new hostname you created.



  1. Configuring SSH authorize key:

 
1) Boot up the raspberry pi
2) ssh-keygen
note: just use the default and without passphase for the key
3) ssh-copy-id pi@hostname
note: hostname in term of other raspberry pi in the cluster.

Repet section 5 and 6 on all raspberry pi

  1. Configure GlusterFS server

*Configure only on 1 of the raspberry pi in the cluster.
1) sudo gluster peer probe 'hostname'
note: hostname in terms of other raspberry pi in the cluster, if there is more than 1 raspberry pi, use space(' ') as a delimiter
2) Create gluster volume (example there is 3 raspberry pi in the cluster)
sudo gluster volume create "volume name" transport tcp hostname1:/data hostname2:/data hostname3:/data
3) To check created volume use  gluster volume info
4) Start the volume using  sudo gluster volume start 'volume name'
  1. Installing web server:

*Configure only on 1 of the raspberry pi in the cluster.
1) sudo apt-get install nginx
2) sudo pip install uwsgi
3) Edit src/one_nginx.conf 
    3.1) Make sure the one.sock is in the correct directory
    3.2) Edit the server_name to the raspberry pi IP address
    3.3) Make sure the directory for the location /static and location of uwsgi_params is correct.
4) Create soft link. sudo ln -s /home/pi/onDemandNetwork/src/one_nginx.conf /etc/nginx/sites-enabled/one
5) Remove default nginx web page,  sudo rm /etc/nginx/sites-enabled/default 
  1. Edit uwsgi parameters

*Only on the pi that is configured as web server

1) Edit src/one_uwsgi.ini
    1.1) Make sure all the directory listed in this file is correct, the '%(homepath)' is similar to putting '/home/pi'
  1. Mounting GlusterFS volume:

1) sudo nano /etc/fstab and add in this line
    1.1) 'hostname:/'gluster volume name' /home/pi/onDemandNetwork/archive/encrypted glusterfs defaults,_netdev 0 0'
    note: hostname in terms of the raspberry pi hostname that is used to create the gluster volume.
  1. Installing Database

  1. Install Neo4J on another machine (on Desktop or Laptop as Raspberry pi does not have enough system resources to run the database.) note: Only install version < 1.9.6 as Neo4Django have not support version 2.0.0 onwards.

On Windows:

1) in the Neo4J directory edit conf/neo4j-server.properties
    1.1) Add in 'org.neo4j.server.webserver.address=0.0.0.0' 
2) Run the Neo4J program and start database

On Linux or Mac OSX:

1) Extract the database to the home directory.
2) in the Neo4J directory edit conf/neo4j-server.properties
    2.1) Add in 'org.neo4j.server.webserver.address=0.0.0.0' 
3) To start the database bin/neo4j start
  1. Edit settings.py:

NEO4J_DATABASES = {
    'default' : {
        'HOST':'192.168.1.1', #Edit the ip address to the desktop or laptop IP address that is installed with Neo4J
        'PORT':7474,  #Remain as default
        'ENDPOINT':'/db/data' #Remain as default
    }
}
  1. To run the project on the web:
1) sudo service nginx restart
2) cd into src directory, run this command: uwsgi --ini one_uwsgi.ini
3) On your desktop or laptop, go to http://webserverIP/main/login
note: desktop or laptop must belong to the same network as the raspberry pi cluster.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published