Raspberry Pi Install Raspbian

brettclanton001 edited this page May 1, 2016 · 18 revisions

Step One - Setup : Raspbian Jessie

These steps will prepare your Raspberry Pi / Raspbian server for Open Bazaar.

Boot the system

Downloaded RASPBIAN JESSIE LITE : https://www.raspberrypi.org/downloads/raspbian/

  • Install the .img file on an SD card
  • Boot the Raspberry Pi from SD card
  • Login:
    • user: pi
    • pass: raspberry

Use the nifty config tool

sudo raspi-config
  • Expand File System
  • Change User Password
    • Change this to something only you know
  • Internationalization Options
    • Change Keyboard Layout
    • Generic 105-key (Intl) PC
    • English (US) # important for users in USA
    • continue with other default options
  • Finish
  • Reboot: Yes

Step Two - SSH into the Raspberry Pi

Many of these steps are easier if you can copy and paste directly into the terminal. Making an SSH connection to your Raspberry Pi from your desktop makes this possible.

Here's some info on how to do it: https://www.raspberrypi.org/documentation/remote-access/ssh/unix.md


Step Three - Install and Run Open Bazaar

Install the Server Software

Many of these steps will take a very long time, be patient. It's a lot to download and install, but once it's done, it's smooth sailing.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y git python-dev libffi-dev libssl-dev python-setuptools
sudo easy_install pip

git clone https://github.com/OpenBazaar/OpenBazaar-Server.git
cd OpenBazaar-Server/

Get on the latest stable release:

git checkout `git describe --tags`

Install python requirements for the server to run.

sudo pip install -r requirements.txt

Set a custom username and password

Open the ob.cfg file in your text editor of choice (nano comes preinstalled on Raspbian):

nano ob.cfg

Then uncomment and set the USERNAME and PASSWORD variables to values of your choice, like so.

Before changes:

#USERNAME = username
#PASSWORD = password

After changes:

USERNAME = joebloggs
PASSWORD = aVeryLong&C()mpl1cat3d5tringThatW1llBeVeryHardToGue$5

Run the server

python openbazaard.py start -d -a 0.0.0.0

Stop the server

It's preferred that this is done from the client UI:

"Account Icon" >> Settings >> Advanced >> Shut Down the Server


Step Four - Configure the client to communicate with the server

Run the client on your desktop / laptop computer.

https://github.com/OpenBazaar/OpenBazaar-Client

These instructions do not cover the client setup, perhaps they will later.

Let the loading / connection time out.

It's trying to connect to a "local" server. And this server is not local, it's on a separate computer ( your raspberry pi ). It should be on the same network though.

Remember the IP address you used for SSH?

Earlier, you SSH'ed into the raspberry pi. To do this you needed it's IP address, you're going to need that now to setup the connection from the client.

Change the server connection config to meet your needs.

Now that the localhost connection has timed out.

  • Click the avatar at the top right of the app.
  • Click Settings
  • Click Advanced
  • Click the Change button in the Server Settings row.
  • Set the IP to match that of your Raspberry Pi, and the username and password fields to match the values you entered into your ob.cfg file.
  • Click Save Changes

Step Five - Configuring a static IP

You're probably going to want the Pi to maintain a static IP address on your home network. This will help with:

  • SSHing into the pi in the future
  • Connecting to the Open Bazaar Server from your client running on another computer
  • Port forwarding settings on your router

To set a custom IP, simply open /etc/dhcpcd.conf with the command sudo nano /etc/dhcpcd.conf. Then add the following code to the bottom of the file:

# Static IP
interface eth0
static ip_address=192.168.1.7/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

I used 192.168.1.7 because it happened to be the IP address that my Pi was already assigned. I suggest you change it to match your assigned IP address. So if your Pi is currently 192.168.2.13, then your code should be:

# Static IP
interface eth0
static ip_address=192.168.2.13/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1

Step Six - Start the OB server on reboot

You want your server to be dead simple. If the power goes out, or the Pi gets unplugged, you want powering it back up to start the server automatically. There are many ways to do this, but I believe this is the simplest way.

Add the startup command to your rc.local file. Open the file sudo nano /etc/rc.local and add these lines before the exit 0 line.

# start OB server
su pi -c 'cd /home/pi/OpenBazaar-Server/ && python openbazaard.py start -d -a 0.0.0.0'

This assumes that the pi user is the one that you've been using so far, and the Open Bazaar Server repo was cloned to your home directory. If you followed this guide for your setup, this should all be true.