Está en la página 1de 6

Installing Redmine on CentOS 6.2 wiht MySQL a...

http://mrtn.me/blog/2012/07/06/installing-redmin...

Geek Quickies
Stories from the cloudvergence.
RSS

RSS
Blog
Archives
About

Installing Redmine on CentOS 6.2 Wiht MySQL and Apache


Jul 6th, 2012
I needed recently to install the excellent project management tool Redmine on a CentOS 6.2 machine. There are some tutorials on the Web
(here or here) but they are a little bit outdated. The following is a method that works as of today.

Pre-requisites
Logged as root, install the following packages:
1 yum install make gcc gcc-c++ zlib-devel ruby-devel rubygems ruby-libs apr-devel apr-util-devel httpd-devel mysql-devel mysql-server automake autoconf ImageMagick ImageMag

And then install the

bundle

ruby gem:

1 gem install bundle

Install Redmine
Redmine is installed with the following commmands:
1
2
3
4
5

cd /var/www
wget http://rubyforge.org/frs/download.php/76255/redmine-1.4.4.tar.gz
tar zxf redmine-1.4.4.tar.gz
ln -s redmine-1.4.4 redmine
rm -f redmine-1.4.4.tar.gz

Install Redmine ruby dependencies


Bundle helps us install the ruby Redmine dependencies:
1 cd /var/www/redmine
2 bundle install --without postgresql sqlite test development

Database creation
First we start MySQL:
1 service mysqld start

Then we secure it (Optional):


1 mysql_secure_installation

We then create the redmine database and user:


1
2
3
4
5

$ mysql
mysql> create database redmine character set utf8;
mysql> grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
mysql> flush privileges;
mysql> quit

Redmine database conguration

1 de 6

22/04/14 23:52

Installing Redmine on CentOS 6.2 wiht MySQL a...

http://mrtn.me/blog/2012/07/06/installing-redmin...

We copy the database conguration example and we modify it to point to our newly created database:
1 cd /var/www/redmine/config
2 copy database.yml.example database.yml

On the

database.yml

le, the

production

section should look like this:

1 production:
adapter: mysql
2
database: redmine
3
host: localhost
4
username: redmine
5
password: my_password
6
encoding: utf8
7

And then we create and populate the database with the following rake commands:
1
2
3
4

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

Outgoing email conguration (Optional)


To congure an outgoing SMTP server for sending emails, we create the

config/configuration.yml

le from the sample:

1 cd /var/www/redmine/config
2 cp configuration.yml.example configuration.yml

And edit it to provide our conguration :


1 production:
email_delivery:
2
delivery_method: :smtp
3
smtp_settings:
4
address: "smtp.mydomain.com"
5
port: 25
6
domain: "mydomain.com"
7

Redmine standalone testing


At this point, Redmine can be tested in standalone mode by running the following command:
1 cd /var/www/redmine/
2 ruby script/server webrick -e production

and open the

addess in a browser. If you are testing from another computer, you will need to open the port in the
le by duplicating the ssh (port 22) line and adapting it:

http://localhost:3000

/etc/sysconfig/iptables

1 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT


2 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT

Then apply the new conguration with the following command:


1 service iptables restart

Passenger installation
To install Phusion passenger, we rts install its gem:
1 gem install passenger

And then install the Apache module with the command:


1 passenger-install-apache2-module

Apache conguration
We remove the default Apache conguration and replace it by a new one:
1 cd /etc/httpd
2 mv conf.d available

2 de 6

22/04/14 23:52

Installing Redmine on CentOS 6.2 wiht MySQL a...

http://mrtn.me/blog/2012/07/06/installing-redmin...

3 mkdir conf.d

In the empty new


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

conf.d

folder, we create a

redmine.conf

le with the following conguration:

# Loading Passenger
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.13
PassengerRuby /usr/bin/ruby
<VirtualHost *:80>
ServerName redmine.mycompany.com
DocumentRoot /var/www/redmine/public
<Directory /var/www/redmine/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
allow from all
</Directory>
ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/redmine-error.%Y-%m-%d.log 86400"
CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/redmine-access.%Y-%m-%d.log 86400" "%h %l %u %t %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
</VirtualHost>

We then enable named based virtual hosting for our server by uncomenting the following line in the
1
2
3
4
5
6

/etc/httpd/conf/httpd.conf

le:

...
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
...

We give full access on the redmine folder to the

apache

user and test the conguration:

1 chown -R apache:root /var/www/redmine


2 service httpd configtest

At this point, the SELinux conguration needs to be modied to allow our apache instance to run the phusion passenger module. You can do
this by putting SELinux in permissive mode:
1 setenfore Permissive

And letting the Permissive mode survive a reboot by modifyin the

/etc/selinux/config

le from:

1 SELINUX=enforcing

to
1 SELINUX=permissive

If you want to run redmine while enforcing, you may want to apply the method described here for which you will need to install the
policycoreutils-python package.
In any case, you will start Apache with the command:
1 service httpd start

Now you can access your Redmine installation with your browser. To access it from all the computers in your network, you will need to open
the port 80 in the /etc/sysconfig/iptables. You can replace the 3000 rule by :
1 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
2 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

And restart iptables.


1 service iptables restart

Start services at boot


To have MySQL and Apache started at boot, run the commands:
1 chkconfig --level 345 mysqld on
2 chkconfig --level 345 httpd on

3 de 6

22/04/14 23:52

Installing Redmine on CentOS 6.2 wiht MySQL a...

http://mrtn.me/blog/2012/07/06/installing-redmin...

Cleaning up
A quick command to clean up all the

devel

stu needed for installation:

1 yum remove '*-devel' make automake autoconf

Tips
Dont forget that if you change your Redmine conguration, you dont have to restart Apache. Your can restart only Redmine with the
command:
1 touch /var/www/redmine/tmp/restart.txt

If you restore data on your server from another redmine instance that runs on a previous version, dont forget to migrate your data:
1 cd /var/www/redmine
2 rake db:migrate RAILS_ENV="production"

Posted by Antoine Martin Jul 6th, 2012 CentOS, Linux, Redmine, Ruby
Tweet

Django on Windows: run Celery as a Service Quickly deploy a Git project on a server with SSH

Comments

4 de 6

22/04/14 23:52

Installing Redmine on CentOS 6.2 wiht MySQL a...

14 Comments

Geek quickies

Sort by Best

http://mrtn.me/blog/2012/07/06/installing-redmin...

Enrique Herrera N
Share

Favorite

Join the discussion


Paul Giberson

10 months ago

So much more clear than all the various random wiki entries at redmine.org, thanks.
Reply Share

2
FL MP

a year ago

Nice tutorial good stuff.


One concern regarding the TIPs portion:
Tips
Dont forget that if you change your Redmine configuration, you dont have to
restart Apache. Your can restart only Redmine with the command:
touch /var/www/redmine/tmp/restart.txt
- this only creates restart.txt file in /var/www/redmine.
- where is the command that triggers the "Redmine Restart"?
Reply Share

antoinemartin

Mod > FL MP a year ago

Thank you.
Actually, Phusion Passenger monitors this file. With the touch command, you don't
only create the file if it doesn't exist, you also update its modification date.
When the file is updated, Phusion Passenger restarts the rails application.
Reply Share

Lee

a year ago

I was having problems getting RedMine tor run in standalone mode with webrick; I think the
syntax for later versions of Ruby has changed. If you are having this problem:
ruby script/server webrick -e productionruby: No such file or directory -- script/server
(LoadError)Try this command instead ruby ./script/rails server webrick -e production
Good luck
Reply Share

Vichea Cheth

6 months ago

Thank you so much, this tutorial is really good and work fine with me.
But I want to know how to configure redmine with Apache to be accessible through an URL
of type http://[server-ip]/redmine or redmine.[server-ip]?
Reply Share

chirag

10 months ago

Hi I am getting issue installing redmine on Centos 6 while performing below command


rake db:migrate RAILS_ENV="production"
undefined method `symbolize_keys' for #<string:0x7f8cc8ee3cf0>
Reply Share

Deya

a year ago

Thank you so much, I have installed it and every thing is going ok.
Reply Share

Gene Leung

a year ago

Excellent, tutorial. Why not install the 2.x version instead?


Reply Share

antoinemartin

Mod > Gene Leung a year ago

At the time I did the installation, I was using some plugins only compatible with the
1.x branch
Reply Share

FL MP

a year ago

"In the empty new conf.d folder, we create a redmine.conf file with the following
configuration:"
----- After this process, The standalone redmine setup was not available anymore --------I got stucked!
when i browser: http://my.ip.add.ress - this displays lists of files and folders which should

5 de 6

22/04/14 23:52

Installing Redmine on CentOS 6.2 wiht MySQL a...

http://mrtn.me/blog/2012/07/06/installing-redmin...

Recent Posts
Mirror a Git repository through SSH
Checking Google Play Signatures on .Net
Avoid Thread Issues while Testing an Android Service
Unlock and root a Nexus device
Quickly deploy a Git project on a server with SSH

Latest Tweets
Status updating...
Follow @antoinemartin

Google+
Copyright 2012 - Antoine Martin - Powered by Octopress

6 de 6

22/04/14 23:52

También podría gustarte