Created
May 1, 2012 15:47
-
-
Save weivall/2569008 to your computer and use it in GitHub Desktop.
redmine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Define common variables | |
USERNAME=redmine | |
WWW_USERNAME=redmine | |
RUN_WITH_USERNAME="sudo -iu $USERNAME http_proxy=$http_proxy https_proxy=$https_proxy" | |
# Create user with $USERNAME | |
id $USERNAME || sudo useradd -rm $USERNAME | |
# Install apache2 | |
sudo apt-get install apache2 | |
# Install RVM and rvm reqirements | |
sudo apt-get install curl | |
$RUN_WITH_USERNAME bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
# Install packages suggested by rvm-installer | |
sudo apt-get install \ | |
build-essential openssl libreadline6 libreadline6-dev curl \ | |
git-core zlib1g zlib1g-dev libssl-dev libyaml-dev \ | |
libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev \ | |
ncurses-dev automake libtool bison subversion | |
# Prepare environment for Redmine 1.2 | |
## Define versions | |
REDMINE_VERSION=1.4 | |
REDMINE_DIR=/opt/redmine-${REDMINE_VERSION} | |
RUBY_VERSION=1.9.3 | |
GEM_VERSION=1.8.22 | |
## Checkout Redmine | |
sudo svn co http://redmine.rubyforge.org/svn/branches/${REDMINE_VERSION}-stable $REDMINE_DIR | |
## Prepare directory and permissions for the bundler | |
sudo mkdir -p $REDMINE_DIR/.bundle | |
sudo chown $USERNAME:$USERNAME $REDMINE_DIR/.bundle | |
sudo chown $USERNAME:$USERNAME $REDMINE_DIR # necessary to be able to create Gemfile.lock during installation | |
## Install packages necessary to build passenger for apache2 | |
sudo apt-get install libcurl4-gnutls-dev apache2-prefork-dev libapr1-dev libaprutil1-dev | |
## Install packages necessary to build rmagic | |
sudo apt-get install libmagick++-dev | |
## Prepare | |
GEM_INSTALL="gem install --no-rdoc --no-ri" | |
GEM_VERSION_SHORT=${GEM_VERSION//./} | |
cat << EOF | $RUN_WITH_USERNAME bash -e | |
[[ -s "\$HOME/.rvm/scripts/rvm" ]] && source "\$HOME/.rvm/scripts/rvm" && \ | |
rvm install $RUBY_VERSION-gems$GEM_VERSION_SHORT && \ | |
rvm use $RUBY_VERSION-gems$GEM_VERSION_SHORT && \ | |
rvm rubygems $GEM_VERSION && \ | |
rvm gemset create redmine$REDMINE_VERSION && \ | |
rvm use $RUBY_VERSION-gems$GEM_VERSION_SHORT@redmine$REDMINE_VERSION | |
## Install bundler (to make a process of dependencies instalation easier) | |
$GEM_INSTALL bundler | |
## Install passenger | |
$GEM_INSTALL passenger | |
## Build passenger | |
passenger-install-apache2-module -a | |
## Install necessary gems using bundler | |
cd $REDMINE_DIR || exit 1 | |
bundle install --without development test mysql | |
EOF | |
# Install Redmine | |
## Fix some permissions | |
sudo chown root:root $REDMINE_DIR | |
cd $REDMINE_DIR | |
sudo mkdir -p tmp public/plugin_assets | |
sudo chown -R $WWW_USERNAME files log tmp public/plugin_assets db | |
sudo chmod -R 755 files log tmp public/plugin_assets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment