Install Redmine CRM on AWS EC2 ubuntu instance

Are you looking to install Redmine CRM on AWS EC2 ubuntu instance, then this blog post will help in successfully installing it. Redmine is an open source CRM platform built on ruby on rails. We have carefully crafted this article for you and tested installation on ubuntu 16.04 version. Please go through step by step instructions below to install Redmine.

STEP 1: Update and install necessary packages


sudo apt update
sudo apt install curl subversion libmysqlclient-dev libmagickcore-dev libmagickwand-dev imagemagick g++, zlib1g-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgmp-dev, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev, libgmp-dev, libreadline6-dev, libssl-dev

STEP 2. Install MySQL and Create mysql database


sudo apt install mysql-server

Its time to secure the mysql installation by setting password, use below command to secure.


mysql_secure_installation

Create database and user for redmine installation:


mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON redmine.* TO 'dbuser'@'localhost' IDENTIFIED BY 'dbpassword';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

STEP 3: Create new user

Create a new system user for Redmine Installation.


sudo adduser --home /opt/redmine --shell /bin/bash --gecos 'Redmine application install' redmine
usermod -aG sudo redmine

You can now switch to the new redmine user:

sudo su - redmine

STEP 4: Install Ruby using RVM

Install ruby using below commands


curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby

To start using RVM run the following commands:


source ~/.rvm/scripts/rvm
rvm --default use ruby

To verify successful ruby installation, you can use command:


ruby --version

It should output the following:


ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

STEP 5: Redmine Installation

Run below commands to checkout the Redmine source code to the $HOME/redmine directory and create the necessary directory structure.


cd && svn co http://svn.redmine.org/redmine/branches/3.3-stable redmine
mkdir -p ./redmine/tmp/pids ./redmine/public/plugin_assets

Configure and update database settings:


cp ./redmine/config/configuration.yml.example ./redmine/config/configuration.yml
cp ./redmine/config/database.yml.example ./redmine/config/database.yml

Please open the database.yml file and update username/password:


nano ./redmine/config/database.yml

production:
adapter: mysql2
database: redmine
host: localhost
username: dbuser
password: "dbpassword"
encoding: utf8

STEP 6: Gems Installation


cd /opt/redmine/redmine
echo "gem 'puma'" >> Gemfile.local
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
gem install bundler
bundle install --without development test postgresql sqlite

STEP 7: Prepare the database


rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data

STEP 8: Make Puma configuration

Create a new configuration file for puma:


nano /opt/redmine/redmine/config/puma.rb

Add below contents:


#!/usr/bin/env puma
# Define app path
application_path = '/opt/redmine/redmine'
directory application_path
environment 'production'
daemonize true
pidfile "#{application_path}/tmp/pids/puma.pid"
state_path "#{application_path}/tmp/pids/puma.state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
# Bind on port
bind "tcp://0.0.0.0:5000"

STEP 9. Start Puma

You can start the puma server by using the following command :


cd /opt/redmine/redmine/ && bundle exec puma --config config/puma.rb

You should be able to see below output after running above command:


Puma starting in single mode...
* Version 3.11.3 (ruby 2.4.1-p111), codename: Llamas in Pajamas
* Min threads: 0, max threads: 16
* Environment: production
* Daemonizing...

Finally it’s done. Redmine is successfully installed on your Ubuntu instance. You can see your redmine installation running at: http://ip-address:5000

Add a Comment

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