3.14.2016

How to setup Redmine on Centos 7

Install Ruby and Passenger

  • Install relevant packages by yum
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mod_fcgid gcc-c++
  •  Install Ruby by yum
yum install -y ruby-libs ruby ruby-rdoc ruby-devel rubygems
  • Install Passenger
gem install passenger
passenger-install-apache2-module
    •  While installing, it needs significant of memory to compile the source code. Create swap file if necessary
dd if=/dev/zero of=/swapfile bs=1024 count=2097152
mkswap /swapfile
swapon /swapfile

Install MariaDB

  • Install MariaDB by yum
yum install mariadb-server mariadb-devel mariadb
  • Start MariaDB
systemctl start mariadb.service
systemctl enable mariadb.service
  • Secure the database
mysql_secure_installation
  • Setup permission
mysql -uroot -p<PASSWORD>
> create database redmine character set utf8;
> create user 'redmine'@'localhost' identified by '<input_your_password>';
> grant all privileges on redmine.* to 'redmine'@'localhost';

Install Redmine

  • Extract Redmine release
tar zxf redmine-3.2.1.tar.gz
chown -R apache:apache redmine-3.2.1
mv redmine-3.2.1 /var/www/redmine

Configure Redmine

  • Rename redmine/config/database.yml.example to database.yml, and edit it
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: <input_your_password>
  encoding: utf8
  • Generate the secret token
cd redmine/config
rake generate_secret_token
  • Migrate the database models
RAILS_ENV=production rake db:migrate
  • Load default data
RAILS_ENV=production rake redmine:load_default_data
  • Change permission
chown -R apache:apache files log tmp public plugins
chmod -R 755 files log tmp public plugins
  • Install Bundler
gem install bundler
cd /var/www/redmine
bundle install

Configure Apache

  • Create /etc/httpd/conf.d/redmine.conf (Change passenger version according to your installed version) 
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p648/gems/passenger-5.0.23/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p648/gems/passenger-5.0.23
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.0.0-p648/wrappers/ruby

Listen 8080
<VirtualHost *:8080>
   ServerName localhost
   DocumentRoot "/var/www/redmine/public/"
  <Directory "/var/www/redmine/public/">
# This relaxes Apache security settings.
    AllowOverride all
# MultiViews must be turned off.
    Options -MultiViews
   </Directory>
</VirtualHost>
  • Restart httpd service
systemctl restart httpd.service

Done

  • Browse http://localhost:8080/ and login by admin:admin





2 comments: