Installing Redmine + MySQL on CentOS 5

Small guide for Redmine installation on CentOS 5.3.

Requirements:

  • Ruby 1.8.7
  • RubyGems
  • MySQL 4.1 or higher (recommended)
  • openssl + openssl-devel
  • zlib + zlib-devel

Lets install all required packages before compiling ruby.

First of all, lets add rpmforge repository to your default CentOS installation:

rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -ihv http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Now we will have the latest software that is not updated on official repos.

Installing all required software from repos:

yum install gcc-c++ mysql-server mysql-devel openssl openssl-devel zlib zlib-devel subversion

Start mysql server and change the pasword for user root in mysql (by default its empty):

service mysqld start
mysqladmin -u root password newpassword

Now we should be ready for ruby installation.

Installing Ruby:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz
tar zxvf ruby-1.8.7.tar.gz
cd ruby-1.8.7
./configure
make && make install

Installing RubyGems:

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar zxvf gems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup.rb

Installing Rails:

gem install rails -v=2.3.4

Installing  Redmine:

cd /opt
svn co http://redmine.rubyforge.org/svn/trunk redmine

Prepare mysql database for Redmine:

In mysql console:

create database redmine character set utf8;
create user ‘redmine’@'localhost’ identified by ‘my_password’;
grant all privileges on redmine.* to ‘redmine’@'localhost’;

Ok. Its created lets configure our database settings for  Redmine:

cd /opt/redmine
cp  config/database.yml.example config/database.yml

Edit config/database.yml and set your settings:

production:

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

Generate a session store secret:

cd /opt/redmine
rake config/initializers/session_store.rb

Create the database structure:

RAILS_ENV=production rake db:migrate

Insert default configuration data in database:

RAILS_ENV=production rake redmine:load_default_data

Setting up permissions:

chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

Configure email settings:

cd /opt/redmine
cp config/email.yml.example config/email.yml

Edit config/email.yml and set the right settings for SMTP server you will use:

Starting Redmine on built-in WEBrick web server:

ruby script/server webrick -p 8000 -e production

After its started you can access Redmine on the following URL:

http://your.ser.ver.ip:8000/

Use default administrator account to log in:

  • login: admin
  • password: admin

Thats it. Redmine is ready to use.

Usefull links:

19 Responses to Installing Redmine + MySQL on CentOS 5

  1. naresh January 6, 2010 at 5:54 am #

    I tried many procedures only this worked for me.
    Thanks

    • veter January 6, 2010 at 12:03 pm #

      I am glad it was useful for you. :)

  2. Gopal May 6, 2010 at 6:03 pm #

    You owe me now man. Great I spent about one month to install it but not succeeded.

    Your documentation made it in 2 hours only.

  3. Elliott May 16, 2010 at 12:26 am #

    Thanks a lot. Still relevant 6 months later!

    I had one hiccup, the tutorial doesn’t mention adding the redmine user. I modeled it after the apache user:
    useradd -s /dev/null -d /opt/redmine/ redmine

    • veter May 17, 2010 at 9:03 am #

      You are right, this can be important for newcomers. Thanks for reply! :)

  4. tuxamit September 23, 2010 at 2:33 am #

    Very Very Good Document bro..

    it works …

  5. Ian September 24, 2010 at 6:15 am #

    I am new to Redmine, sorry if my question is stupid but here it is (I’ve tried search but found nothing)

    Redmine 1.0.1.devel.4171 is running on my VPS. I have created test project and repository for it (which I can access via svn client).

    At the beginning everything works good but after some time when you go to repository tab inside project – following message is shown:

    Internal error

    An error occurred on the page you were trying to access.
    If you continue to experience problems please contact your redMine administrator for assistance.

    Back

    When I check logs I see following

    Processing RepositoriesController#show (for 1.2.3.4 at 2010-09-24 13:42:21) [GET]
    Parameters: {“action”=>”show”, “id”=>”proj-test”, “controller”=>”repositories”}

    Errno::ENOMEM (Cannot allocate memory – svn list –xml ‘https://myserv.com/svn/proj-test/’@HEAD –username ‘admin’ –password ‘admin123′ –no-auth-cache –non-interactive):
    lib/redmine/scm/adapters/abstract_adapter.rb:191:in `popen’
    lib/redmine/scm/adapters/abstract_adapter.rb:191:in `shellout’
    lib/redmine/scm/adapters/abstract_adapter.rb:177:in `shellout’
    lib/redmine/scm/adapters/subversion_adapter.rb:82:in `entries’
    app/models/repository.rb:63:in `entries’
    app/controllers/repositories_controller.rb:79:in `show’
    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service’
    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’
    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread’
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start’
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread’
    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start’
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each’
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start’
    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start’
    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start’

    Rendering /opt/redmine/public/500.html (500 Internal Server Error)

    Now if I restart redmine (by killing it process) and launch it again – everything works well until some time (several hours maybe) but than it fails again.

    What can I do to fix this?

    • veter September 24, 2010 at 12:43 pm #

      Thats memory error.
      It looks like not enough of RAM available on your VPS server. You have to increase it or check what processes are using most of the RAM and search how to decrease the usage.

  6. Chris October 7, 2010 at 7:57 am #

    i´m new too to redmine, i have following problems with rake & rails… i followed your how-to exactly…

    any can help?

    [root@system redmine]# RAILS_ENV=production rake db:migrate
    (in /opt/redmine)
    !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
    rake aborted!
    no such file to load — mysql

    • Chris October 7, 2010 at 7:59 am #

      and when i try to update that mysql…

      [root@system redmine]# gem install mysql
      ERROR: Error installing mysql:
      mysql requires Ruby version >= 1.8.6

      i loaded 1.8.7 too… -.-

      • veter October 7, 2010 at 11:43 am #

        Maybe you have missed some steps?

        Check what ruby version is installed:
        ruby -v

        • Chris October 8, 2010 at 3:53 am #

          No…i reboot my system for new…i did step by step with that how-to .. and also i´ve got is the ruby version 1.8.5 again..

          • veter October 8, 2010 at 10:35 am #

            If you went through all steps for installing ruby then you just can’t have Ruby version 1.8.5 because you are installing ruby-1.8.7.

            Probably you already had ruby installed on your system. You have to remove old ruby installation and reinstall it.

        • Chris October 8, 2010 at 7:24 am #

          I need Subversion to get Redmine… but when i want to install it..

          Error: Missing Dependency libldap
          Error: Missing Dependency lib(something else)..

          what to do ?

          • veter October 8, 2010 at 10:34 am #

            yum install subversion

            If you have error with the command above then your Linux in troubles and you have to check your system setup.

          • Chris October 8, 2010 at 2:48 pm #

            Error: Missing Dependency: liblber-2.3.so.0 is needed by package subversion
            Error: Missing Dependency: libldap-2.3.so.0 is needed by package subversion

            thats the error i got … i don´t have any system troubles… works all fine, but redmine…

          • Chris October 8, 2010 at 3:02 pm #

            can i download a complete rpm package anywhere for this two missing packages ?..

          • veter October 8, 2010 at 3:46 pm #

            Subversion is the system package not related to redmine.
            You have to be able to install it from your repository.
            If you have problems with its installation then you have problems with your repositories or with the system.

            You can try to install it from rpm but it will give you the same error i guess.

            Search for rpm in google because rpms are specific to your Linux version.

  7. Twitter WordPress November 16, 2010 at 6:13 pm #

    Thank you, great job! This was what I needed.