Sharetribe is a very easy tool to start your marketplace business. The team behind the project offers hosting packages (including taking care of all technical stuffs) or you can simply install it on your own server! This is what we are going to see today!
Sean, in one of his comments, introduced me Sharetribe, an opensource market platform supporting several types of businesses (Products selling, rentals and services). It was a great surprise for me as I’ve never heard about this opensource project before.
Sharetribe also includes a Paypal module to allow transaction among your members in 25+ currencies.
Mobile friendly and translated in several languages, you will also find powerful messaging and order management embedded in Sharetribe.
It can also be easily linked to a Google Analytics account to optimize the promotion of your marketplace.
See all the features here.
Developed in Ruby, the project is originated from Finland and is freely accessible on their github repository.
If you don’t want to host and manage your Sharetribe instance by yourself, you can subscribe to one of their packages for peace of mind.
So now, let’s see how to install Sharetribe on your own server (Debian in my case)
The installation is not easy but if you follow all those steps, you should make it xD
First you will need Apache and MySQL installed on your server. If it is not done yet, I suggest you to read my article regarding how to install a LAMP server.
Then, I assume you only want to install it in production mode. If not, you should check their git repository for more information.
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 https://github.com/sharetribe/sharetribe cd sharetribe
2) Install few requirements
Before to install Ruby, we will need to install curl, you will also need imagemagick and NodeJS for Sharetribe.
sudo apt-get install curl imagemagick nodejs npm nodejs-legacy
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:
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.
CREATE DATABASE sharetribe_production CHARACTER SET utf8 COLLATE utf8_general_ci;
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 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.2.10. Hence I have downloaded their .deb version in AMD64 (64bits) for my Jessie and installed it.
wget http://sphinxsearch.com/files/sphinxsearch_2.2.10-release-1~jessie_amd64.deb sudo dpkg -i sphinxsearch_2.2.10-release-1~jessie_amd64.deb
5) Install Ruby
You will need the version 2.1.2 (others versions have not been tested). Hence to do it we will use RVM that will greatly simplify the process.
First, import the GPG key (under your regular user)
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Then, install the latest version of RVM
\curl -sSL https://get.rvm.io | bash -s stable rvm requirements
Now install Ruby 2.3.1
rvm install 2.3.1 source ~/.rvm/scripts/rvm
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 Ruby 2.3.1 should also install the rubygems (at the end). if not, simply run:
rvm rubygems current
And ensure you are using the Ruby version 2.3.1 (needed if you have different Ruby versions installed on your server)
rvm use 2.3.1
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
-LibMYSQLclient to avoid a failure with mysql2
sudo apt-get install libmysqlclient-dev -y
Install the gem “bundler”
gem install bundler
Run the installation
If any error occur during the installation, you will need to fix them (Some dependencies missing? let me know to complete my tutorial) before running again the command.
7) Set-up Sharetribe for production mode
bundle exec rake RAILS_ENV=production db:schema:load bundle exec rake RAILS_ENV=production ts:index bundle exec rake RAILS_ENV=production ts:start bundle exec rake assets:precompile
If any error happen, you will need to fix them before continuing.
Now invoke the delayed job worker
bundle exec rake RAILS_ENV=production jobs:work
and in a new window, start the server
source ~/.rvm/scripts/rvm 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.
However, note that this last command will run Sharetribe with the built-in WEBrick server. For greater performance, it is recommended to use a dedicated HTTP server like unicorn.
You can set up your domain name in the MySQL database in the communities table. You will need to change the value “domain” to do it while changing the value of the “use_domain” column to true (or 1) in the communities table.
Most of the needed configuration can be found in the config/config.default.yml file. You will be able to add your SMTP server for example, to send the confirmation emails, notifications, etc…
For more information or if you are facing issues beyond this tutorial, I suggest you to visit their Git repository.