Ubuntu To Debian Upgrade Issues

If you have received following message from dreamhost on VPS upgrade and your Ruby apps are broken then here are few tips that might save your day. “We will be upgrading your Virtual Private Server from version 14.04 (also known as trusty) to Debian 9.12 (aka Stretch!) “. Yes as they mentioned in their email that there are some environment changes that effect your system if you are using Ruby, Python, PHP, or run a site that relies heavily on specific server packages. Lets start with Ubuntu To Debian Upgrade Issues on VPS of Dreamhost.

This post will help you only if you have already installed redmine on dreamhost VPS and your server is now upgraded to Debain Stretch.

SVN Write Issue on Debian Stretch

First error you will see is, related to SVN. If you have SVN on VPS then your will see that you do not have write permission anymore. To solve this you can go to more -> subversion, select the SVN repo, click on edit and then click on update my repo now. Check your write permissions after 5-10 minutes.

If this trick did not help you, then please write to dreamhost support team and they will change the settings from backend.

Django MySQL Issue

If you are running application with Django and MySQL as database then with this upgrade it will not work.

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient.so.18: cannot open shared object file: No such file or directory.
Did you install mysqlclient or MySQL-python?

As per suggested solution by deleting pip .cache directory, it will still shows error. For this issue we did not found solution yet, but as workaround we have created backup databse in sqlite and started using Django with sqlite. Please note with Ubuntu 14.04, Sqlite was not working so we have no choice other than to use MySQL, but with this new server upgrade Sqlite is working.

Ruby Apps Issue On Debain VPS

First issue you will encounter is openssl issue on Debian server. This is because openssl library is changed on the Debian Stretch server. You will need to reinstall the version of ruby that you had with rvm which was installed on Ubuntu. Once this is done you need to install ruby gems again to allow your rails site to work.

$gem list
Error loading RubyGems plugin "/home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/rubygems_plugin.rb": libssl.so.1.0.0: cannot open shared object file: No such file or directory - /home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/x86_64-linux/openssl.so (LoadError)
Error loading RubyGems plugin "/home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/gem-wrappers-1.4.0/lib/rubygems_plugin.rb": libssl.so.1.0.0: cannot open shared object file: No such file or directory - /home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/x86_64-linux/openssl.so (LoadError)

To solve this error, you need to uninstall rvm and re-install.

$ rvm uninstall 2.6.0
$ rvm install 2.6.0

Now reinstall bundler and then reinstall your old gems else you could see following errors

find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/ilmp_app/ilmp.neudeep.com/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, run bundle update –bundler . To install the missing version, run gem install bundler:2.1.4`

$ gem install bundler
$ bundle update

Now you are all set to run the ruby application. Bundle update will take care of mysql2 issue as well.

 when i start my application it is giving me error for libmysqlclient.so 
/home/spsm01/.rvm/gems/ruby-2.6.0/gems/mysql2-0.5.2/lib/mysql2.rb:33:in `require': libmysqlclient.so.18: cannot open shared object file: No such file or directory - /home/spsm01/.rvm/gems/ruby-2.6.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.so (LoadError)

Once you re-install as per above instructions your Django and Ruby application on the newly upgraded server should work as normal. Thats all Ubuntu To Debian Upgrade Issues we have faced, let us know if you have faced any new issues apart from above mentioned one.

Install Redmine on DreamHost VPS Server

Recently we moved to dreamhost VPS server and signed in for 3 year service. We were using redmine in our projects for handling project management activities. After successful installation of latest redmine release on local server, it was time to move on to install and test it on webservers. But when we contacted Dreamhost support they have standard reply,

Thank you for writing into DreamHost Support!

Unfortunately, we cannot assist with custom configs for that application,
My apologies. If you need root access for the install then you would need
to use a dedicated server or DreamCompute and that would not be allowed on your current VPS.

Dreamhost Support Reply

There are multiple resources available across the web about Redmine on Dreamhost, but they’re all quite outdated. Well redmine is flexible project management web application and is free to use opensource software. We did not stop here, as we were so much impressed with capabilities of redmine for project management and reporting. So we have started with installation of ruby on rails on VPS (virtual private server).

Step 0 – Pre-Build

  1. Enable Passenger (Ruby/NodeJS/Python apps only) under ‘domains’->’Manage Domains’ from dreamhost cpanel
  2. Install RVM (Ruby version Manager) using steps mentioned in dreamhost help center
  3. Install ImageMagick current gem as redmine requires it and DreamHost servers don’t have it
    1. mkdir src && cd src
    2. Get latest source from imagemagic website using $ wget http://www.imagemagick.org/download/
    3. mkdir ~/lib
    4. tar xfz ImageMagick-7.0*
    5. Now navigate to ImageMagick-7.0* folder and configure
    6. ./configure –prefix=/home/username/lib/ImageMagick-7.0.8-68
    7. make
    8. make install
    9. export PKG_CONFIG_PATH=’/home/username/lib/ImageMagick-7.0.8-68/lib/pkgconfig’
    10. export C_INCLUDE_PATH=’/home/username/lib/ImageMagick-7.0.8-68/include’
    11. source ~/.bash_profile
  4. Download latest redmine archive and decompress it in /public folder
    1. wget http://www.redmine.org/releases/redmine-4.0.4.tar.gz
    2. tar xfz redmine-4.0.4.tar.gz –strip-components=1
  5. Install dependencies –
    1. $ gem install bundler
    2. $ bundle install
  6. If you are still getting issue with ImageMagick then bypass rmagick and continue
    1. bundle install –without development test rmagick
  7. Generate session store key
    1. $ bundle exec rake generate_secret_token
  8. After this command, if your VPS is Debian 9.12 (aka Stretch) you will get following error, but don’t worry, just run – $ bundle update
$ bundle exec rake generate_secret_token
Could not find gem 'mysql2 (~> 0.5.0)' in any of the gem sources listed in your Gemfile.

All above steps are required if you are using Dreamhost VPS/Shared server, If you are using dedicated servers then above tricks are not required for you.

Step 1 – Create Database

Create empty database using ‘MySQL database’ section of cpanel from dreamhost. This will create database and hostname, Note down these details along with username and password, as these are required in next step.

Step 2 – Configure Database

Configure the database in config/database.yml file, first rename ‘database.yml.example’ to ‘database.yml’. Open this configuration file and enter details as noted in step 1. The ‘database.yml’ file should look as below,

production:
adapter: mysql2
database: <db_name from step1>
host: <host_name from step1>
username: <user_name from step1>
password: <user_password from step1>

Step 3 – Migrate Database and Load Defaults

Create the database structure by running the redmine migrations

$  RAILS_ENV=production rake db:migrate

OR

$ bundle exec rake db:migrate

At this moment, if you see issue with Sprockets, use steps to upgrade sprockets and you are good to go for final rake command.

rake aborted!
Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js`

It is easy as mentioned in the error log also, just create ‘ app/assets/config/manifest.js’ and copy below three lines in manifest file

//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

Step 4 – Final Rake Command

$RAILS_ENV=production bundle exec rake redmine:load_default_data

Now test your redmine server using wbrick command.

$bundle exec rails server webrick -e production
http://<host_name>:3000/ 
Redmine on VPS server of Dreamhost

Step 5 – (Optional) Run webrick service as background process

With webrick running in background you need not to start the server again and it runs even after you close the session.

$ruby script/server webrick -e production -du
Or Try following  
$ruby script/server webrick -e development -d

Step 6 – Configuration Steps For Apache Server

1. You need to modify two files for apache. The first is /etc/apache2/mods-available/passenger.conf which needs the text PassengerDefaultUser www-data added as seen below.
<IfModule mod_passenger.c>
PassengerDefaultUser www-data
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>

2. Now create a symlink to connect Redmine into the web document space:

$ sudo ln -s /home/ilmp_redmine/<PWD>/public /var/www/html/redmine
3. And modify /etc/apache2/sites-available/000-default.conf as follows
<Directory /var/www/html/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
4. Create and set the ownership of a Gemfile.lock file so that apache’s www-data user can access it:
$ sudo chown www-data:www-data /home/ilmp_redmine/<PWD>/public/Gemfile.lock

5. Now restart apache:

$ sudo service apache2 restart

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

Thank you for reading this post about ‘install redmine on VPS’ happy redmining using dreamhost.

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”

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

Install Review Board on Ubuntu Linux System

Review Board as their website mentions it really takes the pain out of code review. It is one of the widely used open source software tool for your code reviews. Using tool like Review Board save lot of time in review. This post describes review board version 3.0.14 installation steps on fresh system along with the solution for Bad Request (400) message. Yes, On fresh Ubuntu system once installation is complete this Review board shows up this error. Lets start with installation steps.

Step 1 – Install MySQL and Apache

Assuming this is fresh Linux system and MySQL Apache is not installed yet follow below steps.

$sudo apt-get install mysql-server

$sudo apt-get install apache2 libapache2-mod-wsgi

Create empty database for review board

Use following Reviewboard mysql commands

mysql> CREATE DATABASE reviewboard CHARACTER SET utf8;

Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER ‘$USER’@’localhost’ IDENTIFIED BY ‘Password’

mysql> CREATE USER ‘$USER’@’localhost’ IDENTIFIED BY ‘Password’;

Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON reviewboard.* to ‘$USER’@’localhost’;

Query OK, 0 rows affected (0.00 sec)

Step 2 – Install Dependencies

$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

$python get-pip.py

$ pip install -U pip setuptool
$ apt-get install build-essential python-dev libffi-dev libssl-dev patch

$sudo apt-get install python-mysqldb
$sudo apt-get install memcached
$sudo apt-get install python-memcache

Step 3 – Install Review Board

$sudo apt-get install patch 
$sudo apt-get install subversion
$sudo apt-get install python-svn
$sudo apt-get install python-setuptools
$sudo easy_install reviewboard

$sudo rb-site install /var/www/reviews.com

chown -R www-data /var/www/reviews.com/htdocs/media/uploaded 
chown -R www-data /var/www/reviews.com/htdocs/media/ext
chown -R www-data /var/www/reviews.com/htdocs/static/ext
chown -R www-data /var/www/reviews.com/data

$cd /etc/apache2/sites-available
$cd /etc/apache2/sites-available

$cp /var/www/reviews.com/conf/ reviews.com.conf

$cd ../sites-enabled

$ln -s ../sites-available/reviews

Start review board
sudo a2dissite default
sudo a2ensite reviews.com.conf
sudo /etc/init.d/apache2 restart

Accessing url:=== http://192.168.206.24/reviews.

if you are getting following error

[Mon Mar 25 17:48:45.230130 2019] [mpm_event:notice] [pid 20381:tid 139766387678144] AH00491: caught SIGTERM, shutting down

[Mon Mar 25 17:48:45.313877 2019] [mpm_event:notice] [pid 20717:tid 139964285795264] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 configured — resuming normal operation and

Bad Request (400) message.

This is a very important step; Open ‘settings_local.py’ and make following change

$sudo vi /var/www/reviewboard/conf/settings_local.py

ALLOWED_HOSTS = [‘reviewboard’]

To

ALLOWED_HOSTS = [‘*’]

Thats it your reviewboard ver. 3.0.14 is up and running. Happy reviewing!!!

Redmine Could Not Spawn Process Error Solved

Redmine is popular open source project management tool used as project monitoring and tracking tool. After recent update of bundler, redmine was not starting. We are using Redmine on Ubuntu from past one month without any issue, suddenly it was not starting. When we checked production log file under ‘ /var/log/redmine/default/'

We could see following error –

[ 2016-02-24 08:25:17.8434 6628/7efdf3c1e700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/redmine: An error occurred while starting up the preloader: it did not write a startup response in time.

Message from application: Bundler could not find compatible versions for gem "bundler":

In Gemfile:

rails (~> 4.2.8) was resolved to 4.2.10, which depends on

bundler (< 2.0, >= 1.3.0)

Current Bundler version:

bundler (2.0.1)

This Gemfile requires a different version of Bundler.

Perhaps you need to update Bundler by running `gem install bundler`?

We have tried to update Bundler as per suggestion but no luck getting same error. So actual issue was with passenger.

To debug this issue we have started Redmine without passenger, navigate to redmine install folder/directory and execute following command.

$rails server webrick -e production

or

$rails server webrick -p 3001 -e production 

And it worked.

Following is Redmine environment

[redmine]$ sudo ruby bin/about 
sh: 1: darcs: not found
sh: 1: hg: not found
sh: 1: bzr: not found
Environment: Redmine version 3.4.4.stable
Ruby version 2.5.1-p57 (2018-03-29) [x86_64-linux-gnu]
Rails version 4.2.10
Environment production
Database adapter Mysql2
SCM:
Subversion 1.9.7
Cvs 1.12.13
Git 2.17.1 Filesystem
Redmine plugins:
no plugin installed

Happy bugging.

Check out our services and offerings at RedmineLab.com

How To Install SVN Server On Ubuntu 18.04

In every software project there is need for version control system. Here we will list out steps for install SVN server on Ubuntu machine.

Install Apache

sudo apt-get update

sudo apt-get install apache2

sudo systemctl start apache2

Install Apache Subversion

sudo apt-get install subversion libapache2-mod-svn

sudo apachectl -M

sudo a2enmod dav

sudo a2enmod dav_svn

sudo a2enmod authz_svn

sudo service apache2 restart

Create SVN Repository

Most common places for Subversion repository are: /srv/svn, /usr/local/svn and /home/svn. Here we will assume /home/svn as repository

sudo mkdir /home/svn

Create svn repository. Here we create a repository called “IEC1000”

sudo svnadmin create /home/svn/IEC1000

change ownership and permissions

sudo chown -R www-data:www-data /home/svn/IEC1000/

sudo chmod -R 775 /home/svn/IEC1000

If you are using windows system use "TortoiseSVN" to create repository and add files/folders to SVN. 

If you are using Linux system use "rabbit SVN" to create repository.

sudo apt-get install rabbitvcs-nautilus

Access via WebDAV protocol (http://)

First install the package libapache2-svn then add the following snippet in your /etc/apache2/mods-available/dav_svn.conf file:

<Location /svn>
DAV svn
SVNPath /home/svn/IEC1000
AuthType Basic
AuthName "myproject subversion repository"
AuthUserFile /etc/subversion/passwd
Require valid-user
</Location>
Create first user and passwd file using following command 
sudo htpasswd -cm /etc/subversion/passwd user_name1
create second user and onward using following command  
sudo htpasswd -m /etc/subversion/passwd user_name2

Restart Apache

sudo systemctl restart apache2

Now you can test configured SVN using local host with following URL on browser,

http://localhost/svn/IEC1000

Schedule Repository Backup

Create a backup folder.

sudo mkdir -p /etc/backcups

Change user to root user.

sudo su -

Edit crontab.

crontab -e

In the following command, we schedule svn backup midnight every day.

0 0 * * * svnadmin dump /home/svn/IEC100 > /etc/backcups/svnbackups-$(date +%Y%m%d).dump

If you need to restore svn repository from backup file use below commands.

Create a new repository.

svnadmin create /home/svn/restorerepo

Restore backup:

svnadmin load /home/svn/restorerepo < /etc/backups/svnbackups-20190204.dump