Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Steps in Installation #2

Open
tlkh opened this issue Mar 24, 2018 · 1 comment
Open

Missing Steps in Installation #2

tlkh opened this issue Mar 24, 2018 · 1 comment

Comments

@tlkh
Copy link
Owner

tlkh commented Mar 24, 2018

Hi, if anyone faces any problems or discover any missing steps in installation procedure, please report them here. Thank you!

@sealmindset
Copy link

I posted this on my blog site:

Prerequisites
Working understanding of networking - cables, switches, Internet, etc.
5V 2A power source and cables to power the RPis
Clusterhat from 8086 - x1
RPi Zero W - x4 (Or the non-wireless version)
RPi 3b (REM: The following instruction are not for the Raspberry RPi 3 b+. See Clusterhat website for the description of the problem.)
16 GB Class 10 micro SD - x4 (Larger, smaller, your choice)
32 GB Class 10 micro SD - x1 (Larger, smaller, your choice)
You will need to use an image writing tool to install the downloaded images onto the SD cards
You're a DIY type of person, and you've burned a few RPi in your day
Rules for 1st Time Setup
Keep all of the defaults "As Is" until after everything is working
Don't modify any of the scripts, playbooks, etc. unless necessary to fix a setup/install problem
Whenever working in a terminal just run as sudo
Prep
Go to Clusterhat and download the following images:
Desktop Controller - Desktop Stretch image for the controller
P1 - Stretch Lite image for Zero P1
P2 - Stretch Lite image for Zero P2
P3 - Stretch Lite image for Zero P3
P4 - Stretch Lite image for Zero P4
Decompress each of the files so that the .img is accessible to the image writing tool. I suggest installing the images as follows:
32 GB - RPi 3b - Desktop Controller
16 GB - RPi Zero
After piecing everything together, its time to boot up.
REM: Piecing the entire RPis and Clusterhat together with the network, keyboard/mouse, HDMI and power is beyond the scope of this document.
Make sure you put the Zeroes in the correct order. Version 2.0 of the Clusterhat, P1 is nearest to the GPIO and P4 is closed to the micro USB power port.

RPi Controller
The RPi Controller will boot up, except possibly the Zeros (until they are turned on.) There's a GUI for this, but I like CLI, so open a terminal on the RPi Controller.
REM: Make sure you have access to the Internet. If you don't, then you'll need to correct that issue before you can move on to the rest of the guide.
The following appears to be redundant, but the error rate is significantly reduced:

apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y

Find something to do; this might take a while. (REM: crippling download speed)
Once it's finished, issue your favorite reboot sequence. (i.e., reboot, shutdown -r now, etc.)
Now lets git Prowler. From the terminal do the following (REM: Be sure you are in the /home/pi directory when you clone the repository):

git clone https://github.com/tlkh/prowler

Now, cd into the directory of Prowler and execute:

cd prowler (i.e., pwd = /home/pi/prowler)
./setup_node.sh

REM: You might need to do a chmod +x *.sh
The update/upgrade will run all over again, but it will take care of the rest of the requirements as far as libraries, and additional packages such as NMap.
Now let's install Ansible

pip3 install ansible

Clusterhat
Once everything is installed, now its time to get the Zeros up and running.
Turn on the Zeroes via CLI in a terminal:

clusterhat on p1

From the terminal type the following:

minicom p1

REM: If challenged, remember its U: pi, P: clusterhat
Let's see what IP address we have, at the terminal enter:

ifconfig usb0

It should return an IP Address that is within the same range as the RPi Controller.
If not, the "fix" I used that seem to work was to change the line for iface from manual to DHCP in /etc/network/interface.d/clusterhat for ethpi1 to 4 and then reboot
To set the Zero's so that we can issue commands, e.g., Ansible, we are going to need to enable SSH. In a terminal, execute:

raspi-config

Select Interfacing Options
Navigate to and select SSH
Choose Yes
Select Ok
Reboot the Zero
Choose Finish

Repeat the above steps for each of the remaining Zero images.
REM: Be sure write down what the IP Address is for each of the Zeros

Passwordless SSH
Open a terminal on the RPi Controller

ssh-keygen

Click on Enter whenever prompted

Enter file in which to save the key (/home/pi/.ssh/id_rsa):[Press Enter key]
Enter passphrase (empty for no passphrase): [Press Enter key]
Enter same passphrase again: [Press Enter key]

Now we need to copy the public key to each of the Zeroes. In a terminal on the RPi Controller:

ssh-copy-id -i ~/.ssh/id_rsa.pub pii@<Zero's pX IP Address>

When prompted for the password enter: clusterhat
Now, test if we are now able to connect to the Zero from the RPi Controller. In a terminal:

ssh RPi@<Zero's pX IP Address>

It should result in the following prompt:

pi@pX:~ $

If you see this prompt, it means success!
Now repeat these steps for the remaining Zeroes. (i.e., p2 to p4)

Ansible
The setup doesn't do this part for you, so you're going to have to do it yourself.
On the RPi Controller, in terminal create a directory called ansible in /etc

mkdir /etc/ansible

Now create a file called hosts in the new ansible directory

vim /etc/ansible/hosts

REM: Hope you wrote down the IP Addresses for each of the Zeroes
Add the following to the hosts' file:

[all:vars]
ansible_connection=ssh
ansible_ssh_user=pi

[pi-cluster]
Zero's IP Address for p1
Zero's IP Address for p2
Zero's IP Address for p3
Zero's IP Address for p4

Now save (:wq!)

Slight Mod
Discovered during the setup process for the Zeroes that one of the actions in the playbook assumed Prowler was installed. Not sure if this is how its meant to work, but the fix is to install it on each node. To do that, we're going to modify the setup_node.yml playbook by inserting an action to git and clone Prowler on each Zero.
In a terminal on the RPi Controller:

cd /home/pi/prowler/playbooks
cp setup_node.yml setup_node.org

Now edit setup_node.yml with your favorite editor add the following lines before the line with "Configure Python packages"

REM: Follow the formatting of the playbook

Ansible Playbooks
Let's see if all of the previous steps paid off.
On the RPi Controller, open a terminal and run the following:

ansible-playbook /home/pi/prowler/playbooks/setup_node.yml

This will take a while...
When finished, you shouldn't see any errors being reported by Ansible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants