OpenBazaar livenet is here, and I’m excited to get selling! I don’t have the greatest computer or internet, so I decided to run my OpenBazaar server not on my workstation, but on a dedicated computer in my basement. Here’s how to do the same on Ubuntu 12.04!
It is important to run openbazaar as a user other than root, since running it as root is a potential security risk. Create an ob user, which your openbazaar server daemon will run under.
sudo useradd -m -s /bin/bash ob
Give ob user sudo access. If you know your stuff, you don’t have to do this part, but it’s easier to explain if ob has sudo access.
sudo usermod -a -G sudo ob
Create a password for the ob user. Make it a strong one and store it in a secure place.
sudo passwd ob
Now we can switch to the ob user, using the password we just created.
We might not be in ob’s home directory, but that’s where we want to be, so run cd which will take us there.
Update package information, and Install important security updates for all your packages.
sudo apt-get update && sudo apt-get upgrade
OpenBazaar server needs a bunch of things. It’s easy to install a majority of them in one go-
sudo apt-get install git build-essential libssl-dev libffi-dev python-dev openssl python-pip libzmq3-dev autoconf pkg-config libtool
There are some dependencies that aren’t in Ubuntu’s repositories, but they are available through third parties who package the software for Ubuntu.
ZeroMQ development packages
sudo add-apt-repository ppa:chris-lea/zeromq sudo apt-get update sudo apt-get install -y libzmq3-dev
cd ~ wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.8.tar.gz tar xvf libsodium-1.0.8.tar.gz cd libsodium-1.0.8/ ./configure make make check sudo make install
ZeroMQ library packages
git clone https://github.com/zeromq/libzmq cd libzmq ./autogen.sh && ./configure && make -j 4 make check && sudo make install && sudo ldconfig
At this step, I encountered an error. All the tests from make check passed, but make install failed–
=================== All 79 tests passed =================== make: Leaving directory `/home/esuvee/tmp/libzmq' make: Leaving directory `/home/esuvee/tmp/libzmq' Making install in doc make: Entering directory `/home/esuvee/tmp/libzmq/doc' make: Entering directory `/home/esuvee/tmp/libzmq/doc' make: Nothing to be done for `install-exec-am'. test -z "/usr/local/share/man/man3" || /bin/mkdir -p "/usr/local/share/man/man3" /bin/mkdir: cannot create directory `/usr/local/share/man/man3': Permission denied make: *** [install-man3] Error 1 make: Leaving directory `/home/esuvee/tmp/libzmq/doc' make: *** [install-am] Error 2 make: Leaving directory `/home/esuvee/tmp/libzmq/doc' make: *** [install-recursive] Error 1
sudo pip install cryptography
Download and Install OpenBazaar
using git, download the OpenBazaar server repository
cd ~ git clone https://github.com/OpenBazaar/OpenBazaar-Server.git cd OpenBazaar-Server
Install the Python requirements that the OpenBazaar server needs. This step took about 7 minutes for me.
Create a python virtual environment from which your OpenBazaar server will run, then enter the virtual environment-
virtualenv observer source ./observer/bin/activate
Install the OpenBazaar server Python dependencies-
pip install -r requirements.txt
There is a file in this OpenBazaar repository called ob.txt. This is the configuration file for our OpenBazaar server. We need to edit the file and set a username and strong password which we will later use to log into the OpenBazaar client interface. I use emacs, so I edit the file like this-
emacs -nw ./ob.txt
Use whatever text editor you’re most comfortable with. If you’re new to the Linux CLI, I recommend nano , which you would use like this:
Inside ob.txt, you’ll see a section called [AUTHENTICATION], like this-
[AUTHENTICATION] #SSL = False #SSL_CERT = /path/to/certificate.crt #SSL_KEY = /path/to/privkey.key #USERNAME = username #PASSWORD = password
Remove the hash signs at the start of the USERNAME and PASSWORD lines (uncomment), and set a username and password of your choosing. Your authentication section should end up looking like this:
[AUTHENTICATION] #SSL = False #SSL_CERT = /path/to/certificate.crt #SSL_KEY = /path/to/privkey.key USERNAME = pleb007_victoria PASSWORD = reely57r0nk9455w0rd
Save the file and close your text editor.
Take a moment to install SSL using this guide. This secures the communication between your OpenBazaar server and your OpenBazaar client.
Running OpenBazaar Server
It’s time to start the server, but first a note about security. It is a good idea to restrict the IP addresses that can log in to your OpenBazaar server, since you are the only person who should be creating and publishing items in your store. The OpenBazaar server has a command line option for this, the -a flag. This tells the OpenBazaar server to only allow the following IP address to log in to your OpenBazaar server.
We will need to know the IP address of the client computer you will be connecting from. Since both my OpenBazaar server and client are on the same LAN, I just need to enter the LAN IP address of my client computer, 192.168.1.70. If your server is on a VPS hosted by a cloud provider, you will need to enter your home router’s public IP address, which you can find here. That may be a problem though, since depending on your Internet Service Provider, your home router’s IP address may change over time. If that’s the case, you may need to skip this step and tell OpenBazaar to accept logins from any IP address, setting the -a flag to 0.0.0.0. A strong password changed regularly is very important!
Start your openbazaar server, specifying which IP address is allowed to connect and attempt log in. For me, I call it like this-
python openbazaard.py start -a 192.168.1.70
For you, substitute your home router’s WAN IP address, or use 0.0.0.0 to allow all IP addresses to connect and attempt log in-
python openbazaard.py start -a 0.0.0.0
________ __________ \_____ \ ______ ____ ____\______ \_____ _____________ _____ _______ / | \\____ \_/ __ \ / \| | _/\__ \ \___ /\__ \ \__ \\_ __ \ / | \ |_> > ___/| | \ | \ / __ \_/ / / __ \_/ __ \| | \/ \_______ / __/ \___ >___| /______ /(____ /_____ \(____ (____ /__| \/|__| \/ \/ \/ \/ \/ \/ \/ OpenBazaar Server v0.1 starting... Generating GUID, this may take a few minutes... Exception : No UPnP device discovered 2016-04-21 02:15:48+0000 [OpenBazaard] [INFO] Finding NAT Type... 2016-04-21 02:15:49+0000 [OpenBazaard] [INFO] Full Cone on x.x.x.x:18467 2016-04-21 02:15:49+0000 [Server] [INFO] querying seed2.openbazaar.org:8080 for peers 2016-04-21 02:15:49+0000 [Server] [INFO] seed2.openbazaar.org:8080 returned 50 addresses 2016-04-21 02:15:49+0000 [Server] [INFO] querying seed.obcentral.org:8080 for peers 2016-04-21 02:15:50+0000 [Server] [ERROR] failed to query seed: [Errno 111] Connection refused 2016-04-21 02:15:50+0000 [OpenBazaard] [INFO] startup took 46.73 seconds 2016-04-21 02:15:53+0000 [-] [INFO] Libbitcoin server online at tcp://libbitcoin3.openbazaar.org:9091 2016-04-21 02:15:53+0000 [Server] [INFO] bootstrapping with 50 addresses, finding neighbors... 2016-04-21 02:15:53+0000 [ConnHandler] [INFO] connected to 188.8.131.52:11021 2016-04-21 02:15:53+0000 [ConnHandler] [INFO] connected to 184.108.40.206:11007 2016-04-21 02:15:53+0000 [ConnHandler] [INFO] connected to 220.127.116.11:18467 2016-04-21 02:15:53+0000 [ConnHandler] [INFO] connected to 18.104.22.168:18467
welcome to OpenBazaar!