User Tools

Site Tools


linux:install_redmine

Install Redmine

This page shows how to install Redmine on a CentOS server. We use the bitnami stack to run Redmine.

Prerequisites

You must have a CentOS machine already set up in accordance with the “Install CentOS 6” guide.

By default, the bitnami installer will try to use port 8080/8443 if running as a non root user and 3307 for mysql. We want to use non standard ports so that the server can still use the CentOS supplied MySQL database and Tomcat/Apache. Install these first as root and get them running. Then, when you get to install Bitnami Redmine, the installer will realise the ports are in use and allow you to specify which ports you want to use.

Download Installer

Download the Linux x64 bit of bitnami (latest release) [http://bitnami.com/stack/redmine/installer here].

Create User and Directories

We run redmine as the user 'bitnami'

su -
useradd bitnami
passwd bitnami


mkdir -p /data/bitnami
lvcreate -L 10G -n bitnami datavg
mkfs -t ext4 /dev/mapper/datavg-bitnami
FILENAME=/etc/fstab
echo '/dev/mapper/datavg-bitnami     /data/bitnami          ext4    defaults        1 2' >> $FILENAME
mount -a
chown -R bitnami:bitnami /data/bitnami
chown -R root:root /data/bitnami/lost+found

Install

su
cd /tmp
chmod u+x ./bitnami-redmine-2.3.3-1-linux-x64-installer.run
./bitnami-redmine-2.3.2-1-linux-x64-installer.run
Please select the installation language
Please choose an option [1] : 1
PhpMyAdmin [Y/n] : n
Is the selection above correct? [Y/n]: Y
Select a folder [/home/bitnami/redmine-2.3.2-0]:   (do not enter anything, just press enter)
Login [user]: bitnamiadmin
Password :
Your real name [User Name]: Bitnami Admin
Email Address [mail@example.com]: redmineadmin@example.com
Apache Web Server Port [8080]: 3000
Web Server Port
SSL Port [8443]: 3443
MySQL Server port [3306]: 3307
Please choose an option [4] : 4
Do you want to configure mail support? [y/N]: y
Default email provider:
Please choose an option [1] : 2
Username []: redmine@example.com
Password :
SMTP Host []: mail.example.com
SMTP Port []: 25
Please choose an option [3] : 1
Do you want to continue? [Y/n]: y
...
Setup has finished installing BitNami Redmine Stack on your computer.
Launch Redmine application. [Y/n]: n
Info: To access the BitNami Redmine Stack, go to
http://localhost:3000 from your browser.
Press [Enter] to continue :

Note, the password for bitnamiadmin can also be used to log into the redmine mysql database. However, you will have to use the username root instead of bitnamiadmin.

cd /data/bitnami
ln -s redmine-2.3.2-1 redmine
mv /data/bitnami/redmine/apache2/htdocs/index.html /data/bitnami/redmine/apache2/htdocs/index.html.original

Edit PATH

vi ~/.bash_profile

PATH=$PATH:$HOME/bin; export PATH
PATH="/data/bitnami/redmine/perl/bin:/data/bitnami/redmine/git/bin:/data/bitnami/redmine/sqlite/bin:/data/bitnami/redmine/ruby/bin:/data/bitnami/redmine/subversion/bin:/data/bitnami/redmine/php/bin:/data/bitnami/redmine/mysql/bin:/data/bitnami/redmine/apache2/bin:/data/bitnami/redmine/common/bin:$PATH"

export PATH

Edit Homepage

Rig it so that the default page of the redmine http server will automatically redirect to the redmine homepage (http://server:3000 points to http://server:3000/redmine)

mv /data/bitnami/redmine/apache2/htdocs/index.html /data/bitnami/redmine/apache2/htdocs/index.html.original
cat << EOF >> /data/bitnami/redmine/apache2/htdocs/index.html
<!DOCTYPE HTML>
<html lang="en-GB">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url=http://redmine.example.com:3000/redmine">
        <script type="text/javascript">
            window.location.href = "http://redmine.example.com:3000/redmine"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to 'click' the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow the <a href='http://redmine.example.com:3000/redmine'>link to example</a>
    </body>
</html>
EOF

Open Firewall

su - 
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 3443 -j ACCEPT
service iptables save
service iptables restart
cd /data/bitnami/redmine
./ctlscript.sh start

Create Service

su -
cat << EOF > /etc/init.d/redmine
# chkconfig: 2345 95 20
# description: Script to Start | Stop redmine
PATH="/data/bitnami/redmine/perl/bin:/data/bitnami/redmine/git/bin:/data/bitnami/redmine/sqlite/bin:/data/bitnami/redmine/ruby/bin:/data/bitnami/redmine/subversion/bin:/data/bitnami/redmine/php/bin:/data/bitnami/redmine/mysql/bin:/data/bitnami/redmine/apache2/bin:/data/bitnami/redmine/common/bin:$PATH"; export PATH

REDMINE_USER=bitnami
case $1 in
start)
su $REDMINE_USER -c "sh /data/bitnami/redmine/ctlscript.sh start"
;;
stop)
su $REDMINE_USER -c "sh /data/bitnami/redmine/ctlscript.sh start"
;;
esac
exit 0
END_OF_TEXT

Ensure redmine starts on boot.

su -
chmod u+x /etc/init.d/redmine
chkconfig --add redmine
chkconfig redmine on
service redmine start

Install Plugins

The following commands in this section should be run as the user 'bitnami' unless stated otherwise. For the most part, you should be in the following directory.

cd /data/bitnami/redmine/apps/redmine/htdocs/plugins

If, when trying to run these commands, an error occurs due to the incorrect version of grails run the following and try again

gem install rails -version=<version number>

Periodic Tasks

su - bitnami
cd /data/bitnami/redmine/apps/redmine/htdocs
git clone -b redmine2 https://github.com/jperelli/Redmine-Periodic-Task.git plugins/periodictask
rake redmine:plugins:migrate NAME=periodictask RAILS_ENV=production
crontab -e
5 * * * * cd /data/bitnami/redmine/apps/redmine/htdocs; rake redmine:check_periodictasks RAILS_ENV="production"

Project Overview

Homepage found [https://github.com/mbasset/project_overview| here].

su - bitnami
cd /data/bitnami/redmine/apps/redmine/htdocs/plugins
git clone git://github.com/mbasset/project_overview.git
cd /data/bitnami/redmine/apps/redmine/htdocs
bundle install
bundle exec rake redmine:plugins NAME=project_overview RAILS_ENV=production

Projects Table

su - bitnami
cd /data/bitnami/redmine/apps/redmine/htdocs/plugins
git clone git://github.com/denispeplin/redmine-projects-table.git projects_table

Charts

su - bitnami
cd /data/bitnami/redmine/apps/redmine/htdocs
git clone git://github.com/pharmazone/redmine_charts2 plugins/redmine_charts2
cd plugins/redmine_charts2
git checkout redmine21
cd /data/bitnami/redmine/apps/redmine/htdocs
git clone git://github.com/pullmonkey/open_flash_chart.git plugins/open_flash_chart
cd /data/bitnami/redmine/apps/redmine/htdocs
cp -r plugins/open_flash_chart/assets public/plugin_assets/open_flash_chart
rake redmine:plugins RAILS_ENV=production

Attach Screenshot

su -
yum -y install mercurial
su - bitnami
cd /data/bitnami/redmine/apps/redmine/htdocs/plugins
hg clone https://bitbucket.org/StrangeWill/redmine-inline-attach-screenshot redmine_inline_attach_screenshot

Issue Checklist

Download from http://redminecrm.com. Check it for the latest filename

su - bitnami
FILENAME=redmine_issue_checklist-2_0_5.zip
cd /data/bitnami/redmine/apps/redmine/htdocs/plugins
wget http://redminecrm.com/license_manager/4200/$FILENAME
unzip $FILENAME
rm $FILENAME
bundle exec rake redmine:plugins NAME=redmine_issue_checklist RAILS_ENV=production

My Page Queries

Download from http://redminecrm.com. Check it for the latests filename

su - bitnami
cd /data/bitnami/redmine/apps/redmine/htdocs/plugins
git clone git://github.com/Undev/redmine_my_page_queries.git
rake my_page_queries:upgrade RAILS_ENV=production

Last Updated By

Download from http://redminecrm.com. Check it for the latests filename

su - bitnami
cd /data/bitnami/redmine/apps/redmine/htdocs/plugins
git clone https://github.com/neowit/redmine_last_updated_by_column.git

Backup

We backup to /backup/redmine.

mkdir -p /backup/redmine/apps/redmine/htdocs
mkdir -p /backup/redmine/db_backup

Put the following in backupRedmine.sh in /backup/redmine

PATH=/opt/redmine/perl/bin:/opt/redmine/git/bin:/opt/redmine/sqlite/bin:/opt/redmine/ruby/bin:/opt/redmine/subversion/bin:/opt/redmine/mysql/bin:/opt/redmine/apache2/bin:/opt/redmine/common/bin:/usr/bin:/bin

FILENAME=/backup/redmine/db_backup/redmine_backup_`date +"%A"`.sql
echo "Backing up redmine database to $FILENAME"
/data/bitnami/redmine/mysql/bin/mysqldump -u root -pPASSWORD bitnami_redmine > $FILENAME
echo "Finished backing up redmine database"

echo "Starting file sync"
rsync -a /data/bitnami/redmine/apps/redmine/htdocs/files /backup/redmine/apps/redmine/htdocs
echo "Finished file sync"

exit 0
su - bitnami
crontab -e
45 * * * * cd /backup/redmine; ./backupRedmine.sh

Email

We can create redmine tasks through email. To set this up, see Configure Redmine Email.

In addition, you need to ensure that redmine can email people

vi /data/bitnami/redmine/apps/redmine/htdocs/config/configuration.yml
# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: mail.example.com
      port: 25
      domain: mail.example.com
      authentication: :login
      user_name: redmine@example.com
      password: pa55word

Backup Redmine Manually (Normal)

For this, Redmine has to be running in order to get the database backup.

  • SSH into the machine 'redmine' (redmine is a DNS alias for the server 'atlas').
  • Become the user 'bitnami' (assuming you logged in as a different user)
    su - bitnami
  • Move to the current redmine directory
    cd /data/bitnami/redmine
  • Backup the database
    mysqldump -h localhost -u root -pPASSWORD bitnami_redmine > /backup/redmine/redmine_db_backup_`date +%Y_%m_%d`.sql
  • Backup the files
    rsync -a /data/bitnami/redmine/apps/redmine/htdocs/files /backup/redmine/apps/redmine/htdocs

Backup Redmine Manually (Full)

For this, stop redmine before running the 'backup'.

  • SSH into the machine 'redmine' (redmine is a DNS alias for the server 'atlas').
  • Become the user 'bitnami' (assuming you logged in as a different user)
    su - bitnami
  • Move to the bitnami folder
    cd /data/bitnami
  • Stop redmine
    /data/bitnami/redmine/ctlscript stop
  • Find out which folder 'redmine' is pointing to
    ls -l
  • Backup the whole folder
    tar -zcvf redmine_full_backup_`date +%Y_%m_%d`.tar.gz redmine-2.3.3-1
  • Move to /backup/redmine
    mv ./redmine_full_backup_*.tar.gz /backup/redmine
  • Remember, ideally we don't want to keep this full backup longer than necessary as it will waste space on file3.

Upgrade Redmine

  • SSH into the machine 'redmine' (redmine is a DNS alias for the server 'atlas').
  • Become the user 'bitnami' (assuming you logged in as a different user)
    su - bitnami
  • 'Ensure you have taken BOTH the normal backup and the full backup as shown above.'
  • 'Ensure that redmine is not running.'
    /data/bitnami/redmine/ctlscript.sh stop
  • Using a web browser on the virtual machine go to [http://bitnami.org/stack/redmine] and download the latest bitnami redmine stack.
  • Install the new version using the instructions above. Also install the plugins from scratch. Do not install to /data/bitnami/redmine. Install to /data/bitnami/redmine-x.y.z-a
  • When the installation has finished, move to the base directory
    cd /data/bitnami
  • rm -f redmine
  • ln -s redmine-x.y.z-a redmine
  • Start the new redmine
    ./redmine/ctlscript.sh start
  • Check the website to check that it is working
    http://redmine:3000/redmine
  • Restore the database using the backup database file
    mysql -u root -pPASSWORD bitnami_redmine < /backup/redmine/db_backup/redmine_db_backup_YYY_MM_DD.sql
  • Copy the main configuration file
    cp /data/bitnami/redmine-o.l.d-x/apps/redmine/htdocs/lib/redmine/configuration.rb /data/bitnami/redmine/apps/redmine/htdocs/lib/redmine/configuration.rb
  • Restore the uploaded files
    rsync -a /backup/redmine/apps/redmine/htdocs/files /data/bitnami/redmine/apps/redmine/htdocs
  • cd /data/bitnami/redmine/apps/redmine/htdocs
  • ruby bin/rake db:migrate RAILS_ENV=production
  • ruby bin/rake redmine:plugins RAILS_ENV="production"
  • ruby bin/rake redmine:plugins:migrate RAILS_ENV=production
  • Clean up
    ruby bin/rake tmp:cache:clear
  • Clean up some more
    ruby bin/rake tmp:sessions:clear
  • Restart the stack
    /data/bitnami/redmine/ctlscript.sh stop
  • Restart the stack
    /data/bitnami/redmine/ctlscript.sh start
  • Test redmine via going to http://redmine:3000/redmine. It should be available and all old data should have been re-imported correctly.
  • After confirming the upgrade, take a backup.

Email Settings

/data/bitnami/redmine/apps/redmine/htdocs/config/configuration.yml

# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: mail.example.com
      port: 25
      domain: mail.example.com
      authentication: :login
      user_name: redmine@example.com
      password: pa55word
linux/install_redmine.txt · Last modified: by 127.0.0.1