Ubuntu 16.04: Install redmine for project management

This article will describe installing Redmine.

1 Install Redmine

The following script will install Redmine automatically.

  • Input password with expect automatically.
  • root password for MySQL is mysql.
  • MySQL table password for redmine is redmine.
#!/bin/sh

MYSQL_PASSWORD="mysql"
REDMINE_PASSWORD="redmine"

TMP=`mktemp -t ubuntu-mysql.sh.XXXXXX`
trap "rm $TMP* 2>/dev/null" 0

sudo apt install -y expect

cat <<EOF > ${TMP}
set timeout -1
spawn sudo apt install -y mysql-server
expect "New password for the MySQL \"root\" user: "
send "${MYSQL_PASSWORD}\n"
expect "Repeat password for the MySQL \"root\" user: "
send "${MYSQL_PASSWORD}\n"
expect eof
EOF
expect ${TMP}

cat <<EOF > ${TMP}
set timeout -1
spawn sudo apt-get install -y redmine-mysql
expect -re \
"Configure database for redmine/instances/default with dbconfig-common.*"
send "yes\n"
expect "Database type to be used by redmine/instances/default: "
send "mysql\n"
expect "MySQL application password for redmine/instances/default: "
send "${REDMINE_PASSWORD}\n"
expect "Password confirmation: "
send "${REDMINE_PASSWORD}\n"
expect eof
EOF
expect ${TMP}

sudo apt-get install -y apache2 libapache2-mod-passenger bundler
sudo su -c 'cat << EOF > /etc/apache2/mods-available/passenger.conf
<IfModule mod_passenger.c>
  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerDefaultRuby /usr/bin/ruby
  PassengerDefaultUser www-data
  RailsBaseURI /redmine
</IfModule>
EOF'
cd /var/www/html
sudo ln -s /usr/share/redmine/public redmine
sudo chown -R www-data:www-data /usr/share/redmine
sudo su -c 'cat << EOF > /etc/apache2/sites-available/redmine.conf
<Directory /redmine>
  Options FollowSymLinks
  PassengerResolveSymlinksInDocumentRoot on
  AllowOverride None
</Directory>
EOF'
sudo systemctl enable apache2
sudo systemctl restart apache2

2 Access to Redmine

Access to Redmine with the following URL. Default admin user password is admin.

http://<server>/redmine

0001_redmine.png