Redmine - Howto Step by Step: Install Apache

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Redmine – Howto Step by Step

Install Apache :-
yum -y install httpd httpd-devel libcurl-devel

yum -y install ImageMagick ImageMagick-devel git libxml2-devel libxslt-devel gcc bzip2 openssl-devel zlib-devel
gdbm-devel ncurses-devel autoconf automake bison gcc-c++ libffi-devel libtool patch readline-devel sqlite-devel
glibc-headers glibc-devel libyaml-devel libicu-devel libidn-devel

Install MariaDB :-
yum install mariadb-server
mysql_secure_installation

Next, we need to create a database for our Redmine installation:

mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY
'redmine_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Install Ruby :-
adduser redmine
su - redmine

We will install the latest version of Ruby using Ruby Version Manager, or RVM. It is used to install
and manage multiple versions of Ruby.
Add the GPG key of RVM to your server.

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3


7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Install RVM :-
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm

Fetch the list of the available versions of Ruby.


rvm list known
[redmine@redmine-MC ~]$ rvm list known
# MRI Rubies

[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.7]
[ruby-]2.3[.4]
[ruby-]2.4[.1]
ruby-head

...
Install the latest version of Ruby from the list.

rvm install 2.4

Use the installed version of Ruby.

rvm use 2.4

You can verify its version.

ruby -v

You will see a similar output.

[redmine@redmine-MC ~]$ ruby -v


ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

Install bundler, which is the dependency manager for the Ruby application.

gem install bundler

Ruby is now installed. Before we install Redmine, we will need to install Phusion Passenger.

Install Passenger :-

Run the following command to install Passenger.

gem install passenger

Provide execution permission to the home directory of redmine user. Passenger needs to execute
the binaries in order to serve the application.

chmod o+x "/home/redmine"

Install the Apache module for Passenger :-


passenger-install-apache2-module

The installer script will ask you some questions. First, it will provide you information about the
installation process. Then it will ask you to select the language which you will be using. Since our
application is written in Ruby on Rails, select Ruby from the menu and press "Enter" to proceed
further.

Which languages are you interested in?

Use <space> to select.


If the menu doesn't display correctly, press '!'

‣⬢ Ruby
⬡ Python
⬡ Node.js
⬡ Meteor
The installer will now check for requirements. The installer will not encounter any missing
dependencies and will automatically proceed to compile and install the module.
Once the module is installed, it will prompt you to add the module into the Apache configuration file.
Almost there!

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /home/redmine/.rvm/gems/ruby-2.4.1/gems/passenger-


5.1.12/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/redmine/.rvm/gems/ruby-2.4.1/gems/passenger-5.1.12
PassengerDefaultRuby /home/redmine/.rvm/gems/ruby-2.4.1/wrappers/ruby
</IfModule>

After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!
Press ENTER when you are done editing.

We will skip this for now and will complete it later in the tutorial as the user with which we are logged
in now does not have sudo permissions. Press "Enter" to skip this step.

Finally, the installer script will validate the installation and you will see a warning saying the
Passenger module is not specified in Apache configuration.

Validating installation...

* Checking whether this Passenger install is in PATH... ✓


* Checking whether there are no other Passenger installations... ✓
* Checking whether Apache is installed... ✓
* Checking whether the Passenger module is correctly configured in Apache... (!)

You did not specify 'LoadModule passenger_module' in any of your Apache


configuration files. Please paste the configuration snippet that this
installer printed earlier, into one of your Apache configuration files, such
as /etc/httpd/conf/httpd.conf.

Detected 0 error(s), 1 warning(s).


Press ENTER to continue.
Now that we have installed the Passenger module for Apache, proceed to download and install
Redmine.

Install Redmine :-
Download the latest version of Redmine from the official Redmine download page.

cd ~
wget http://www.redmine.org/releases/redmine-3.4.4.tar.gz

Extract the archive and rename the directory for sake of convenience.

tar -xf redmine-*.tar.gz


mv redmine-*/ redmine/

Copy the example configuration files to its production location.

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

Open the database configuration file we just copied to enter the database details.

Vi config/database.yml

By default, the database file is configured for MySQL. Find the configurations for production and
development, and test which uses the MySQL adapter. Comment out development and test,
uncomment production, since production is used here. Comment out any other DB adapters other
than MySQL.

production:
adapter: mysql2
database: redmine
host: localhost
username: root
password: ""
encoding: utf8

#development:
# adapter: mysql2
# database: redmine_development
# host: localhost
# username: root
# password: ""
# encoding: utf8

#test:
# adapter: mysql2
# database: redmine_test
# host: localhost
# username: root
# password: ""
# encoding: utf8

Install the application dependencies required by the application.

bundle install --without development test

You will see the following message at the end of the installation.

Installing roadie-rails 1.1.1


Bundle complete! 31 Gemfile dependencies, 55 gems now installed.
Gems in the groups development and test were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

The following command generates secret tokens that are used to encode the session data.

bundle exec rake generate_secret_token

The above command will ask you to choose the default language to be used with the application. The
default choice is English; choose according to your preference.

[redmine@redmine-MC redmine]$ RAILS_ENV=production bundle exec rake redmine:load_default_data


Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko,
lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en]
====================================
Default configuration data loaded.

Installation of the Redmine application is now finished. Change ownership and permissions of the
directories and files.

mkdir -p tmp tmp/pdf public/plugin_assets


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

We have configured everything we need from the non-privileged user. Switch back to user root.

Configure Apache :-
Add the Passenger module for Apache into the Apache configuration file. This will automatically load
the Passenger module.

echo "LoadModule passenger_module /home/redmine/.rvm/gems/ruby-2.4.1/gems/passenger-


5.1.12/buildout/apache2/mod_passenger.so" | sudo tee -a /etc/httpd/conf.modules.d/00-base.conf

Create a new virtual host file for your Redmine application.

vi /etc/httpd/conf.d/redmine.conf

Populate the file with the following content.

<VirtualHost *:80>
ServerName redmine.example.com
DocumentRoot /home/redmine/redmine/public

PassengerRoot /home/redmine/.rvm/gems/ruby-2.4.1/gems/passenger-5.1.12
PassengerRuby /home/redmine/.rvm/gems/ruby-2.4.1/wrappers/ruby
PassengerUser redmine

<Directory /home/redmine/redmine/public>
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>

Make sure to replace redmine.example.com with your actual domain name. Also, make sure that the
path to the PassengerRoot and PassengerRuby are correct. The path to the binaries may change
when there is a new release of Ruby or Passenger. To find these paths, run the following command.

su redmine -c "passenger-config about ruby-command"

You will get following output.

[user@redmine-MC ~]$ sudo su redmine -c "passenger-config about ruby-command"


passenger-config was invoked through the following Ruby interpreter:
Command: /home/redmine/.rvm/gems/ruby-2.4.1/wrappers/ruby
Version: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
To use in Apache: PassengerRuby /home/redmine/.rvm/gems/ruby-2.4.1/wrappers/ruby
To use in Nginx : passenger_ruby /home/redmine/.rvm/gems/ruby-2.4.1/wrappers/ruby
To use with Standalone: /home/redmine/.rvm/gems/ruby-2.4.1/wrappers/ruby /home/redmine/.rvm/gems/ruby-
2.4.1/gems/passenger-5.1.12/bin/passenger start

Once the Virtual host file is created, restart the Apache web server.

systemctl restart httpd

You can now access Redmine on http://redmine.example.com.

Congratulations, you have successfully installed Redmine on your CentOS 7 instance. Start
developing your project either by creating or importing your project.

You might also like