How to install Sharetribe for Ubuntu 16.04

Sharetribe is a popular opensource marketplace, written in Ruby. Although it is a very professional platform and with a great user experience, the installation is quite complex. Here is probably the best tutorial to install Sharetribe on Ubuntu.


Update (27-nov-2017): As I am receiving a lot of emails to support people on this application, I have enriched my tutorial to cover the systemd scripts, virtualhost and email SMTP configurations.

Update (7-Jan-2018): Added a Stripe configuration section




Assuming you start from a fresh Ubuntu 16.04 Server version, here is the full doc:

1) Install git  and clone their repository

You can do it in the folder of your choice.

sudo apt-get install git-core
git clone git://
cd sharetribe
git checkout latest

This will download around 110mb, so stay tuned.


2) Install few requirements

Before to install Ruby, we will need to install curl, you will also need imagemagick and NodeJS for Sharetribe.

They are using the Node.js 7.8. Using the default one in the repo will not work then. Here is what you need to run:

sudo apt-get install build-essential libssl-dev curl imagemagick -y
curl -sL -o
source ~/.profile

Then list the available version and install the 7.8

nvm ls-remote
nvm install 7.8.0
nvm use 7.8.0
3) Create the needed MySQL Database and configure the file named database.yml

If you do not have a MySQL database ready, you could follow this tutorial, or simply run:

sudo apt-get install mysql-server -y

It will ask you to set up a root password.


You can either use PHPMyAdmin or simply do it in command line:

mysql -u root -p

it will prompt for your MySQL root password.

When you are connected to your MySQL server, you will need to create 1 database and 1 user associated to this database.

  • Database:

    CREATE DATABASE sharetribe_production CHARACTER SET utf8 COLLATE utf8_general_ci;

  • User

Change PASSWORD by a strong password you want to create.

GRANT all privileges ON sharetribe_production.* TO 'sharetribe'@'localhost' IDENTIFIED BY 'PASSWORD';
  • And then simply exit


  • Now create a database.yml file by copying the example database configuration:

    cp config/database.example.yml config/database.yml

and configure the “production” part of it with your favorite text editor. (You will only need to add the user/password for the user you have just created)

nano config/database.yml


4) Install Sphinx

Sphinx is a requirement of Sharetribe. I suggest you to use the latest one available on their official website.

The latest version at the time of this article is the 2.2.11. Hence I have downloaded their .deb version in AMD64 (64bits) for Ubuntu and installed it. But first, you will need some dependencies as well, or else, the installation of Sphinx will fail.

sudo apt-get install libmysqlclient20 libodbc1 libpq5 -y
sudo dpkg -i sphinxsearch_2.2.11-release-1~xenial_amd64.deb
5) Install Ruby

You will need to use the  version 2.3.4 based on their documentation (This version, may change, I suggest you to check their requirements page first.)

To ease our job, we will use RVM

  • First, import the GPG key (under your regular user)

    gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

  • Then, install the latest version of RVM

    curl -sSL | bash -s stable

  • Now install Ruby 2.3.4

    source ~/.rvm/scripts/rvm rvm install 2.3.4

This will download and compile ruby-2.3.4 for your system. It may takes some time depending on your bandwidth and computer speed

  • Install the rubygems by running:

    rvm rubygems current

  • And ensure you are using the Ruby version 2.3.4 (needed if you have different Ruby versions installed on your server)

    rvm use 2.3.4

6) Install the required gems
  • First you will need couples of dependencies

– LibXML2 and XSLT to avoid a failure with the gem nokogiri

sudo apt-get install libxslt-dev libxml2-dev -y

-LibMYSQLclient to avoid a failure with mysql2

sudo apt-get install libmysqlclient-dev -y
  • Install the gem “bundler” and “mailcatcher”

    gem install bundler gem install mailcatcher

  • Run the installation

    bundle install

You should normally have no error. If you do, it’s probably a lacking dependency. (Please let me know if it is the case)


7) Install node modules:
npm install

This will take quite some time (coffee time?) but should be straightforward.


7) Set-up Sharetribe for production mode

First you need to configure you secret key

  • Generate a key

    rake secret

and copy the key.

  • Create or modify the config file to add the key

    nano config/config.yml

and add:

  secret_key_base: # add here the generated key
  • Then prepare the environment

    RAILS_ENV=production bundle exec rake db:create RAILS_ENV=production bundle exec rake db:structure:load RAILS_ENV=production bundle exec rake ts:index RAILS_ENV=production bundle exec rake ts:start RAILS_ENV=production NODE_ENV=production bundle exec rake assets:precompile

If any error happen, you will need to fix them before continuing.

Now invoke the delayed job worker

RAILS_ENV=production bundle exec rake jobs:work

and in a new window, start the server

source ~/.rvm/scripts/rvm
cd sharetribe
bundle exec rails server -e production

You should now have a working Sharetribe server and it should be accessible through the port 3000 of your server.


If you wish to use your own domain name, it is now the best time to configure the database accordingly.

You need to change the domain default value in the database. You can either do it in SQL or with phpmyadmin.

sudo apt-get install phpmyadmin

Once installed, you need to modify the value domain (By the domain name without http://) and the value use_domain (By 1), in the table “communities”

8) Set-up Stripe as payment gateway

It seems with the opensource version, it is very difficult to get a merchant account for Paypal, so most of the users are using Stripe itself. Here is how to configure it.

Get a ruby shell:

bundle exec rails c -e production

and run the 2 commands:

TransactionService::API::Api.processes.create(community_id: 1, process: :preauthorize, author_is_seller: true)
TransactionService::API::Api.settings.provision( community_id: 1, payment_gateway: :stripe, payment_process: :preauthorize, active: true)

Now, configure your config.yml

nano config/config.yml

and add:

stripe_private_key_pattern: "sk_(test|live)_.{24}"
stripe_publishable_key_pattern: "pk_(test|live)_.{24}"
app_encryption_key: "2617463e32b65ec6645b3cb661f9686f2ab608c18ac930ee1295a1c1170504ed"

restart the service, or follow the next steps to setup SystemD Startup scripts, and you will have a new Payment setting menu in the admin section. Simply ad your Stripe APIs (Publishable and Secret) to finish the Stripe setup.


9) Create SystemD scripts

You have now a working instance of Sharetribe. But it will stop when you close your SSH connection or when you restart your machine. The idea is to have it started as a daemon / at the startup.

I did not find much info on this, so I reuse some pieces there and there. Is it the best way? I don’t know. But it works 😉

Since you are having to command line to run, i made 3 services.

sudo nano /etc/systemd/system/sharetribe.service

and paste:

<pre class="show-plain-default:true lang:default highlight:0 decode:true ">[Service]
ExecStart=/bin/bash -lc 'source /home/ubuntu/.profile && source /home/ubuntu/.rvm/scripts/rvm && bundle exec rake ts:index && bundle exec rake ts:start'


Save the doc and create another one:

sudo nano /etc/systemd/system/sharetribe2.service

and paste:

<pre class="show-plain-default:true lang:default highlight:0 decode:true">[Service]
ExecStart=/bin/bash -lc 'source /home/ubuntu/.profile && source /home/ubuntu/.rvm/scripts/rvm && bundle exec rake jobs:work'
Environment=RAILS_ENV=production NODE_ENV=production


Save the doc and create the third one:

sudo nano /etc/systemd/system/sharetribe3.service


<pre class="show-plain-default:true lang:default highlight:0 decode:true">[Service]
ExecStart=/bin/bash -lc 'source /home/ubuntu/.rvm/scripts/rvm && bundle exec rails server -e production'


Now enable them:

sudo systemctl enable sharetribe
sudo systemctl enable sharetribe2
sudo systemctl enable sharetribe3

then reload the systemd daemon to take into accounts your changes

sudo systemctl daemon-reload

and start them:

sudo systemctl start sharetribe
sudo systemctl start sharetribe2
sudo systemctl start sharetribe3

It should now be running. Have a look to YourIP:3000 to ensure it works.


10) Virtualhost configuration

Now that your Sharetribe instance is working, you probably want to give it a friendlier URL, like, without the need to enter the port. We will do it with a virtualhost configuration and the proxypass fonction. (of course, I assume you have apache2 installed)

First, create a virtualhost:

sudo nano /etc/apache2/sites-available/sharetribe.conf

and paste

<pre class="show-plain-default:true lang:default highlight:0 decode:true"><VirtualHost *:80>

ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/

Then enable the modules proxy_http and proxy_html. They should already be installed on your machine. If not, install apache2-bin

sudo a2enmod proxy_http
sudo a2enmod proxy_html

Enable your new vhost:

sudo a2ensite sharetribe

and restart your apache

sudo service apache2 restart


You should now have access to your Sharetribe shop directly through !


11) Email configurations

Once you start to configure your Sharetribe Instance, you will have to confirm your email address. Basically it will not work out of the box as you need to configure that part too. (You can byppass the email address confirmation by tweaking the database, but you probably want a production server isn’t it?).

I had quite some issues to do it and I had to follow a different path than what Sharetribe’s doc is suggesting. I am basically fully relying on Sendmail and directly configure it in the system rather than configuring the SMTP info in Sharetribe only.

Here is what I did to use my gmail SMTP.

First you need to turn on the “less secure” option in order to be able to use it. Simply do it over here.

Then run:

sudo apt-get install sendmail mailutils sendmail-bin

create the folder and configuration file:

sudo mkdir -m 700 /etc/mail/authinfo/
cd /etc/mail/authinfo/
sudo nano gmail-auth

and copy paste:


User is root, I is your Gmail email and P is your password. (Keep the syntax with U:, I:, P:)

Then create the hash map:

sudo makemap hash gmail-auth < gmail-auth

now, configure your sendmail:

sudo nano /etc/mail/

and paste just before the first “MAILER” definition line:

define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-auth.db')dnl

Now rebuild the sendmail configuration and restart it

make -C /etc/mail
service sendmail restart

The final step is to configure Sharetribe to use Sendmail. You simply need to modify your config.yml file

nano /home/ubuntu/sharetribe/config/config.yml

and add:

mail_delivery_method: "sendmail"



If you like this project, please thanks them directly or go with their paid package.Phew !! You now have a basic Sharetribe marketplace on your server. You will probably want to do so much more (payment gateway, etc..), feel free to check their documentation.


Loves to discover web-based apps to install on his own server@home and write articles about it


Add a comment