Redmine installation on CentOS 5

1. Initial Steps

yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc ruby-mysql

Download and install ruby gems (v1.3.1 mirror)

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xzf rubygems-1.3.1.tgz
cd rubygems-1.3.1
ruby setup.rb

2. Install Rails

gem install rails

Obtain stable RedMine 0.9.x from redmine.org (rubyforge, v0.8.5 mirror)

tar -C /var/www -xzf redmine-xxx.tar.gz
mv /var/www/redmine-xxx /var/www/redmine
chown -R root:root /var/www/redmine

Note: rackup v1.0.1 produced the warning "/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:170: warning: parenthesize argument(s) for future version", so I patched it by substituting the line 170

options.merge! opt_parser.parse! args

with

options.merge!(opt_parser.parse!(args))

3. Create database for Redmine

mysql -u root -pXXX
 create database redmine character set utf8;
 create user redmine@localhost identified by 'pass';
 grant all privileges on redmine.* to redmine@localhost;
 flush privileges;
 exit

Configure the Redmine database connection settings.Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.

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

Edit database.yml

production:
adapter: mysql
database: redmine
host: localhost
username: yourusername
password: yourpassword

Protect this file from other users

chown root:apache database.yml
chmod 640 database.yml

4. Load default database

Recreate database objects: tables and an administrator account

cd /var/www/redmine
rake db:migrate RAILS_ENV="production"

Load default data into db. Press Enter when it asks to confirm english language.

cd /var/www/redmine
rake redmine:load_default_data RAILS_ENV="production"

5. Running under Apache (preferred method)

Install passenger aka mod_rails

yum install httpd-devel apr-devel gcc gcc-c++
gem install passenger
passenger-install-apache2-module

Presss Enter where it asks. It will compile and install Apache module.

Create a user to run redmine (I prefer "apache") and set up permissions

cd /var/www/redmine
chown -R root:root .
mkdir tmp public/plugin_assets
chown -R apache:apache files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

Now tell passenger under which user to run

chown -R apache:apache config/environment.rb

Create the Apache redmine configuration snippet (see mod_rails user guide)

LoadModule passenger_module
     /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /usr/bin/ruby

If you want to run Redmine in a separate virtual host, use the following configuration snippet:

<VirtualHost *:80>
 ServerName redmine.ourdom.com:80
 DocumentRoot /var/www/redmine/public
 RailsEnv production
</VirtualHost>

If you want to run Redmine in sub-URI /your_redmine_prefix of an existing virtual host with document root in /var/www/your_doc_root, first create a symbolic link:

ln -s /var/www/redmine_root_directory/public /var/www/your_doc_root/your_redmine_prefix

and add the following to the virtual server configuration

DocumentRoot /var/www/your_doc_root
RailsBaseURI /your_redmine_prefix

By default the rails passenger module will clear ruby code cache after 10 idle minutes, and the first http request after idle timeout will appear slow due to ruby respawning. To avoid this, add the following lines to the apache configuration, if you have enough server memory:

RailsSpawnMethod smart
RailsFrameworkSpawnerIdleTime 0
RailsAppSpawnerIdleTime 0

Restart Apache and point your browser to http://redmine.ourdom.com/. You should now see the application welcome page. Use default administrator account to log in:

login: admin
password: admin

You can go to Admin & Settings to modify application settings.

6. Running as a daemon (alternative way)

Install mongrel to daemonize ruby. You can either use CentOS repository:

yum install rubygem-mongrel rubygem-mongrel_cluster rubygem-daemons

Or if you want latest and greatest, use ruby gems:

gem install mongrel mongrel_cluster daemons

Create a user to run redmine and set up permissions

cd /var/www/redmine
chown -R root:root .
mkdir tmp public/plugin_assets
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

Create the /etc/init.d/redmine init script based on redmine wiki:

Set redmine user name in the script.

chmod 755 /etc/init.d/redmine
chkconfig redmine on
service redmine restart

Test the installation by running WEBrick web server:

ruby script/server -e production

Once WEBrick has started, point your browser to http://localhost:3000/. You should now see the application welcome page.Use default administrator account to log in:

login: admin
password: admin

You can go to Admin & Settings to modify application settings.

7. SMTP

Configure SMTP. Copy config/email.yml.example to config/email.yml and adjust SMTP settings.
Protect this file from other users

chown root:apache email.yml
chmod 640 email.yml

Appropriately setup your mail server.

Attachments

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
To prevent automated spam submissions leave this field empty.