Skip to content

2024 Full setup on Linux WSL using MySQL

GameChanger edited this page Oct 19, 2024 · 2 revisions

Fat Free CRM Setup and Installation Guide

Starting with a Fresh Install of Ubuntu

Update and upgrade the system:

sudo apt-get update
sudo apt-get upgrade

Installing Ruby with rbenv

Install dependencies for Ruby and SQLite:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev libmysqlclient-dev
sudo apt-get install postgresql postgresql-contrib libpq-dev

Set up rbenv:

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

Install Ruby:

rbenv install 3.3.2
rbenv global 3.3.2

Installing MySQL (Optional)

This guide shows how to set up Fat Free CRM with MySQL, but you could use PostgreSQL, or SQLite instead.

Install MySQL server:

sudo apt install mysql-server
mysql --version # Verify the installation
sudo /etc/init.d/mysql start

Set a password for the MySQL root user:

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
quit

Installing the Fat Free CRM Project

Clone the project repository:

git clone https://github.com/fatfreecrm/fat_free_crm.git
cd fat_free_crm

Copy the database configuration for MySQL:

cp config/database.mysql.yml config/database.yml
cd config
sudo nano database.yml

Set the username and password (use "root" if following this guide). Press ctrl+s to save it and ctrl+x to exit the text editor.

If you are not using MySQL then replace cp config/database.mysql.yml config/database.yml with one of the following:

  • PostgreSQL: cp config/database.postgres.yml config/database.yml
  • SQLite: cp config/database.sqlite.yml config/database.yml

Update the Gemfile

  • Change the SQLite version in the Gemfile to at least 2.0.4 (in two places).
  • Add gem 'mysql2' to the bottom of the Gemfile, or replace 'pg' in the else clause with 'mysql2'
case ENV['CI'] && ENV['DB']
when 'sqlite'
  gem 'sqlite3', '~> 1.3.13'
when 'mysql'
  gem 'mysql2'
when 'postgres'
  gem 'pg'
else
  gem 'pg'
end

You are supposed to be able to set an environment variable (e.g. DB=mysql) to make it load the corresponding gem, but in my experience, that doesn't work how it should.

To Edit the Gemfile Run:

cd ..
sudo nano Gemfile

Make the changes mentioned and then press ctrl+s to save them and ctrl+x to exit the text editor.

Install Required Gems

Install Bundler and other gems:

gem install bundler
gem install --no-document rake -v 0.8.7
gem install --no-document rails3-generators
gem install mysql2

Install dependencies:

bundle install

Settings Configuration (Optional)

You can configure Fat Free CRM settings, such as your host, base URL, language (locale),
menu structures, default colors, and email authentication.

Fat Free CRM settings are stored in three places, and are loaded in the following order:

  1. config/settings.default.yml
  2. config/settings.yml (if exists)
  3. ‘settings’ table in database (if exists)

Settings loaded last have the highest priority, and override any settings from the previous sources.

To override any settings:

  • Create a blank file at config/settings.yml
  • Copy the settings that you want to override from config/settings.default.yml,
    and configure the values.

Set Up the Database

Create the database and load the schema:

rails db:create
rails db:schema:load

Run the initial setup or load demo data: The setup will walk you through the process of creating your own user account. The demo option will load the demo data.

IMPORTANT: Loading the demo data will delete all existing data from your database. Among other things the demo generator creates 8 sample user records with the following usernames:

Username Password
aaron aaron
ben ben
cindy cindy
dan dan
elizabeth elizabeth
frank frank
george george
heather heather

Note: You can reset the database and reload demo data at any time by using rails ffcrm:demo:reload

rails ffcrm:setup
# OR
rails ffcrm:demo:load

Start the Rails Server

Now you should be able to launch the Rails server and point your web browser
to http://localhost:3000

rails server
Clone this wiki locally