Installing Redmine With MySQL And Nginx On CentOS 6

Redmine is a software project management tool which has Wiki, issue tracer, source code browser and other cool features built in. If you want to install Redmine with MySQL and Nginx on CentOS 6, follow these steps.

I always use EPEL repository with CentOS. EPEL provides additional RPM packages. We can use Nginx and some Ruby gem packages from EPEL.

Enable EPEL:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

Install required packages:

yum install nginx mysql-server ruby rubygem-rack rubygem-rake ruby-mysql

Redmine requires a Ruby gem called i18n. I couldn't find the RPM for i18n gem. I had to install i18n gem using the gem installer.

gem install -v=0.4.2 i18n

Start MySQL server:

/etc/init.d/mysqld start

Use the MySQL secure installation program:

mysql_secure_installation

Connect to the MySQL server as root:

mysql -u root -p

Create a MySQL database and user for Redmine:
mysql> CREATE DATABASE redmine character set utf8;
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'secret_password' WITH GRANT OPTION;

Make sure MySQL and Nginx start when the server starts:

ntsysv

Select nginx and mysql using the space key. Use arrow keys to navigate and tab to select the buttons.

Create a separate user account for Redmine:

adduser redmine

Switch to redmine user:

su - redmine

Download Redmine and extract the archive. At the time of writing this blog post, 1.2.1 was the latest stable release. Check out the RubyForge web page for latest releases.

wget http://rubyforge.org/frs/download.php/75097/redmine-1.2.1.tar.gz
tar -zxvf redmine-1.2.1.tar.gz
cd redmine-1.2.1
<code>
 
<strong>Create the configuration file</strong>:
<code>
cp config/database.yml.example config/database.yml

Edit config/database.yml using a text editor. Have correct values for database name, username and password.

Generate a session store secret, create the database schema, load default settings and configure file permissions:

rake generate_session_store
RAILS_ENV=production rake redmine:load_default_data
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

Run the application:

ruby script/server webrick -e production

If you want to access the terminal send the process to background:

Press CTRL+Z
bg

Point your browser to http://localhost:3000/ or your http://hostname:3000.

Let Webrick be running.

Configure Nginx:
Create and edit the file /etc/nginx/conf.d/redmine.conf. Add the following configuration:

server {
    listen       80;
    server_name  myredmine.example.com;
 
    location / {
        proxy_pass http://127.0.0.1:3000;
 
    }
}

Replace myredmine.example.com with your actual host name. We're making Nginx a proxy to our Webrick server.

Restart Nginx:

/etc/init.d/nginx/restart

Make sure Redmine is started when the server starts. Edit /etc/rc.local file and add the following:

su -c  "cd /home/redmine/redmine-1.2.1 && /usr/bin/ruby script/server -d webrick -e production" - redmine > /dev/null

How did it go?

Comments

Just an FYI for those following along who may not be sysadmins in full, mention iptables and its associated rules that should be made with the default installation of cent6. Thanks!

Good suggestion. I will try to write something in those lines in the future.

Before running command
RAILS_ENV=production rake redmine:load_default_data
you should run two more commands:
RAILS_ENV=production rake generate_session_store
RAILS_ENV=production rake db:migrate

Can anyody please explain what i have to make within th iptables?

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.