Software developer stories
en de

Installing Redmine 3.0 on clean Ubuntu 14.04

In this tutorial we will install Redmine on a clean installation of Ubuntu server 14.04 with an Apache server and MySql. Redmine wil be reachable under the subdomain

Here Redmine will be installed to /var/www/vhosts/redmine. I use unzip to unpack the archive. The placeholder for the username you’re logged into the system is $sysUser$.

Step 1 – Installing required softwar

First we need to update our packages.If you encounter any problems later on try to fix them by updating your packages again.

sudo apt-get update && sudo apt-get -y upgrade

Now install apache2 and mysql:

sudo apt-get install apache2 mysql-server mysql-client

While installing mysql-server you will be asked for a MySql root password to set.

Step 2 – Database creation

To create the database log in as root user with the password you set earlier.

mysql -u root -p

The following MySql queries create the database and the user to access this database. Be sure you have my_password replaced with another password (not the root password) before executing.

GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'my_password';

To exit mysql simply type exit and execute.

Step 3 – Downloading Redmine

Now switch in your vhosts directory download Redmine and unzip it. If you want you can use the .tar.gz file with the tar command as well.

cd /var/www/vhosts
mv redmine-3.0.1 redmine

Step 4 – Database configuration

We need to alter the file /var/www/vhosts/redmine/config/database.yml.example and save it as database.yml. Replace my_password with the password set in the MySql query before.

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

If your MySql server is running on another Port (e.g. 3344) you can use the following config:

adapter: mysql
database: redmine
host: localhost
port: 3344
username: redmine
password: my_password

Step 5 – Installing ruby

First we have to remove the old version of ruby.

sudo apt-get remove ruby

Execute the following command (not as root user) with the ‚\‘ at the beginning. It will install ruby at your system, usable for every user in the group rvm. The installation folder is /usr/local/rvm.

\\curl -sSL | sudo bash -s stable --rails

In my case the first run failed because of a missing signature. The command to install this signature will be displayed in the error-message. In my case it was this:

sudo gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Then rerun the command to install ruby.

After some time ruby is installed with rails.

Now the users $sysUser$ and www-data need to be added to the group rvm.

sudo usermod -aG rvm $sysUser$
sudo usermod -aG rvm www-data

After a relogin the change should be applyed. You have to switch folders back to your Redmine folder.

gem install bundler
bundle install --without development test rmagick

If you encounter any problems with mysql during installation execute sudo apt-get install libmysqlclient-dev. Then execute the command again.

Step 6 – Configuring Redmine with ruby

Generate a secret cookie token:

bundle exec rake generate_secret_token

Create the database structure:

RAILS_ENV=production bundle exec rake db:migrate

Insert the default configuration:

RAILS_ENV=production bundle exec rake redmine:load_default_data

Start the webrick server to test if everything is ok. You can access the webrick server from localhost only, so its ok if it throws no errors while starting. Then shutdown the webrick server.

bundle exec ruby bin/rails server webrick -e production

Step 7 – Installing passenger

Because the repository version of passenger will install the old ruby from the repository again, we have to install it via gem.

gem install passenger

Now we have to install some other packages, required for passenger integration in apache2:

sudo apt-get install libcurl4-openssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev

Then execute the following commands to install the passenger module to apache2.

sudo -i

Alter the file /etc/apache2/mods-avaiable/passenger.load to this:


LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.0.5/buildout/apache2/

And the file /etc/apache2/mods-available/passenger.conf to this:


<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.0.5
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.0/wrappers/ruby

Now enable the passenger mod:

a2enmod passenger

Step 8 – Configuring Apache

To reach redmine under we have to create a new file in /etc/apache2/sites-avaiable. I called the file

<VirtualHost *:80>

    # !!! Be sure to point DocumentRoot to 'public'!
    DocumentRoot /var/www/vhosts/redmine/public
    <Directory /var/www/vhosts/redmine/public>
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews

        Require all granted

To activate the site execute a2ensite and rename the file /var/www/vhosts/redmine/public/dispatch.fcgi.example to dispatch.fcgi. Now restart apache2 via sudo service apache2 restart.

Everything should be up and running.