@JS's Notes

Site with notes from my work.

Redmine on Ubuntu 20.04

2020-09-20 System @JS

My test platform: Ubuntu Server 20.04.1

Requirements: user with root privileges or non-root user with sudo privileges.

Apache and MariaDB installation
$ sudo apt install apache2 mariadb-server libapache2-mod-passenger -y

On Ubuntu, the services should be started automatically immediately after packages pre-configuration is complete.

$ sudo systemctl status apache2.service; sudo systemctl status mariadb.service
MariaDB configuration
$ sudo mysql_secure_installation

Enter current password for root (enter for none):
Set root password? [Y/n]: Y
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y
Redmine installation

Redmine package is available in the Ubuntu Server 20.04 default repository:

$ sudo apt install redmine redmine-mysql -y

During the installation, you will be asked to configure Redmine. Click on the YES button. Next select database as mysql and click on the OK button. Provide a password for Redmine to register with the database and click on the OK button to finish the installation.

Next, you will need to install gem bundler packages:

$ sudo gem install bundler

Create a symbolic link of Redmine directory to Apache web root directory:

$ sudo ln -s /usr/share/redmine/public /var/www/html/redmine

Create a lock file for Redmine:

$ sudo touch /usr/share/redmine/Gemfile.lock

Give proper permissions to the Redmine:

$ sudo chown www-data:www-data /usr/share/redmine/Gemfile.lock
$ sudo chown -R www-data:www-data /var/www/html/redmine
Configuration Apache for Redmine

Next, you will need to edit /etc/apache2/mods-available/passenger.conf file and add after <IfModule mod_passenger.c> PassengerDefaultUser www-data:

<IfModule mod_passenger.c>
  PassengerDefaultUser www-data
  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerDefaultRuby /usr/bin/ruby
 </IfModule>

Next, create an Apache virtual host file for Redmine. Add the following content to the /etc/apache2/sites-available/redmine.conf file. Remember to replace ServerAdmin, DocumentRoot, ServerName, ServerAlias with the actual values for your environment.

<VirtualHost *:80>
     ServerAdmin admin@local.lnxorg
     DocumentRoot /var/www/html/redmine
     ServerName local.lnxorg
     ServerAlias www.local.lnxorg

     <Directory /var/www/html/redmine>
         RailsBaseURI /redmine
         PassengerResolveSymlinksInDocumentRoot on
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable Redmine virtual host, Apache rewrite module and restart Apache service to apply all the changes:

$ sudo a2ensite redmine && sudo a2enmod rewrite
$ sudo systemctl restart apache2.service; sudo systemctl status apache2.service
Access to Redmine Web Interface
  • Open your web browser and type the URL of the Redmine installation (in my example http://local.lnxorg).
  • Click on the Sign In button, you will be redirected to the Redmine login page.
  • Provide username as admin and password admin, then click on the Login button.
  • Change your current password and click on the Apply button. You will be logged in to Redmine.

Reference: Redmine Doc.