Redmine is a robust project management solution for software development teams to use. Some of the features that Redmine offers are SVN integration, Issue tracking, RSS feeds, and LDAP Authentication. Below I will detail the installation process, and pre-installation requirements for setting up and configuring your own Redmine server.
Before we begin though you should be comfortable with the following:
- linux command line
- using sudo
- using vim or vi (we are not doing much, just editing and saving)
For this tutorial, all commands are done using superuser (sudo su), or you can prefix sudo to each command.
Package Installations
Optional Installs
Since this tutorial is for a completely new install of Ubuntu with no additional packages selected during installation, there are a few packages that need to be installed.
Install Vim
Throughout this tutorial, I will be using vim to edit files. If you are unfamiliar with vim or vi you may want to use another file editor.
- Install Vim
apt-get install vim
Install SSH
If SSH has not been installed on the Ubuntu server you are using, it is recommend that you install it. Although not necessary, it makes the rest of the tutorial easier.
- Install SSH
apt-get install ssh
- Configure SSH to deny root logon.
vim /etc/ssh/sshd_config
Change the line
PermitRootLogin yes
to
PermitRootLogin no
- Restart SSH
/etc/init.d/sshd restart
Now you will be able to connect to your Ubuntu server using an ssh client like putty.
Required Installs
Since Redmine will be working with subversion, Apache, PostgreSQL (you can use MySQL if you like), ruby, rails, passenger, etc; there are a lot of packages to install.
Apt-get Installs
- Install the following packages using apt-get install
- apache2-threaded-dev
- build-essential
- libapache2-mod-passenger
- libapache2-mod-perl2
- libapache2-svn
- libapache-dbi-perl
- libauthen-simple-ldap-perl
- libcurl4-openssl-dev
- libdbd-pg-perl
- libdbd-pg-ruby1.8
- libdigest-sha1-perl
- libgemplugin-ruby1.8
- libmagick9-dev
- libruby1.8-extras
- php5
- php5-curl
- php5-dev
- php5-pgsql
- postgresql
- rails
- rake
- ruby1.8-dev
- rubygems1.8
- sendmail
- subversion
Gem Installs
Redmine runs with ruby on rails and uses several ruby gems. To install these gems, run the following commands.
- gem install rails -v=2.3.5
- gem install rack -v=1.0.1 (should been installed by the previous command)
- gem install rmagick
- gem install passenger
- gem install pg
- gem install -v=0.4.2 i18n
Redmine Install
This section details the installation and configuration setups for the command line part the installation.
PostgreSQL database setup
- Sudo as the user postgres and connect to the default database
sudo –u postgres psql postgres
- Create the redmine database user “redmine”
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'somePassword' NOINHERIT VALID UNTIL 'infinity';
- Create the database for Redmine called redmine
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
- Exit out of psql
\q
Installing Redmine Files
- Create the Redmine install directory
mkdir /opt/redmine
- Checkout the stable Redmine installation
svn co http://redmine.rubyforge.org/svn/branches/1.1-stable /opt/redmine
- Enter the Redmine installation directory
cd /opt/redmine
- Setup permissions for Apache
chown -R www-data:www-data files log tmp public/plugin_assets/ chmod -R 755 files log tmp public/plugin_assets/
Configure the Redmine Database Settings
- Change directory to the config directory
cd /opt/redmine/config
- Create the database configuration file
cp database.yml.example database.yml
- Edit the database configuration file
vim database.yml
- Make the production setting look like this
production: adapter: postgresql database: redmine host: localhost username: redmine password: your_redmine_database_password encoding: utf8
- Save the file (press esc, type :wq, press enter)
Configure the Redmine Email Settings
- Change directory to the config directory
cd /opt/redmine/config
- Create the email configuration file
cp email.yml.example email.yml
- Edit the email configuration file
vim email.yml
- Make the production setting look like this
production: delivery_method::sendmail #smtp_settings: #address: smtp.example.net #port: 25 #domain: example.net #authentication::login #user_name: "redmine@example.net" #password: "redmine"
- Save the file
Setup the Redmine Database
- Change directory to /opt/redmine
cd /opt/redmine
- Generate the session store
rake generate_session_store
- Migrate the database (this is a command to run)
RAILS_ENV=production rake db:migrate
- Load the default information into the database
RAILS_ENV=production rake redmine:load_default_data
- You will be prompted for what language you would like to use. Press enter for English.
- Press Enter again
Apache Configuration
Setup passenger
- Enable Passenger
a2enmod passenger
- Edit the Passenger configuration file
vim /etc/apache2/mods-available/passenger.conf
- Add the line
PassengerDefaultUser www-data
Link the Redmine.pm file
- Change directory to Apaches perl module directory
cd /usr/lib/perl5/Apache
- Create a softlink to the Redmine.pm file
ln -s /opt/redmine/extra/svn/Redmine.pm Redmine.pm
Link to the Redmine public folder
- Change directory to the document root for Apache
cd /var/www
- Create a softlink to the public folder of redmine
ln -s /opt/redmine/public redmine
Create the SVN Repositories Directory and Set Permissions
- Create the repository directory
mkdir -p /var/svn/repos
- Set permissions for Apache
chown -R www-data:root /var/svn
Create a SSL Certificate for the Site
If your site already has a signed SSL certificate from a legitimate certificate authority, you can skip this part of the tutorial.
- Create a self signed ssl cert
openssl req -new -x509 -days 365 -nodes -out /etc/ssl/certs/cert.pem -keyout /etc/ssl/certs/cert.pem
- Enter in your information companies’ for each prompt, or accept the defaults
Enable Needed Apache Modules and Create the Redmine Site
- Enable the following Apache modules using the a2enmod command
- dav_svn
- perl
- ssl
- rewrite
<VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www PerlLoadModule Apache::Redmine PerlLoadModule Authen::Simple::LDAP # PerlLoadModule IO::Socket::SSL RailsEnv production RailsBaseURI /redmine <Directory /opt/redmine/public> Options FollowSymLinks AllowOverride none Order deny,allow Allow from all </Directory> #This holds the configuration for the web accessible svn <Location /svn> DAV svn SVNParentPath "/var/svn/repos" AuthType Basic AuthName redmine Require valid-user PerlAccessHandler Apache::Authn::Redmine::access_handler PerlAuthenHandler Apache::Authn::Redmine::authen_handler RedmineDSN "DBI:Pg:dbname=redmine;host=localhost" RedmineDbUser "redmine" RedmineDbPass "your_redmine_password" RedmineCacheCredsMax 50 </Location> #Used by reposman.rb to create repos for new Redmine projects <Location /sys> Order deny,allow Allow from 10.30.100.202, 127.0.0.1 Deny from all </Location> SSLEngine on SSLCertificateFile /etc/ssl/certs/cert.pem SSLCertificateKeyFile /etc/ssl/certs/cert.pem </VirtualHost>
/etc/init.d/apache2 restart
Setup Automatic Subversion Repository Creation
- Make the Redmine log file location
mkdir /var/log/redmine
- Create the log file
touch /var/log/redmine/reposman_errors.log
- Edit the Crontab (you may want to make a backup first)
crontab -e
- Select an editor from the presented list (I selected nano, number 2)
- Add this line to the bottom of the file (this is one continuous line broken up for readability), This line tells the cron to run this job every minute.
* * * * * ruby /opt/redmine/extra/svn/reposman.rb -r https://your_server_ip/redmine -s /var/svn/repos -o www-data --url file:///var/svn/repos >> /var/log/redmine/reposman_errors.log #Add new repos for projects
- Press Ctrl + O to save the file
- Press Enter to confirm the file name
- Press Ctrl + X to exit nano
Optional Configurations
Disable Directory Browsing in Apache
We do not want people to be able to browse the files in our webroot, so let’s block that.
- Edit the default site configuration file
- vim /etc/apache2/sites-available/default
- Under the <Directory /var/www> section add a – infront of the word Indexes so the line looks like this
Options -Indexes FollowSymLinks MultiViews
- Do the same for /etc/apache2/sites-available/default-ssl
- Restart Apache
/etc/init.d/apache2 restart
Redirect all HTTP traffic to HTTPS
- Edit the default site configuration file
vim /etc/apache2/sites-available/default
- Add the following lines after the DocumentRoot statement (do not change SERVER_NAME or SERVER_PORT, they are variables)
RewriteEngine on RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] RewriteLogLevel 2
- Restart Apache
/etc/init.d/apache2 restart
Configuring The Rest of Redmine Via a Web Browser
- Open Firefox or you favorite browser and navigate to https://yourIPAddress/redmine. For example, https://example.page.com/redmineYou should see this page:
Change the admin account information (defaults are bad!)
- Click the “sign in” link in the upper right corner of the page.
- Sign in with the following credentials
username: admin password: admin
- Click the “Administration” link in the upper left part of the page
- Click the “Users” link
- Click the username (which is a link) of the admin user
- Change the accounts information (especially the password)
- Click the save button
Configure the Redmine Server Settings
- After signing in as a user with administrator rights, click the “Administration” link in the upper left part of the screen
- Click the
link
- Under the General tab
- Change Host Name and Path from localhost:3000 to your.server.com/redmine (ex. example.demo.com/redmine)
- Change Protocol from HTTP to HTTPS
- Click the Save button
- Under the Authentication tab
- Check “Authentication Required”
- Check “Enable REST Web Service”
- Change Minimum Password Length from 4 to 8
- Click the Save button
- Under the Projects tab
- Change the “Role given to non-admin users who creates a project” from “–Please Select–” to Manager
- Click the Save button
- Under the Email Notifications tab
- Change the “http://hostname/my/account” part in the “Emails footer” field to https://yourSeverAddress/redmine/my/account (for example: https://demo.example.com/redmine/my/account)
- Click the Save button
- Under the Repositories tab
- Check “Enable WS for repository management”
- Check “Filesystem”
- Click the Save button
Add LDAP Authentication (Optional)
- Click the Administration link in the upper left corner of the page
- Click the
link
- Click the
link
- Fill out the form as shown below, substituting in your own Active Directory domain information. Do not alter the values for the Attributes section, these are domain type specific.
- If you want to manually create users who authenticate against AD, then uncheck “On-the-fly user Creation”, else their account will be created on the first login attempt.
- Click the Create button. If all went well, you should be able to authenticate against Active Directory.
- When creating new accounts, you will now have to select what authentication source you want to use.
Creating Your First Redmine Project
- Click the Projects link in the upper left corner of the page
- Click the
link
- Enter a Name for the project
- Enter a Identifier for the project
- The identifier is user to access your svn repository, so if you have an identifier of tstprj your
- repository will be available at https://yourServer/svn/tstprj
- If you want a private project, only accessible by the members of the project, uncheck Public
- Click the Save button
- Click the Projects link in the upper left corner of the page
- Click the link to the project you just made
- Click the Settings link
- Click the Members tab
- Select the members you would like to add and their role for the project form the list on the left
- Click the Add button
- Ignore repository tab as the cronjob we created earlier should create an svn reposity and link it to the project for you.
If you have made it this far and everything is working as expected, then Congratulations!!! You have setup your very own Redmine server with Subversion integration. If things are not working, I recommend looking at the HowTo’s other documentation at redmine.org
