HowTo Install Redmine 2.5.x on Fedora 20¶
- Table of contents
- HowTo Install Redmine 2.5.x on Fedora 20
- System Requirements
- Updating the System
- Installing Dependencies
- Disable SELinux
- Enable Server Environment
- Configuring MariaDB
- Obtaining Redmine
- Redmine Database Configuration
- Redmine Installation Directory
- Ruby Gem Installation
- Native Extension Fixes
- Redmine Database Initialization
- Passenger Installation
- Passenger Configuration
- Web Server Configuration
- Email Configuration
- Restart Web Server
- Enable SELinux
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 postfix - Email (MTA) 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 postfix 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 postfix $ sudo systemctl enable httpd mariadb postfix
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
Passenger Installation¶
For a more usable production setup, Redmine can be hosted through apache2
via Passenger. To get the Passenger bootstrap, issue the following command:
$ sudo gem install passenger
Once completed, the native extensions still need to be compiled. This can be done by issuing the following command:
$ sudo /usr/local/bin/passenger-install-apache2-module
This tool will help diagnose any issues as well as provide some default settings for your specific installation.
Note 1: The compilation of Passenger requires at least 1GB of RAM or RAM+Swap space combined. The compile will fail otherwise.
Passenger Configuration¶
Now that the extensions have been installed, apache2
needs to know how to use it.
The first step is to create a configuration file for Passenger:
$ sudo nano -w /etc/httpd/conf.modules.d/passenger.conf
This file should contain the information presented from running passenger-install-apache2-module
. An example:
LoadModule passenger_module /usr/local/share/gems/gems/passenger-4.0.48/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerDefaultUser apache PassengerRoot /usr/local/share/gems/gems/passenger-4.0.48 PassengerDefaultRuby /usr/bin/ruby </IfModule>
*Note 1: In addition to the default information from the installer, also add PassengerDefaultUser apache
. This will ensure Passenger runs as the user apache and maintains write access only to the folders defined previously.
Web Server Configuration¶
Now that the module is enabled, we have the choice of running the installation of Redmine at our root directory or as a subdirectory on the website.
Top-Level Execution¶
To run straight at a base website, modify the apache2
configuration file:
$ sudo nano -w /etc/httpd/conf/httpd.conf
And add the following block to the bottom of the file:
<VirtualHost *:80> ServerName www.website.com DocumentRoot /var/www/redmine/public <Directory /var/www/redmine/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: Require all granted </Directory> </VirtualHost>
Sub-Directory Execution¶
To run from a sub-directory of the base of a website, modify the apache2
configuration file:
$ sudo nano -w /etc/httpd/conf/httpd.conf
And add the following block to the bottom of the file:
<VirtualHost *:80> ServerName www.website.com DocumentRoot /var/www/html Alias /redmine /var/www/redmine/public <Location /redmine> PassengerBaseURI /redmine PassengerAppRoot /var/www/redmine </Location> <Directory /var/www/redmine/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: Require all granted </Directory> </VirtualHost>
Email Configuration¶
This section goes through the steps necessary to setup email notifications to be sent out from Redmine. Handling email input for issue creation and other purposes is beyond the scope of this guide.
The default configuration file for postfix
is very thorough; however, you may want to change the myhostname
option as follows:
myhostname = mail.website.com
The default will attempt to grab the FQDN from the server, which may not be what you want.
Optional SELinux Configuration¶
By default with SELinux enabled, the web server cannot open external connections. This is necessary for sending email notifications, even when port 25 is being opened on the localhost. This can be done with the following command:
$ sudo setsebool httpd_can_network_connect 1
Redmine Email Configuration¶
To use postfix, Redmine needs to know to communicate with it appropriately.
This can be done by making some more configuration changes:
$ cd /var/www/redmine/config $ sudo cp configuration.yml.example configuration.yml $ sudo nano -w configuration.yml
Assuming you are only running a production environment, just editing the default
section will be sufficient. An example of an authenticationless connection using postfix:
default:
# Outgoing emails configuration (see examples above)
email_delivery:
delivery_method: :async_smtp
Restart Web Server¶
With all of the configuration changes and module installations, the apache2
server needs to be restarted:
$ sudo systemctl restart httpd
Once that comes back up, you should be able to browse to a fully working stock installation of Redmine at either http://www.website.com/ or http://www.website.com/redmine.
Enable SELinux¶
If you wish to re-enable SELinux at this point, you may do so by issuing the following command:
$ sudo setenforce 1
Assuming you have followed the optional SELinux sections, the Redmine installation should function identically with SELinux enabled or disabled.
Updated by Jamie McPeek over 10 years ago · 6 revisions