Install Redmine on CentOS5/RHEL5

Some of these instructions were taken from the following links:

http://blog.itsmine.co.uk/2009/01/22/howto-install-subversion-and-redmine-on-centos5-rhel5/

http://www.redmine.org/wiki/1/RedmineInstall

http://community.engineyard.com/discussions/problems/402-error-on-deploy-rails-requires-rubygems-132-you-have-131-please-gem-update-system-and-try-again

What you will need:

* An Apache server already configured and running as the apache user

* The subversion process setup and the root repository set to /var/svn/repositories

* The virtual hosts DocumentRoot for the Redmine website is located at /var/www/rails/redmine/public

* A MySQL server installed and configured

Install Ruby & RubyGems via RPM

Ruby 1.8.6 is required for all versions of redmine. The current version 1.0.0 which was the current development version from the trunk!!

Download the following rpms from http://pbone.net and install them.

  • ruby-1.8.6.383-6.el5.kb
  • ruby-devel
  • ruby-libs
  • ruby-irb
  • ruby-rdoc
  • ruby-mysql-2.7.3-1.el5
  • rubygems-1.3.1-2.el5.kb
  • subversion-ruby-1.4.2-4.el5_3.1

Once downloaded, install them:

  1. rpm -ivh ruby-*.rpm
  2. rpm -ivh rubygems subversion-ruby

RubyGems

You will need to install rubygems-1.3.2 or higher. by default, CentOS5 comes with rubygems-1.3.1 installed. To resolve this issue:

  1. Download rubygems tarball from here: wget http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz
  2. Untar it on the files system anywhere you like: tar xvzf rubygems-1.3.2-tgz
  3. Move to the newly created directory: cd rubygems-1.3.2
  4. Update the rubygems files with 1.3.2 version: ruby setup.rb
  5. If you had gems installed under rubygems 1.3.1 version, they will be gone. You will now need to install the necessary gems for redmine now that rubygems 1.3.2 is installed.

Install Ruby & RubyGems via source

You will need gcc installed to compile this and zlib-devel is also required. In addition for Ruby 1.9.2, gems is installed with Ruby.

  1. Download ruby from here: http://www.ruby-lang.org/en/downloads/
  2. Uncompress the file: tar xvzf ruby-X.tar.gz
  3. Move to the ruby directory: cd ruby-X
  4. Select the defaults, it will install into /usr/local/bin and /usr/local/lib by default. ./configure
  5. make
  6. make test
  7. sudo make install

You can verify this worked and ruby and gem is installed by checking the version and listing installed gems.

ruby -v

gem -v

gem list

Install Rails and Rake

You can use gems to install rails and rake.  Make sure to install the correct versions required by Redmine. If you checkout the source from the Redmine repository, you can install a specific Rails version on your machine with:

  1. sudo gem install rails -v=2.3.5
  2. sudo gem install rack -v=1.0.1
  3. sudo gem install mysql

Use yum to get/install the required packages.

$ sudo yum -y install mysql mysql-server mysql-devel ruby-devel

If you have RubyGems installed, you’ll need to get the mysql gem:

$ sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config

You can find out your gem environment with: gem env

gem env
RubyGems Environment:
– INSTALLATION DIRECTORY: /usr/lib64/ruby/gems/1.8
– GEM PATHS:
– /usr/lib64/ruby/gems/1.8
– /home/dlopez/.gem/ruby/1.8
Install passenger gems: gem install passenger, then run passenger-install-apache2-module. This will create the necessary lines to add to Apache rails.conf file.

Create a database for Redmine

I use MySQL so here all I needed:

  1. bash$ mysql -u root -p
  2. mysql > create database redminedb character set utf8;
  3. mysql > grant all privileges on redminedb.* to rmproduser@localhost identified by “password”;
  4. mysql > flush privileges;
  5. quit

Install & Configure Redmine

  1. I chose to checkout redmine from a subversion repository.  You can get the source code by typing: svn co http://redmine.rubyforge.org/svn/tags/1.0.0 redmine
  2. Copy the redmine directory to /var/www/rails/: cp -rvp redmine /var/www/rails/
  3. Give apache ownership of the files: cd /var/www/rails ; chown -R apache.apache redmine
  4. Copy the config/database.yml.example to config/database.yml and add the mysql permissions to the config/database.yml file
  5. Copy the config/email.yml.example to config/email.yml and comment the bottom of the file. I uncommented the section that uses localhost sendmail service.
  6. Generate a session store secret. This is required on the trunk version of Redmine. For the checkout above it is required: rake generate_session_store
  7. Create the database structure, tables and an administrator account: RAILS_ENV=production rake db:migrate
  8. Insert default configuration data in database: RAILS_ENV=production rake redmine:load_default_data
  9. Start the redmine web service: ruby script/server -e production -d
  10. Now you should be able to browse to http://redmineserver.domain.com:3000 and view the default installation

Install & Configure Subversion

  • yum install mod_dav_svn subversion
  • I found this init script here: http://svn.haxx.se/dev/archive-2007-07/0733.shtml Just put it in a file called subversion and place it at /etc/rc.d/init.d/
  • Make sure the script is executable: chmod 755 /etc/rc.d/init.d/subversion
  • Add an option to /etc/sysconfig/subversion to tell subversion where the repositories are located. OPTIONS=’-r /path/to/repos’
  • Add the init script to chkconfig: chkconfig –add subversion
  • Make sure it starts on reboot: chkconfig subversion on
  • Now you can start the subversion service: sudo /sbin/service subversion start
  • Verify it’s running with: ps aux | grep svnserve

Troubleshooting:

/usr/local/lib/ruby/1.8/i686-linux/digest/md5.so: undefined symbol:
rb_Digest_MD5_Init - /usr/local/lib/ruby/1.8/i686-linux/digest/md5.so
(LoadError)

If you get the above error and installed ruby from source, to resolve this I recompiled ruby with a make clean and then reinstalled gems with ruby setup.rb in the rubygems source directory.

ActionView::TemplateError (undefined method `-‘ for nil:NilClass)

I resolved this with the following ruby command:

ruby script/runner -e production ‘Project.rebuild!’

Then restart Apache!

Error: ‘gem_original_require’: no such file to load — zlib (LoadError)

To resolve this issue make sure zlib-devel is installed. *yum install zlib-devel*

then in /opt/ruby/ext/zlib

ruby extconf.rb

make && make install

Plugins

To install the Global Filter plugin:

git clone https://github.com/kumudhachari/global_filter_redmine_plugin.git

cp -R global_filter_redmine_plugin {RedmineRoot}/vendors/plugins/

Moving Redmine to another server.

#1 Install the current version of Redmine on new server.

#2 MySQL dump the database from the old server and import into the new server.

#3 Run: RAILS_ENV=production rake db:migrate

#4 Reload Apache!

Leave a comment