Project

General

Profile

Support #883

Install Open-Source-Billing on FreeBSD

Added by Daniel Curtis about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Server
Target version:
Start date:
02/01/2017
Due date:
% Done:

100%

Estimated time:
1.50 h
Spent time:

Description

This is a guide for setting up the Open-Source-Billing web app on FreeBSD 10.

Prepare the Environment

  • Make sure the system is up to date:
    pkg update && pkg upgrade
    
  • Install a few dependencies:
    pkg install git sudo bash autoconf automake libtool bison readline sqlite3 gdbm gmake v8 ImageMagick-nox11 wkhtmltopdf
    

Install MariaDB server

  • Start by installing the mariadb100-server and mariadb100-client packages:
    pkg install mariadb100-{server,client}
    
  • Copy a base MariaDB configuration to use:
    cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf
    
  • Edit the mariadb config to change the max packet size:
    vi /var/db/mysql/my.cnf
    
    • and modify max_allowed_packet to 32M
      max_allowed_packet = 32M
      
  • Enable and start MariaDB
    echo 'mysql_enable="YES"' >> /etc/rc.conf
    service mysql-server start
    
  • Prepare the database for use by running the secure installation:
    mysql_secure_installation
    
    • NOTE: Choose a strong root password and answer yes to all questions.

Create MariaDB Databases and Users

  • Login to MariaDB and create appropriate databases and users.
    mysql -u root -p
    
    • and run the following SQL queries to create the osbdb database and osbuser user:
      CREATE DATABASE osbdb CHARACTER SET utf8;
      
      CREATE USER 'osbuser'@'localhost' IDENTIFIED BY 'SuperSecretPassword';
      
      GRANT ALL PRIVILEGES ON osbdb.* TO 'osbuser'@'localhost';
      
      FLUSH PRIVILEGES;
      
      quit
      

Install RVM

  • Change the default shell to bash:
    chsh
    
  • Switch to the temp directory:
    cd /tmp
    
  • Download the RVM installer script:
    fetch https://get.rvm.io -o installer.sh
    
  • Install the latest stable release of RVM:
    bash installer.sh stable
    
  • Setup the required ruby version:
    rvm install 2.0.0
    

Install Open-Source-Billing

  • Add the osb user
    pw add user -m -n osb -s /usr/local/bin/bash -G rvm -c "Open Source Billing" 
    
  • Make the web directory:
    mkdir -p /usr/local/www
    cd /usr/local/www
    
  • Clone the open-source-billing repo from GitHub:
    git clone https://github.com/vteams/open-source-billing osb
    
  • Change the permissions to osb:
    chown -R osb /usr/local/www/osb
    
  • Switch to the osb user and set the default ruby version:
    su - osb
    cd /usr/local/www/osb
    rvm use 2.0.0 --default
    
  • Install bundler:
    gem install bundler
    
  • Switch to the osb directory and setup bundler to use the system version of v8:
    bundle config build.libv8 --with-system-v8
    
  • Install the required gems:
    bundle install
    
  • Copy the example open-source-billing config file:
    cp config/config.yml.copy config/config.yml
    
  • Copy the example environment config file:
    cp config/environments/production.rb.copy config/environments/production.rb
    
  • Copy the example database config:
    cp config/database.yml.backup config/database.yml
    
    • And update the config app host location:
      production:
        app_host: '192.168.1.100'
        app_protocol: http
      
        wkhtmltopdf_path: /usr/local/rvm/gems/ruby-2.0.0-p648/bin/wkhtmltopdf
      
  • Edit the database config:
    vi config/database.yml
    
    • And set the mysql username/password
      production:
        adapter: mysql2
        encoding: utf8
        reconnect: false
        database: osbdb
        pool: 5
        username: osbuser
        password: SuperSecretPassword
        host: localhost
      
  • Create the database tables needed to run:
    RAILS_ENV=production rake db:migrate
    
  • Test the server with:
    rails s -b 0.0.0.0
    

Resources

#1

Updated by Daniel Curtis about 7 years ago

  • Description updated (diff)
#2

Updated by Daniel Curtis about 7 years ago

  • Description updated (diff)
#3

Updated by Daniel Curtis about 7 years ago

  • Description updated (diff)
  • Status changed from New to Resolved
  • % Done changed from 0 to 100
#4

Updated by Daniel Curtis almost 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF