FedoraInstallation » History » Version 5

« Previous - Version 5/6 (diff) - Next » - Current version
Jamie McPeek, 2014-08-16 23:10


HowTo Install Redmine 2.5.x on Fedora 20

System Requirements

No assumptions are made about the initial state of the system in this guide. The guide can be followed for either 32-bit or 64-bit systems - though all testing and the original installation was performed on a 64-bit system.

The hardware requirements are not significant, so a small VM with 10gb storage and 1GB ram and 1GB swap file should be sufficient.

This guide can be used on top of an already existing system or, from scratch, downloading from the Fedora website.

An ISO for installation can be downloaded from here.

The rest of the guide assumes that you have created a user account with wheel/administrator access and are logged in to the terminal directly or through SSH.

Updating the System

Before beginning, you should ensure all of your installed packages are up-to-date. This can be done by issuing the following command:

$ sudo yum update

If the kernel was updated as part of this command, you should perform a restart to begin using it:

$ sudo shutdown -r now

Installing Dependencies

Before beginning the installation of Redmine, there are a number of dependencies which need to be installed.

Depending on your needs, some of these may not be necessary. Depending on your preferences, you may choose alternatives to some of these.

apr-devel         - For Passenger
apr-util-devel    - For Passenger
curl-devel        - For Passenger
gcc               - For JSON
gcc-c++           - For Passenger
git               - (Optional) For SCM Integration
httpd             - Web Server
httpd-devel       - For Passenger
ImageMagick-devel - For RMagick
mariadb-devel     - For Redmine
mariadb-server    - For Redmine
nano              - Configuration Editor
ruby-devel        - For Redmine
tar               - For Decompression
wget              - For Download

All of these can be installed prior to starting with a single command:

$ sudo yum install apr-devel apr-util-devel curl-devel gcc gcc-c++ git httpd httpd-devel ImageMagick-devel mariadb-devel mariadb-server nano ruby-devel tar wget

Disable SELinux

Some users have noted issues installing Redmine with SELinux active. This can be disabled via the following command:

# sudo setenforce 0

Steps will be taken throughout the remainder of the guide to ensure that, if desired, SELinux can be re-enabled after and still maintain a fully functional Redmine installation.

Enable Server Environment

With all of the dependencies installed, we need to ensure that the servers are setup, ready for use, and accessible external to the OS installation.

The first step is to open the standard port 80 in the firewall for the web server:

$ sudo firewall-cmd --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=http

The first line opens the port in the current configuration. The second line ensures that, after a restart, that port will remain open and available.

The second step is to start the web server and database server:

$ sudo systemctl start httpd mariadb
$ sudo systemctl enable httpd mariadb

Similar to the firewall commands, the first line starts the servers in the current configuration. The second line ensures that, after a restart, both servers come back online.

Configuring MariaDB

Now that you have a database server up and running, it needs to be configured for use. The initial setup can be performed with the following command:

$ mysql_secure_installation

This will prompt you to create a password for the root account as well as a number of other choices. For a standard setup, the default choice for each question is acceptable.

Advanced usages or installations may opt for different answers; however, that is beyond the scope of this guide.

Creating a Redmine Database and Account

Now that you have MariaDB configured, it is time to create a database and user for use with your Redmine installation.

First, connect to the server:

$ mysql -u root -p

You will be prompted to enter the root password. Once provided, you will be able to issue the following commands:

CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY '<user_password>';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

The above commands will create the database, create a user with a defined password, and ensure the created user has full access on the newly created database.

Once those commands have been entered, issue the following command to return to the command line:

quit

Obtaining Redmine

Now that all the dependencies are installed and the servers are up and running it's time to get the stable release of Redmine and begin its installation.

In this example, we'll use wget to download the file from the Redmine server and tar to extract its contents:

$ wget http://www.redmine.org/releases/redmine-2.5.2.tar.gz
$ tar xfzv redmine-2.5.2.tar.gz

Redmine Database Configuration

To ensure proper functionality, the Redmine installation will need to communicate with the database that has just been created. This can be done by performing the following:

$ cd redmine-2.5.2/config
$ cp database.yml.example database.yml
$ nano -w database.yml

Once the file has been opened, the production definition needs to be updated to match the database and account used above. It should look as follows:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "<user_password>" 
  encoding: utf8

This replaces the user root and the blank password in the example configuration file.

Redmine Installation Directory

With most of the precursor work completed, it's time to move the installation to a folder more accessible than a user's home directory.

For the purposes of this guide, Redmine will be moved to /var/www/redmine; however, this could be moved to a variety of over locations based on personal needs.

This can be don with the following commands:

$ cd /var/www
$ sudo cp -R ~/redmine-2.5.2 redmine
$ cd redmine

To ensure proper functionality and access rights, the public/plugin_assets folder needs to be created:

$ sudo mkdir public/plugin_assets

To allow read/write access to the folders, the user apache needs to have access:

$ sudo chown apache:apache -R files log public/plugin_assets tmp

Optional SELinux Configuration

If you plan to re-enable SELinux after installation, the following steps should be taken to ensure smooth execution.

$ sudo chcon -R --reference=/var/www/html /var/www/redmine

This command applies SELinux directory permissions typically for a web server to all sub-directories under the redmine top-level folder.

$ sudo chcon -t httpd_sys_content_rw_t -R files log public/plugin_assets tmp

This command enables the specific folders listed to have read/write access while SELinux is active. Under a normal configuration with SELinux, all web directories are read-only.

Ruby Gem Installation

The ruby dependencies for Redmine are managed by bundler, so that must be installed first to determine what else must be downloaded and installed.

$ sudo gem install bundler

With bundler installed, the Redmine ruby dependencies can be sorted:

$ sudo /usr/local/bin/bundle install --without development test

Note 1: By default /usr/local/bin is not on $PATH for the root user, so the absolute path must be provided.

Note 2: Bundle will complain about installing gems via sudo making them only usable by root. This is not true - by installing as root, these gems are available to all users.

Native Extension Fixes

When running bundler as root, the mysql2 and rmagick native extensions get installed, but to a folder not on ruby's path. To correct this, the following steps should be taken:

$ sudo mkdir -p /usr/local/lib64/ruby/site_ruby/mysql2

This creates the path that ruby expects to find the mysql2.so file at.

$ cd /usr/local/share/gems/gems/mysql2-0.3.16/ext/mysql2
$ sudo ruby extconf.rb
$ sudo make
$ sudo make install

The above steps complete the install to the expected directory using default compile options. Special options are beyond the scope of this guide.

The same should now be performed for the rmagick native extension:

$ cd /usr/local/share/gems/gems/rmagick-2.13.3/ext/RMagick
$ sudo ruby extconf.rb
$ sudo make
$ sudo make install

Once again, the above steps complete the install to the expected directory using default compile options.

Finally, return to the installation directory to finish the remaining steps:

$ cd /var/www/redmine

Redmine Database Initialization

We're on to the final steps of completing the Redmine installation now that everything else has been taken care of.

The first step is to generate the secret key for session management:

$ sudo /usr/local/bin/rake generate_secret_token

Next, the database needs to be setup:

$ sudo RAILS_ENV=production /usr/local/bin/rake db:migrate

Finally, the database needs to be populated with default data:

$ sudo RAILS_ENV=production /usr/local/bin/rake redmine:load_default_data

This will prompt you to pick your language, which defaults to [en].

WEBRick Test Execution

Once this step has been completed, you have a fully functional Redmine installation and can run this for testing via WEBRick:

$ sudo ruby script/rails server webrick -e production