HowTo Install Redmine 212 in Ubuntu 1210 and Apache Passenger » History » Version 8

Version 7 (ian stoddart, 2012-12-19 12:25) → Version 8/14 (Roland Giesler, 2013-01-18 14:48)

h1. HowTo Install Redmine 212 in Ubuntu 1210 and Apache Passenger

Inspired in "HowTo Install Redmine 210 on Debian Squeeze with Apache Passenger", from this same wiki, so meta-kudos, to the original authors.

h2. Assumptions

* We will be using redmine.example.com; so every time you see this below, replace it by your own domain
* For this to work maybe you shold edit /etc/hosts file adding a line "127.0.0.1 redmine.example.com"
* If you are behind a proxy, you could do export http_proxy="http://proxy.domain.tld:port" and the installation should work ok.

h2. Warming up

We will first need to install basic packages:
<pre>
apt-get install ruby rubygems libruby libapache2-mod-passenger ruby-dev
</pre>
Download the latest version of Redmine (2.1.2 in our case) and untar it, then move it to /usr/local/share
<pre>
cd /usr/local/share/
wget http://rubyforge.org/frs/download.php/76495/redmine-2.1.2.tar.gz
tar -xzvf redmine-2.1.2.tar.gz
ln -s /usr/local/share/redmine-2.1.2 /usr/local/share/redmine
chown -R root:root /usr/local/share/redmine-2.1.2
</pre>

Install development libraries for MySQL and Imagick:
<pre>
apt-get install libmysqlclient-dev libmagickcore-dev libmagickwand-dev (install shitload of packages)
</pre>

h2. Running the Gem stuff

Install Bundler (removing useless module, which would otherwise create dependencies):
<pre>
gem install bundler
cd /usr/local/share/redmine/
bundle install --without development test postgresql sqlite
</pre>

Install mysql2-adapter
<pre>
gem install activerecord-mysql2-adapter
</pre>

h2. Creating the database

On a new installation you need to create the database and a user for redmine.
Open a mysql command prompt:
<pre>
mysql -u root -p
</pre>

At the mysql prompt enter the mysql commands:
<pre>
create user 'redmine' identified by 'redmine';
set password for 'redmine'@'localhost' = password('my_password');
grant all on *.* to 'redmine'@'localhost';
create database redmine;
quit;
</pre>

h2. Configuration

Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.
Example for a MySQL database using ruby1.8 or jruby:
<pre>
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: my_password
</pre>

Generate a session store secret:
<pre>
rake generate_secret_token
</pre>

Generate the database structure:
<pre>
RAILS_ENV=production rake db:migrate
</pre>

Generate default configuration data:
<pre>
RAILS_ENV=production rake redmine:load_default_data
</pre>
(using “es” for Spanish language in terminal prompt)

Setup config file in config/configuration.yml

Change database_ciphr_key: *******
<pre>
rake db:encrypt RAILS_ENV=production
</pre>

h2. Apache

Setup Apache’s VirtualHost config

<pre>
# 8080 in this case is because we use a reverse proxy before Apache. Otherwise simply use "*:80"

<VirtualHost *:8080>
ServerName redmine.example.com
DocumentRoot /usr/local/share/redmine/public
<Directory /usr/local/share/redmine/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
</pre>

Once you enable this virtual host (a2ensite redmine.example.com) and reload Apache (apache2ctl graceful), you should see your site running on http://redmine.example.com.

The default login/password is admin/admin (don't forget to change this).

h2. Sources of inspiration

We used the following resources as a starting point. Thanks to their respective authors.

* http://madpropellerhead.com/random/20100820-installing-redmine-on-debian-with-apache (outdated, for Lenny)
* http://www.redmine.org/projects/redmine/wiki/RedmineInstall
* http://hodza.net/2012/03/15/howto-install-redmine-on-debian-6-squeeze-ruby-on-rails-apache2-passenger/
* http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Debian_with_Ruby-on-Rails_and_Apache2-Passenger