You are here
Home > LinuxAdmin >

Install Redmine On Ubuntu With Solved Gem BuildError

This post describes in detail on howto install Redmine latest version on Ubuntu 18.04 -x86_64 GNU/Linux system. Redmine is one of the most widely used open source software tool and platform for project management, issue tracking and project execution. With lot of freely available plugins one can also use Redmine as CMS, Invoicing, finance, HR and most of the activities that are involved in small scale software company. If you are startup company and looking for all in one tool Redmine is answer.

This guide is little bit lengthy as there are few workaround during installation, so grab your coffee before you start.

If your system does not have apache server installed then follow step 1, else skip to step 2.

To ensure apache server is installed and running open any webbrowser like mozilla, chrome and type ‘localhost’ if you see “can’t establish a connection to the server at localhost” then you need to install apache else you will see “Apache2 Ubuntu Default Page”

Contents

Step 1: Install Apache2 Server on Ubuntu

$sudo apt install apache2 libapache2-mod-passenger

Now that Apache2 is installed, to test whether the web server is working, open your browser and type http://localhost

you will see “Apache2 Ubuntu Default Page”

Step 2 – Get Redmine application

Get the Redmine source code by either downloading a packaged release from download page.

Copy this file to /usr/share

$sudo cp redmine-4.0.3.tar.gz /usr/share/

Then to unpack a tar.gz file, use the tar command from the shell

$sudo tar -xvzf redmine-4.0.3.tar.gz

And remove redmine-4.0.3.tar.gz file from /usr/share. You can now see following folder structure

Redmine 4.0.3 folder structure

you can also check out stable redmine version from svn , by running below command,

$svn co https://svn.redmine.org/redmine/branches/4.0-stable redmine-4.0

Step 3 – Install MySQL and Create an empty Redmine database

Create MySQL database with user name as ‘redmine’

Assuming this is fresh Ubuntu 18.04.2 LTS and MySQL is not installed, execute following command to install MySQL

/usr/share/redmine-4.0.3$ sudo apt-get install mysql-server mysql-client

Once installed check out MySQL version

/usr/share/redmine-4.0.3$ mysql –version

mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper, Redmine 4.0 does not support for MySQL < 5.5

Note-

Then create empty database – To do this change to sudo user and execute mysql commands as listed out below.

$sudo -i
$mysql 
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
Query OK, 1 row affected (0.01 sec)

mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my password';
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
Query OK, 0 rows affected (0.02 sec)

Step 4 – Database Configuration

Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment.

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "my_password" 

Step 5 – Dependencies installation

This is step you will need coffee 🙂 make sure you have refilled your cup. install Bundler

/usr/share/redmine-4.0.3 $sudo gem install bundler

Then install required Redmine gems, there are 59 gems required at this step

/usr/share/redmine-4.0.3$sudo bundle install --without development test

/usr/share/redmine-4.0.3$ sudo bundle install --without development test 
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`. Fetching gem metadata from https://rubygems.org/................ Fetching gem metadata from https://rubygems.org/.. Resolving dependencies...
Fetching rake 12.3.2
Installing rake 12.3.2
Fetching concurrent-ruby 1.1.5
Installing concurrent-ruby 1.1.5
Fetching i18n 0.7.0
Installing i18n 0.7.0
Fetching minitest 5.11.3
Installing minitest 5.11.3
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.5
Installing tzinfo 1.2.5
Fetching activesupport 5.2.2.1
Installing activesupport 5.2.2.1
Fetching builder 3.2.3
Installing builder 3.2.3
Fetching erubi 1.8.0
Installing erubi 1.8.0
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching nokogiri 1.10.3
Installing nokogiri 1.10.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.10.3/ext/nokogiri /usr/bin/ruby2.5 -r ./siteconf20190424-9657-1w4lnbg.rb extconf.rb mkmf.rb can&apos;t find header files for ruby at /usr/lib/ruby/include/ruby.h extconf failed, exit code 1

Well this is first encounter ‘nokogiri’ has failed To solve this error mannually install ‘nokogiri’ after installing following dependencies

/usr/share/redmine-4.0.3 $sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
/usr/share/redmine-4.0.3$ sudo gem install nokogiri -v 1.10.3 

Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.3
Parsing documentation for nokogiri-1.10.3
Installing ri documentation for nokogiri-1.10.3
Done installing documentation for nokogiri after 2 seconds
1 gem installed

Now continue with installing dependencies, Check out our services and offerings at RedmineLab.com

/usr/share/redmine-4.0.3$ sudo bundle install --without development test
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.5
Using i18n 0.7.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2.1
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.3
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.4
Installing crass 1.0.4
Fetching loofah 2.2.3
Installing loofah 2.2.3
Fetching rails-html-sanitizer 1.0.4
Installing rails-html-sanitizer 1.0.4
Fetching actionview 5.2.2.1
Installing actionview 5.2.2.1
Fetching rack 2.0.7
Installing rack 2.0.7
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.2.2.1
Installing actionpack 5.2.2.1
Fetching nio4r 2.3.1
Installing nio4r 2.3.1 with native extensions
Fetching websocket-extensions 0.1.3
Installing websocket-extensions 0.1.3
Fetching websocket-driver 0.7.0
Installing websocket-driver 0.7.0 with native extensions
Fetching actioncable 5.2.2.1
Installing actioncable 5.2.2.1
Fetching globalid 0.4.2
Installing globalid 0.4.2
Fetching activejob 5.2.2.1
Installing activejob 5.2.2.1
Fetching mini_mime 1.0.1
Installing mini_mime 1.0.1
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 5.2.2.1
Installing actionmailer 5.2.2.1
Fetching method_source 0.9.2
Installing method_source 0.9.2
Using thor 0.20.3
Fetching railties 5.2.2.1
Installing railties 5.2.2.1
Fetching actionpack-xml_parser 2.0.1
Installing actionpack-xml_parser 2.0.1
Fetching activemodel 5.2.2.1
Installing activemodel 5.2.2.1
Fetching arel 9.0.0
Installing arel 9.0.0
Fetching activerecord 5.2.2.1
Installing activerecord 5.2.2.1
Fetching mimemagic 0.3.3
Installing mimemagic 0.3.3
Fetching marcel 0.3.3
Installing marcel 0.3.3
Fetching activestorage 5.2.2.1
Installing activestorage 5.2.2.1
Fetching public_suffix 3.0.3
Installing public_suffix 3.0.3
Fetching addressable 2.6.0
Installing addressable 2.6.0
Using bundler 2.0.1
Fetching css_parser 1.7.0
Installing css_parser 1.7.0
Fetching csv 3.0.9
Installing csv 3.0.9
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching mysql2 0.5.2
Installing mysql2 0.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/mysql2-0.5.2/ext/mysql2
/usr/bin/ruby2.5 -I /usr/local/lib/site_ruby/2.5.0 -r ./siteconf20190424-20515-dxgpwf.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
checking for -lmysqlclient... no

This is second encounter of builderror, here mysql client is missing. You need to install mysql client by running following command

/usr/share/redmine-4.0.3$apt-get install libmysqlclient-dev
/usr/share/redmine-4.0.3$ sudo bundle install --without development test
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.5
Using i18n 0.7.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2.1
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.3
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 5.2.2.1
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.2.1
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.7.0
Using actioncable 5.2.2.1
Using globalid 0.4.2
Using activejob 5.2.2.1
Using mini_mime 1.0.1
Using mail 2.7.1
Using actionmailer 5.2.2.1
Using method_source 0.9.2
Using thor 0.20.3
Using railties 5.2.2.1
Using actionpack-xml_parser 2.0.1
Using activemodel 5.2.2.1
Using arel 9.0.0
Using activerecord 5.2.2.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.2.1
Using public_suffix 3.0.3
Using addressable 2.6.0
Using bundler 2.0.1
Using css_parser 1.7.0
Using csv 3.0.9
Using htmlentities 4.3.4
Fetching mysql2 0.5.2
Installing mysql2 0.5.2 with native extensions
Fetching net-ldap 0.16.1
Installing net-ldap 0.16.1
Fetching ruby-openid 2.3.0
Installing ruby-openid 2.3.0
Fetching rack-openid 1.4.2
Installing rack-openid 1.4.2
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Fetching sprockets-rails 3.2.1
Installing sprockets-rails 3.2.1
Fetching rails 5.2.2.1
Installing rails 5.2.2.1
Fetching rbpdf-font 1.19.1
Installing rbpdf-font 1.19.1
Fetching rbpdf 1.19.8
Installing rbpdf 1.19.8
Fetching redcarpet 3.4.0
Installing redcarpet 3.4.0 with native extensions
Fetching request_store 1.0.5
Installing request_store 1.0.5
Fetching rmagick 2.16.0
Installing rmagick 2.16.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
ERROR:  Error installing rmagick:
    current directory: /var/lib/gems/2.5.0/gems/rmagick-2.16.0/ext/RMagick
/usr/bin/ruby2.5 -I /usr/local/lib/site_ruby/2.5.0 -r ./siteconf20190424-21434-cp20lm.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc&apos;
to the PKG_CONFIG_PATH environment variable
No package &apos;MagickCore&apos; found
checking for outdated ImageMagick version (<= 6.4.9)... *** extconf.rb failed ***

This is third and last encounter of BuildError and it is for RMagick, one can continue without RMagic by running following command.

RMagick (allows the use of ImageMagick to manipulate images for PDF and PNG export)

If you want to skip the installation of the rmagick gem, then execute below command:

/usr/share/redmine-4.0.3 $sudo bundle install --without development test rmagick

Else you can install ImageMagick after installing its dependency as follows

/usr/share/redmine-4.0.3 $sudo apt-get install libmagickwand-dev
/usr/share/redmine-4.0.3$ sudo gem install rmagick 
Fetching rmagick-3.1.0.gem Building native extensions.
This could take a while...
Successfully installed rmagick-3.1.0
Parsing documentation for rmagick-3.1.0 Installing ri documentation for rmagick-3.1.0
Done installing documentation for rmagick after 1 seconds
1 gem installed
/usr/share/redmine-4.0.3$ sudo bundle install --without development test 
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/............. Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.5
Using i18n 0.7.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2.1
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.3
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 5.2.2.1
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.2.1
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.7.0
Using actioncable 5.2.2.1
Using globalid 0.4.2
Using activejob 5.2.2.1
Using mini_mime 1.0.1
Using mail 2.7.1
Using actionmailer 5.2.2.1
Using method_source 0.9.2
Using thor 0.20.3
Using railties 5.2.2.1
Using actionpack-xml_parser 2.0.1
Using activemodel 5.2.2.1
Using arel 9.0.0
Using activerecord 5.2.2.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.2.1
Using public_suffix 3.0.3
Using addressable 2.6.0
Using bundler 2.0.1
Using css_parser 1.7.0
Using csv 3.0.9
Using htmlentities 4.3.4
Using mysql2 0.5.2
Using net-ldap 0.16.1
Using ruby-openid 2.3.0
Using rack-openid 1.4.2
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.2.2.1
Using rbpdf-font 1.19.1
Using rbpdf 1.19.8
Using redcarpet 3.4.0
Using request_store 1.0.5
Fetching rmagick 2.16.0
Installing rmagick 2.16.0 with native extensions
Fetching roadie 3.4.0
Installing roadie 3.4.0
Fetching roadie-rails 1.3.0
Installing roadie-rails 1.3.0
Fetching rouge 3.3.0
Installing rouge 3.3.0
Bundle complete! 27 Gemfile dependencies, 59 gems now installed. Gems in the groups development and test were not installed. Use `bundle info [gemname]` to see where a bundled gem is installed.

Step 6 - Database schema objects creation

Generate a random key used by Rails to encode cookies storing session data thus preventing their tampering.
$bundle exec rake generate_secret_token

Create the database structure, by running the following command under the application root directory (in my case its -/usr/share/redmine-4.0.3 $):

/usr/share/redmine-4.0.3 $RAILS_ENV=production bundle exec rake db:migrate

This step wil take some time as it creates database schema and strucutre, make sure that username and password is correct in ‘config/database.yml’ file.

/usr/share/redmine-4.0.3# RAILS_ENV=production bundle exec rake db:migrate
== 1 Setup: migrating =========================================================
-- adapter_name()
   -> 0.0000s
-- adapter_name()
   -> 0.0000s
-- adapter_name()
   -> 0.0000s
-- create_table("attachments", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
   -> 0.3043s
-- adapter_name()
   -> 0.0000s
-- adapter_name()
   -> 0.0000s
-- adapter_name()
   -> 0.0000s
-- create_table("auth_sources", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
   -> 0.2463s
-- adapter_name()
   -> 0.0000s
-- adapter_name()
   -> 0.0000s
-- adapter_name()
   -> 0.0000s
-- create_table("custom_fields", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
   -> 0.3116s
== 20170419144536 AddViewMessagesToAllExistingRoles: migrating ================
== 20170419144536 AddViewMessagesToAllExistingRoles: migrated (0.1432s) =======

== 20170723112801 RenameCommentsToContent: migrating ==========================
-- rename_column(:comments, :comments, :content)
   -> 0.1457s
== 20170723112801 RenameCommentsToContent: migrated (0.1458s) =================

== 20180913072918 AddVerifyPeerToAuthSources: migrating =======================
-- change_table(:auth_sources)
   -> 0.8880s
== 20180913072918 AddVerifyPeerToAuthSources: migrated (0.8882s) ==============

== 20180923082945 ChangeSqliteBooleansTo0And1: migrating ======================
== 20180923082945 ChangeSqliteBooleansTo0And1: migrated (0.0000s) =============

== 20180923091603 ChangeSqliteBooleansDefault: migrating ======================
== 20180923091603 ChangeSqliteBooleansDefault: migrated (0.0000s) =============

Then insert default configuration data in database, by running the following command: This step will ask to select language. In my case I have selected 'en' for English.

/usr/share/redmine-4.0.3$ RAILS_ENV=production bundle exec rake redmine:load_default_data 

Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] en ==================================== Default configuration data loaded.

Step 7 – Test The Installation

Test the installation by running WEBrick web server:

/usr/share/redmine-4.0.3$bundle exec rails server webrick -e production

http://localhost:3000/

Use default administrator account to log in:

  • login: admin
  • password: admin
Redmine 4.0.3

Above steps explains about how to install latest Redmine on Ubuntu, there is alternative to this mannual installation.

Alternative to manual installation

There is alternative to above steps, if you do not want to go for above lengthy steps one can follow Easy redmine installation stpes on Ubuntu, But keep in mind, this alternative installation step will install –Redmine 3.4.4. And most of the free plugins simply do not work on this redmine version.

Redmine 3.4.4 version

That’s it!

You have successfully installed Redmine on Ubuntu 18.04 and 18.10….

Happy bugging.

Feel free to drop a comment or email @ info@blog.neudeep.com, if you get stuck somewhere, we will try to help you as much as possible. Check out our services and offerings at RedmineLab.com

Install Plugin

Following steps explain about how to install new plugin in to make full use of Redmine. Redmine is powerfull tool but with diffrent plugins its very easy to untilize Redmine’s full power.

Navigate to ‘plugins’ directory of redmine

/usr/share/redmine-4.0.3/plugins$git clone git://github.com/deecay/redmine_pivot_table

/usr/share/redmine-4.0.3$sudo RAILS_ENV=production rake redmine:plugins:migrate

Test it using webrick server

/usr/share/redmine-4.0.3$bundle exec rails server webrick -e production

One thought on “Install Redmine On Ubuntu With Solved Gem BuildError

Leave a Reply

Top