Skip to content

Instantly share code, notes, and snippets.

@maikelsperandio
Last active December 28, 2015 19:29
Show Gist options
  • Save maikelsperandio/7550858 to your computer and use it in GitHub Desktop.
Save maikelsperandio/7550858 to your computer and use it in GitHub Desktop.
How to install redmine 2.4.0 on centos 6.4
# Prepare the centos installing these packages:
yum install make gcc gcc-c++
# Install gem and passenger dependencies:
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
# Go to ftp.ruby-lang.org and make the download of ruby, in this case: ruby-2.0.0-p247.tar.gz
# After download you have to untar it
tar zxvf ruby-2.0.0-p247.tar.gz
# Compile ruby
cd ruby-2.0.0-p247
./configure
make
make install
# Now you can verify if your ruby instalation was made successfully typing this on console:
ruby -v
# Since ruby version 1.9 comes with rubygem, so, there's no need to install it manually.
# Let's install passenger:
gem install passenger
passenger-install-apache2-module
# Go to http://rubyforge.org/projects/redmine/ and download the last version of redmine, in this case: redmine-2.4.0.tar.gz
# Go to Download directory and untar the redmine file:
tar zxvf redmine-2.4.0.tar.gz
# Lets move the redmine after untar to: /var/www/redmine
mv redmine-2.4.0 /var/www/redmine
# Lets install bundle ruby gem
gem install bundle
# Now ensure that the user and group of this directory and files is apache
chown -R apache.apache /var/www/redmine
# Now lets install redmine dependencies
cd /var/www/redmine
bundle install --without postgresql sqlite test development
# If there's any problem, install the libs requireds
yum install ImageMagick-devel
gem install rmagick -v '2.13.2'
# And then repeat the redmine dependencies installation
bundle install --without postgresql sqlite test development
# Now lets install Mysql server
yum install mysql-server
# Now lets start and configure Mysql
service mysqld start
mysql_secure_installation
# Now connect to mysql
mysql -u root
mysql> create database redmine character set utf8;
mysqk> grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
mysql> flush privileges;
mysql> quit;
# Now lets configure redmine database
cd /var/www/redmine/config
copy database.yml.example database.yml
# Now open database.yml and put the root password on production section
gedit database.yml
# Now lets populate the redmine database
cd /var/www/redmine
rake generate_secret_token
# Maybe you need to run bundle install again if there's any dependence missing
bundle install
# Lets continue with redmine database population
rake db:migrate RAILS_ENV="production"
rake redmine:load_default_data RAILS_ENV="production"
# Our instalation is almost done, lets start redmine in standalone mode to test the instalation
cd /var/www/redmine
ruby script/rails server webrick -e production
# At this point you might access localhost:3000 and see redmine index page, if you don't go back and review your instalation.
# Now lets make the Apache configuration
cd /etc/httpd
# Lets remove the conf.d directory and recreate it with a custom content
mv conf.d available
mkdir conf.d
# Lets create an empty file inside conf.d called redmine.conf
gedit conf.d/redmine.conf
# Now put in the file the following content
LoadModule passenger_module /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.24/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.24
PassengerDefaultRuby /usr/local/bin/ruby
<VirtualHost *:80>
ServerName mycentos
DocumentRoot /var/www/redmine/public
<Directory /var/www/redmine/public>
AllowOverride all
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>
# Now edit Apache configuration file and uncomenting this configuration:
gedit /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
# Now test the Apache configuration
service httpd configtest
# At this point, the SELinux configuration needs to be modified to allow our apache instance to run the phusion passenger module. You can do this by putting SELinux in permissive mode
# Edit this file: /etc/selinux/config and change the follow configuration:
gedit /etc/selinux/config
# Change this setting
SELINUX=enforcing
# To this one:
SELINUX=permissive
# At this point our task is done, but we need to configure the services to start on machine start up
chkconfig --level 345 mysqld on
chkconfig --level 345 httpd on
# Finally restart your pc and enjoy
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment