| 
      1
     | 
    
      h1. HowTo Install Redmine 212 in Ubuntu 1210 and Apache Passenger
 
     | 
  
  
    | 
      2
     | 
    
      
 
     | 
  
  
    | 
      3
     | 
    
      Inspired in "HowTo Install Redmine 210 on Debian Squeeze with Apache Passenger", from this same wiki, so meta-kudos, to the original authors.
 
     | 
  
  
    | 
      4
     | 
    
      
 
     | 
  
  
    | 
      5
     | 
    
      h2. Assumptions
 
     | 
  
  
    | 
      6
     | 
    
      
 
     | 
  
  
    | 
      7
     | 
    
      * We will be using redmine.example.com; so every time you see this below, replace it by your own domain
 
     | 
  
  
    | 
      8
     | 
    
      * For this to work maybe you shold edit /etc/hosts file adding a line "127.0.0.1 redmine.example.com"
 
     | 
  
  
    | 
      9
     | 
    
      * If you are behind a proxy, you could do export http_proxy="http://proxy.domain.tld:port" and the installation should work ok.
 
     | 
  
  
    | 
      10
     | 
    
      
 
     | 
  
  
    | 
      11
     | 
    
      h2. Warming up
 
     | 
  
  
    | 
      12
     | 
    
      
 
     | 
  
  
    | 
      13
     | 
    
      We will first need to install basic packages:
 
     | 
  
  
    | 
      14
     | 
    
      
 
     | 
  
  
    | 
      15
     | 
    
      <pre>
 
     | 
  
  
    | 
      16
     | 
    
      apt-get install ruby rubygems libruby libapache2-mod-passenger ruby-dev
 
     | 
  
  
    | 
      17
     | 
    
      </pre>
 
     | 
  
  
    | 
      18
     | 
    
      
 
     | 
  
  
    | 
      19
     | 
    
      Download the latest version of Redmine (2.1.2 in our case) and untar it, then move it to /usr/local/share
 
     | 
  
  
    | 
      20
     | 
    
      
 
     | 
  
  
    | 
      21
     | 
    
      <pre>
 
     | 
  
  
    | 
      22
     | 
    
      cd /usr/local/share/
 
     | 
  
  
    | 
      23
     | 
    
      wget http://rubyforge.org/frs/download.php/76495/redmine-2.1.2.tar.gz
 
     | 
  
  
    | 
      24
     | 
    
      tar -xzvf redmine-2.1.2.tar.gz
 
     | 
  
  
    | 
      25
     | 
    
      ln -s /usr/local/share/redmine-2.1.2 /usr/local/share/redmine
 
     | 
  
  
    | 
      26
     | 
    
      chown -R root:root /usr/local/share/redmine-2.1.2
 
     | 
  
  
    | 
      27
     | 
    
      </pre>
 
     | 
  
  
    | 
      28
     | 
    
      
 
     | 
  
  
    | 
      29
     | 
    
      Install development libraries for MySQL and Imagick:
 
     | 
  
  
    | 
      30
     | 
    
      
 
     | 
  
  
    | 
      31
     | 
    
      <pre>
 
     | 
  
  
    | 
      32
     | 
    
      apt-get install libmysqlclient-dev libmagickcore-dev libmagickwand-dev (install shitload of packages)
 
     | 
  
  
    | 
      33
     | 
    
      </pre>
 
     | 
  
  
    | 
      34
     | 
    
      
 
     | 
  
  
    | 
      35
     | 
    
      h2. Running the Gem stuff
 
     | 
  
  
    | 
      36
     | 
    
      
 
     | 
  
  
    | 
      37
     | 
    
      Install Bundler (removing useless module, which would otherwise create dependencies):
 
     | 
  
  
    | 
      38
     | 
    
      
 
     | 
  
  
    | 
      39
     | 
    
      <pre>
 
     | 
  
  
    | 
      40
     | 
    
      gem install bundler
 
     | 
  
  
    | 
      41
     | 
    
      cd /usr/local/share/redmine/
 
     | 
  
  
    | 
      42
     | 
    
      bundle install --without development test postgresql sqlite
 
     | 
  
  
    | 
      43
     | 
    
      </pre>
 
     | 
  
  
    | 
      44
     | 
    
      
 
     | 
  
  
    | 
      45
     | 
    
      h2. Creating the database
 
     | 
  
  
    | 
      46
     | 
    
      
 
     | 
  
  
    | 
      47
     | 
    
      On a new installation you need to create the database and a user for redmine.
 
     | 
  
  
    | 
      48
     | 
    
      Open a mysql command prompt:
 
     | 
  
  
    | 
      49
     | 
    
      
 
     | 
  
  
    | 
      50
     | 
    
      <pre>
 
     | 
  
  
    | 
      51
     | 
    
      mysql -u root -p
 
     | 
  
  
    | 
      52
     | 
    
      </pre>
 
     | 
  
  
    | 
      53
     | 
    
      
 
     | 
  
  
    | 
      54
     | 
    
      At the mysql prompt enter the mysql commands:
 
     | 
  
  
    | 
      55
     | 
    
      
 
     | 
  
  
    | 
      56
     | 
    
      <pre>
 
     | 
  
  
    | 
      57
     | 
    
      create user 'redmine' identified by 'redmine';
 
     | 
  
  
    | 
      58
     | 
    
      set password for 'redmine'@'localhost' = password('my_password');
     | 
  
  
    | 
      59
     | 
    
      grant all on redmine.* to 'redmine'@'localhost';
 
     | 
  
  
    | 
      60
     | 
    
      create database redmine;
 
     | 
  
  
    | 
      61
     | 
    
      quit;
 
     | 
  
  
    | 
      62
     | 
    
      </pre>
 
     | 
  
  
    | 
      63
     | 
    
      
 
     | 
  
  
    | 
      64
     | 
    
      h2. Configuration
 
     | 
  
  
    | 
      65
     | 
    
      
 
     | 
  
  
    | 
      66
     | 
    
      Copy /usr/local/share/redmine/config/database.yml.example to /usr/local/share/redmine/config/database.yml and edit this file in order to configure your database settings for "production" environment.
 
     | 
  
  
    | 
      67
     | 
    
      Example for a MySQL database using ruby1.8 or jruby:
 
     | 
  
  
    | 
      68
     | 
    
      
 
     | 
  
  
    | 
      69
     | 
    
      <pre>
 
     | 
  
  
    | 
      70
     | 
    
      production:
 
     | 
  
  
    | 
      71
     | 
    
        adapter: mysql2      (note: For Rails < 3.1 use mysql instead of mysql2)
 
     | 
  
  
    | 
      72
     | 
    
        database: redmine
 
     | 
  
  
    | 
      73
     | 
    
        host: localhost
 
     | 
  
  
    | 
      74
     | 
    
        username: redmine
 
     | 
  
  
    | 
      75
     | 
    
        password: my_password
 
     | 
  
  
    | 
      76
     | 
    
      </pre>
 
     | 
  
  
    | 
      77
     | 
    
      
 
     | 
  
  
    | 
      78
     | 
    
      Generate a session store secret:
 
     | 
  
  
    | 
      79
     | 
    
      
 
     | 
  
  
    | 
      80
     | 
    
      <pre>
 
     | 
  
  
    | 
      81
     | 
    
      rake generate_secret_token
 
     | 
  
  
    | 
      82
     | 
    
      </pre>
 
     | 
  
  
    | 
      83
     | 
    
      
 
     | 
  
  
    | 
      84
     | 
    
      Generate the database structure:
 
     | 
  
  
    | 
      85
     | 
    
      
 
     | 
  
  
    | 
      86
     | 
    
      <pre>
 
     | 
  
  
    | 
      87
     | 
    
      RAILS_ENV=production rake db:migrate
 
     | 
  
  
    | 
      88
     | 
    
      </pre>
 
     | 
  
  
    | 
      89
     | 
    
      
 
     | 
  
  
    | 
      90
     | 
    
      Generate default configuration data:
 
     | 
  
  
    | 
      91
     | 
    
      
 
     | 
  
  
    | 
      92
     | 
    
      <pre>
 
     | 
  
  
    | 
      93
     | 
    
      RAILS_ENV=production rake redmine:load_default_data
 
     | 
  
  
    | 
      94
     | 
    
      </pre>
 
     | 
  
  
    | 
      95
     | 
    
      
 
     | 
  
  
    | 
      96
     | 
    
      (using "es" for Spanish language in terminal prompt)
 
     | 
  
  
    | 
      97
     | 
    
      
 
     | 
  
  
    | 
      98
     | 
    
      h4. Database encryption
 
     | 
  
  
    | 
      99
     | 
    
      
 
     | 
  
  
    | 
      100
     | 
    
      If you want to encrypt your redmine database do as follows:
 
     | 
  
  
    | 
      101
     | 
    
      
 
     | 
  
  
    | 
      102
     | 
    
      # Copy the default config file @/usr/local/share/redmine/config/configuration.yml.example@ to @/usr/local/share/redmine/config/configuration.yml@
 
     | 
  
  
    | 
      103
     | 
    
      # Edit configuration.yml and create a cipher key there for the environment you've used so thus far - production. Be sure to read the comment in this file. They are very detailed and there for you.
 
     | 
  
  
    | 
      104
     | 
    
      # Run: 
 
     | 
  
  
    | 
      105
     | 
    
      
 
     | 
  
  
    | 
      106
     | 
    
      <pre>
 
     | 
  
  
    | 
      107
     | 
    
      rake db:encrypt RAILS_ENV=production
 
     | 
  
  
    | 
      108
     | 
    
      </pre>
 
     | 
  
  
    | 
      109
     | 
    
      
 
     | 
  
  
    | 
      110
     | 
    
      h2. Apache
 
     | 
  
  
    | 
      111
     | 
    
      
 
     | 
  
  
    | 
      112
     | 
    
      Setup Apache's VirtualHost config
 
     | 
  
  
    | 
      113
     | 
    
      
 
     | 
  
  
    | 
      114
     | 
    
      <pre>
 
     | 
  
  
    | 
      115
     | 
    
      # 8080 in this case is because we use a reverse proxy before Apache. Otherwise simply use "*:80"
 
     | 
  
  
    | 
      116
     | 
    
      
 
     | 
  
  
    | 
      117
     | 
    
      <VirtualHost *:8080>
 
     | 
  
  
    | 
      118
     | 
    
       ServerName redmine.example.com
 
     | 
  
  
    | 
      119
     | 
    
       DocumentRoot /usr/local/share/redmine/public
 
     | 
  
  
    | 
      120
     | 
    
       <Directory /usr/local/share/redmine/public>
 
     | 
  
  
    | 
      121
     | 
    
         AllowOverride all
 
     | 
  
  
    | 
      122
     | 
    
         Options -MultiViews
 
     | 
  
  
    | 
      123
     | 
    
       </Directory>
 
     | 
  
  
    | 
      124
     | 
    
      </VirtualHost>
 
     | 
  
  
    | 
      125
     | 
    
      </pre>
 
     | 
  
  
    | 
      126
     | 
    
      
 
     | 
  
  
    | 
      127
     | 
    
      Once you enable this virtual host (a2ensite redmine.example.com) and reload Apache (apache2ctl graceful), you should see your site running on http://redmine.example.com.
 
     | 
  
  
    | 
      128
     | 
    
      
 
     | 
  
  
    | 
      129
     | 
    
      The default login/password is admin/admin (don't forget to change this).
 
     | 
  
  
    | 
      130
     | 
    
      
 
     | 
  
  
    | 
      131
     | 
    
      h2. Sources of inspiration
 
     | 
  
  
    | 
      132
     | 
    
      
 
     | 
  
  
    | 
      133
     | 
    
      We used the following resources as a starting point. Thanks to their respective authors.
 
     | 
  
  
    | 
      134
     | 
    
      
 
     | 
  
  
    | 
      135
     | 
    
      * http://madpropellerhead.com/random/20100820-installing-redmine-on-debian-with-apache (outdated, for Lenny)
 
     | 
  
  
    | 
      136
     | 
    
      * http://www.redmine.org/projects/redmine/wiki/RedmineInstall
 
     | 
  
  
    | 
      137
     | 
    
      * http://hodza.net/2012/03/15/howto-install-redmine-on-debian-6-squeeze-ruby-on-rails-apache2-passenger/
 
     | 
  
  
    | 
      138
     | 
    
      * http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Debian_with_Ruby-on-Rails_and_Apache2-Passenger
 
     |