Install Redmine with Apache and MySQL 8 on Fedora 30/29/31

|
Published:
|
|

Follow through this guide to learn how to install Redmine with Apache and MySQL 8 on Fedora 30/29/31.

Want to use CentOS 8 instead? Follow the link below to learn how to install Redmine on CentOS 8.

Install Redmine with Apache and MariaDB on CentOS 8

Install Redmine with Apache and MySQL 8 on Fedora 30/29/31

Run System Update

You can update your system packages by running;

dnf update

Install Required Redmine Dependencies

Run the command below to install required Redmine dependencies and other packages.

dnf install ruby-devel rpm-build libxml2-devel make automake libtool ImageMagick ImageMagick-devel mariadb-devel gcc httpd-devel libcurl-devel gcc-c++ vim

During the installation, Ruby is also installed. Verify installed version.

ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]

The version here shown may vary with your version of installed Ruby.

Create Redmine System User

In this guide, we will install Redmine on /opt/redmine directory and run it as non-privileged redmine system user.

Therefore, create a redmine user (or any other non-privileged user that Redmine will run as for that case) and assign the /opt/redmine as its home directory.

useradd -r -m -d /opt/redmine redmine

Consult man useradd to learn what the options used above means.

Install Apache HTTP Server

To install Apache HTTP server on Fedora 30/29/31, simply execute;

dnf install httpd

Start and enable Apache to run on system boot.

systemctl enable httpd --now

Next, add Apache to Redmine group.

usermod -aG redmine apache

Install MySQL 8 Redmine Database Backend

We have covered the installation MySQL 8 on Fedora in our previous guide. Follow the link below to install it.

Install MySQL 8 on Fedora 30/Fedora 29/31

Once installed, login to MySQL and create Redmine database and Redmine database user. Replace the database, database user and password accordingly.

mysql -u root -p

Next, create the database.

create database redminedb;

Create Redmine database user.

create user redmineuser@localhost identified by 'MyStr0ngP@SSw0rd#8';

Grant the user all privileges on the Redmine database created.

grant all on redminedb.* to redmineadmin@localhost;

Reload privileges tables and quit.

flush privileges;
quit

Download Redmine Tarball

To install the latest version of Redmine, navigate to the Download’s page and grab the latest stable release version.

You can simply use wget command to pull latest Redmine tarball, version 4.0.5 as of this writing.

wget http://www.redmine.org/releases/redmine-4.0.5.tar.gz -P /tmp

Install Redmine on Fedora 30/29/31

Extract the Redemine tarball to Redmine user’s home directory once the download is completes.

sudo -u redmine tar xzf /tmp/redmine-4.0.5.tar.gz -C /opt/redmine/ --strip-components=1

You should now have redmine files under /opt/redmine.

ls /opt/redmine
app           bin     config.ru        db   extra  Gemfile  log      public    README.rdoc  tmp
appveyor.yml  config  CONTRIBUTING.md  doc  files  lib      plugins  Rakefile  test         vendor

Configure Redmine

Switch to Redmine user and rename the following sample Redmine configurations.

su - redmine
cp config/configuration.yml{.example,}
cp public/dispatch.fcgi{.example,}
cp config/database.yml{.example,}

Set the Redmine database connection details.

vim config/database.yml
...
production:
  adapter: mysql2
  database: redminedb
  host: localhost
  username: redmineuser
  password: "MyStr0ngP@SSw0rd#8"
  encoding: utf8
...

Install Ruby GEM Dependencies

While in still logged in as Redmine user and from its home directory, execute the commands below;

gem install bundler
bundle install --without development test --path vendor/bundle

Generate Secret Session Token

To prevent tempering of the cookies that stores session data, you need to generate a random secret key that Rails uses to encode them.

bundle exec rake generate_secret_token

Create Database Schema Objects

Create Rails database structure by running the command below;

RAILS_ENV=production bundle exec rake db:migrate

Once the database migration is done, insert default configuration data into the database by executing;

RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data

Configure FileSystem Permissions

Ensure that the following directories are available on Redmine directory, /opt/redmine.

  • tmp and tmp/pdf
  • public and public/plugin_assets
  • log
  • files

If they do not exist, simply create them and ensure that they are owned by the user used to run Redmine.

for i in tmp tmp/pdf public/plugin_assets; do [ -d $i ] || mkdir -p $i; done
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 /opt/redmine/

Testing Redmine Installation

The setup of Redmine on CentOS 8 is now done. You can test Redmine using WEBrick by executing the command below;

bundle exec rails server webrick -e production
=> Booting WEBrick
=> Rails 5.2.3 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
[2019-10-31 21:37:32] INFO  WEBrick 1.4.2
[2019-10-31 21:37:32] INFO  ruby 2.5.5 (2019-03-15) [x86_64-linux]
[2019-10-31 21:37:32] INFO  WEBrick::HTTPServer#start: pid=11811 port=3000

You can now access Redmine via the browser using the address, http://Server-IP:3000/.

If firewallD is running, open port 3000/tcp on firewalld. Run the commands below as privileged user. (If you are logged in as Redmine user, simply press Ctrl+d to log out).

firewall-cmd --add-port=3000/tcp --permanent
firewall-cmd --reload

Once the port is opened, navigate to the browser and access Redmine. You should see a welcome page.

Install Redmine with Apache and MySQL 8 on Fedora 30/29/31

Click sign in and use the credentials, Useradmin and Password: admin to login.

Configure Apache for Redmine

WEBrick is not suitable for serving Redmine in production environments. As such, we are using Apache with Phusion Passenger in this guide to server Redmine.

Install Apache Phusion Passenger modules.

dnf install passenger mod_passenger

Once the installation is done, edit the Apache passenger configuration file such that it looks like as shown below;

vim /etc/httpd/conf.d/passenger.conf
<IfModule mod_passenger.c>
   PassengerRoot /usr/share/passenger//phusion_passenger/locations.ini
   PassengerRuby /usr/bin/ruby
</IfModule>

# Deploying a Ruby on Rails application: an example
Listen 3000
<VirtualHost *:3000>
   ServerName redmine.kifaruni-demo.com
   DocumentRoot /opt/redmine/public

   CustomLog "logs/redmine_access.log" combined
   ErrorLog  "logs/redmine_error.log"

   <Directory /opt/redmine/public>
      Options -MultiViews
      AllowOverride all
      Require all granted
   </Directory>
</VirtualHost>

Save and quit the configuration file.

Check HTTP server syntax.

httpd -t

If the syntax is Okay, Syntax OK, restart Apache.

systemctl restart httpd

Check if anything is listening on Port 3000.

lsof -i :3000
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd   2614   root    6u  IPv4 148831      0t0  TCP *:hbci (LISTEN)
httpd   2663 apache    6u  IPv4 148831      0t0  TCP *:hbci (LISTEN)
httpd   2664 apache    6u  IPv4 148831      0t0  TCP *:hbci (LISTEN)
httpd   2665 apache    6u  IPv4 148831      0t0  TCP *:hbci (LISTEN)

That is great.

Access Redmine from Browser

If SELinux is running, I suggest that you set it in permissive mode as it may cause problems with accessing some pages on Redmine. If however you are conversant with how SELinux works, you can deal with it.

sed -i 's/=enforcing/=permissive/' /etc/selinux/config

Reboot the system to effect SELinux changes.

To temporarily disable SELinux, run;

setenforce 0

Since we have already opened port 3000/tcp on firewallD, you should now be able to access Redmine web interface now. Replace the server-IP-or-Hostname accordingly.

http://server-IP-or-Hostname:3000

Sign in with the default credentials and reset the admin password.

Install Redmine with Apache and MySQL 8 on Fedora 30/29/31

Setup your Redmine admin profile.

Install Redmine with Apache and MySQL 8 on Fedora 30/29/31

You can now Navigate through Redmine tabs to learn more about it.

Redmine Administration Tab.

Redmine Administration tab

Redmine Projects tab

Redmine Projects tab

You have successfully installed Redmine with Apache and MySQL 8 on Fedora 30/29/31.

Reference:

Redmine Wiki

Other Related Tutorials

Install GoAccess On Fedora 30/Fedora 29

Setup HAProxy Load Balancer on Fedora 30/Fedora 29

Install ManageEngine AssetExplorer on CentOS 7/Fedora 30/29

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment