Setting Up Redmine with LDAP Authentication

Step 1: Install Required Packages

apt-get install gem libapache2-mod-passenger apt-transport-https ca-certificates dirmngr gnupg2 build-essential ruby-dev libxslt1-dev libmariadb-dev libxml2-dev zlib1g-dev imagemagick libmagickwand-dev curl ruby-pg libpq-dev

Step 2: Install Redmine

Download and extract Redmine:

cd /var/www/html/
wget https://www.redmine.org/releases/redmine-5.0.5.tar.gz
tar -xf redmine-5.0.5.tar.gz
mv redmine-5.0.5 redmine

Step 3: Install LDAP and Other Dependencies

apt-get install slapd ldap-utils
gem install bundler

Step 4: Configure Apache Virtual Host

Create a new Apache virtual host configuration file for Redmine:

nano /etc/apache2/sites-available/redmine.conf
Alias /redmine /var/www/html/redmine/public
<Location /redmine>
    PassengerBaseURI /redmine
    PassengerAppRoot /var/www/html/redmine/
</Location>

<Directory /var/www/html/redmine/public>
    Require all granted
    Allow from all
    AllowOverride all
    RailsBaseURI /redmine
    RailsEnv production
    Options -MultiViews
</Directory>

Step 5: Enable Virtual Host and Passenger Module

sudo a2ensite redmine
sudo a2enmod passenger

Step 6: Configure Redmine Database

Edit the config/database.yml file:

nano /var/www/html/redmine/config/database.yml
production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmineuser
  password: "xxxxxxxxxxxx"

Step 7: Configure Redmine Email Settings

Edit the config/configuration.yml file:

nano /var/www/html/redmine/config/configuration.yml
production:
  email_delivery:
    delivery_method: :smtp
  smtp_settings:
    enable_starttls_auto: true
    address: "smtp.dreamhost.com"
    port: 465
    ssl: true
    domain: "domain.com"
    authentication: :login
    user_name: "noreply@domain.com"
    password: "xxxxxxxxxxxx"

Step 8: Install Redmine Dependencies and Initialize Database

cd /var/www/html/redmine
bundle config set --local without 'development test'
bundle install
bundle config set --local without 'development test rmagick'
bundle install
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
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

Step 9: Enable LDAP Authentication

Edit the Redmine configuration file:

nano /var/www/html/redmine/config/configuration.yml

Add LDAP authentication settings:

production:
  ldap:
    enabled: true
    host: ldap://ldap.domain.com
    port: 389
    bind_dn: "cn=admin,dc=domain,dc=com"
    password: "admin_password"
    base_dn: "dc=domain,dc=com"
    attribute: "sAMAccountName"
    ssl: false
    smartcard: false
    timeout: 10

Step 10: Finalize Configuration and Restart Apache

chown www-data:www-data /var/www/html/redmine/ -R
sudo service apache2 reload
systemctl restart apache2

Redmine is now set up with LDAP authentication. Users can log in using their LDAP credentials. Make sure to adjust LDAP settings according to your LDAP server configuration.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top