Skip to main content

How to install Sharetribe for Ubuntu 16.04

One of my reader (Justin), had trouble with my close-to-be 2 years outdated tutorial for Sharetribe, a great opensource marketplace written in Ruby.

He was trying to install it on Ubuntu 16.04 (Where I write all my tutorials using Debian) and obviously in 2 years, a lot happened (New dependencies, etc..), so I supposed this did not help neither.

Sharetribe being an interesting project, I wanted to give it a try and this time, on Ubuntu.

So, I followed the previous tutorial (and it worked quite well actually), but here are the majors steps I did to install Sharetribe on Ubuntu 16.04

 

Installation

As LibreOffice Online uses Docker, the installation will be quite easy, but you need first to install Docker if not done yet. Here is the official installation steps. But if you are using Debian, like me, this is how to install docker on Debian.

 

1) Install git  and clone their repository

You can do it in the folder of your choice.

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 6.9. Using the default one in the repo will not work then. Here is what you need to run:

3) Create the needed MySQL Database and configure the file named database.yml

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

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:
  • User

Change PASSWORD by a strong password you want to create.

  • And then simply exit

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

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)

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.3.2. 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 fell.

5) Install Ruby

You will need to use the  version 2.3.1 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)
  • Then, install the latest version of RVM
  • Now install Ruby 2.3.1
This will download and compile ruby-2.3.1 for your system. It may takes some time depending on your bandwidth and computer speed

  • Install the rubygems by running:
  • And ensure you are using the Ruby version 2.3.1 (needed if you have different Ruby versions installed on your server)
6) Install the required gems
  • First you will need couples of dependencies

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

-LibMYSQLclient to avoid a failure with mysql2

  • Install the gem “bundler”

  • Run the installation

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:

Simply run:

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
and copy the key

  • Create or modify the config file to add the key
and add:
  • Then prepare the environment
If any error happen, you will need to fix them before continuing.

Now invoke the delayed job worker

and in a new window, start the server

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

 

 

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.

If you like it, please thanks them directly or go with their paid package.

20 thoughts on “How to install Sharetribe for Ubuntu 16.04

  1. $ bundle install
    It give me one issue, because on my Ubuntu server was not installed g++.
    $ sudo apt-get install g++

  2. by default Ubuntu installing nodejs 6.10.1, but in sharetribe/client/package.json they use 6.9, you need change it to 6.10 or install 6.9 instead of default version and then start this command
    $ RAILS_ENV=production bundle exec rake assets:precompile

  3. I’m trying to install sharetribe on ubuntu and there are a lot of dependencies required after bundle install instruction

    1. Hi Andrea,
      Can you post the detail?

      I’ve done my tutorial on a fresh Ubuntu 16.04, so I should have covered most of them. But the project is in continuous improvement and they might have added some further dependencies.

  4. Hi Andrea

    Great tutorial. Have follow with no error, except when access from browser using IP:3000, have the following error.
    I am using ubuntu 16.04 on Azure. I check booth root and sharetribe user has accessed to sharetribe_production database
    ————————————
    Mysql2::Error
    Access denied for user ‘root’@’localhost’ (using password: NO)

    Extracted source (around line #23):

    21 redirect(“https://#{redirect_host}#{path}”)
    22 else
    23 @app.call(env)
    24 end
    25 end
    —————–

    1. Hi,
      I was thinking about some access issue to MySQL, but since you are saying no problem there, we need to further deep dive.
      I suggest you to ask the devs directly. I don’t have ideas at the moment.

      Thanks

  5. Hi! I follow the steps but =(

    UBUNTU 16.10 LOCAL

    this error show the terminal, please help me.

    home/xc/.rvm/gems/ruby-2.3.1/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/vm/mri_vm.rb:32: warning: GC.stat keys were changed from Ruby 2.1. In this case, you refer to obsolete total_allocated_object' (new key is total_allocated_objects’). Please check for more information.
    Exiting
    /home/xc/.rvm/gems/ruby-2.3.1/gems/devise-3.5.10/lib/devise/rails/routes.rb:489:in `raise_no_secret_key’: Devise.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)

    config.secret_key

  6. @Fernando I have run into a similar error. Any luck getting to the bottom of it?

    The error I see is:

    /usr/local/rvm/gems/ruby-2.3.1/gems/devise-4.3.0/lib/devise/rails/routes.rb:498:in `raise_no_secret_key’: Devise.s ecret_key was not set. Please add the following to your Devise initializer: (RuntimeError)

    1. Thaks, I generate de secret key. But I have new problem. @SID SMITH
      When a run de Sharetribe configuration production commad, shows me this:
      NoMethodError: undefined method `deep_symbolize_keys’ for #
      Please helpe me to solve this.

  7. HI! When a run de Sharetribe configuration production commad, shows me this:
    NoMethodError: undefined method `deep_symbolize_keys’ for #
    Please helpe me to solve this.

  8. Strange that although nodejs 6.9 is required but the last command

    {{RAILS_ENV=production bundle exec rake assets:precompile}}

    only runs using nodejs 7.8

  9. Almost there – running into a problem with step 7

    #npm install
    Result:
    npm WARN lifecycle undefined~postinstall: cannot run in wd %s %s (wd=%s) undefined cd client && npm install /sharetribe

    Tried:
    #sudo npm install -g

    Result:
    WARN engine @: wanted: {“node”:”7.8″} (current: {“node”:”4.2.6″,”npm”:”3.5.2″})
    npm ERR! addLocal Could not install /sharetribe
    npm ERR! Linux 4.10.0-28-generic
    npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g”
    npm ERR! node v4.2.6
    npm ERR! npm v3.5.2

    npm ERR! No name provided in package.json
    npm ERR!
    npm ERR! If you need help, you may report this error at:
    npm ERR!

    npm ERR! Please include the following file with any support request:
    npm ERR! /sharetribe/npm-debug.log

    Have installed NVM and node 7.8 is my default. npm-debug.log:

    32 verbose cwd /sharetribe
    33 error Linux 4.10.0-28-generic
    34 error argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g”
    35 error node v4.2.6
    36 error npm v3.5.2
    37 error No name provided in package.json
    38 error If you need help, you may report this error at:
    38 error
    39 verbose exit [ 1, true ]

  10. Hi,

    This is the best and most comprehensive guide so far, thanks a lot!

    Currently there seems to be version compatibility issues with nodejs 6.9 or 7.8, ruby 2.3.4 and rails 5.1 and since your post sharetribe is also updated, Can you please update this guide to the latest sharetribe install?

    It would be awesome to have a full working image/script/one click installer for ubuntu 16,04 LTS on linode/digital ocean/any hosting. (just like in wordpress) Sharetribe wants to be the wordpress of marketplaces, so why not helping users to create an easy one click installer? 😉
    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *