Installing Redmine2.0.1 Ruby-1.9.3 Rubygems-1.8.24

The first thing that needs to be done, is to install ruby's latest.

  1. Download the latest ruby from ruby-forge.com ruby-1.9.3.tar.gz:
    Run these commands to extract it and then install it:

    >tar xvfz ruby-1.9.3.tar.gz
    >cd ruby-1.9.3
    >./configure
    >make
    >make install
    

    Check to see if it installed correctly.

    >ruby -v
    >ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
    
  2. Next we need to install the latest rubygem also from rubyforge. rubygems-1.8.24.tgz

    >tar xvfz rubygems-1.8.24.tgz
    >cd rubygems-1.8.24
    >ruby setup.rb
    

    Check to see if it installed

    >gem -v
    /usr/local/lib/ruby/1.9.1/yaml.rb:56:in `':
    It seems your ruby installation is missing psych (for YAML output).
    To eliminate this warning, please install libyaml and reinstall your ruby.
    1.8.24
      
  3. If you get the above error, you have to install yaml, and then re-install ruby..

    >tar xvfz yaml-0.1.4.tar.gz
    >cd yaml-0.1.4
    >./configure
    >./make
    >./make install
    ## re-install ruby right over the top of the old install, don't need to remove!
    
  4. Next install passenger.

    > gem install passenger
    Fetching: fastthread-1.0.7.gem (100%)
    Building native extensions.  This could take a while...
    Fetching: daemon_controller-1.0.0.gem (100%)
    Fetching: rack-1.4.1.gem (100%)
    Fetching: passenger-3.0.12.gem (100%)
    Successfully installed fastthread-1.0.7
    Successfully installed daemon_controller-1.0.0
    Successfully installed rack-1.4.1
    Successfully installed passenger-3.0.12
    4 gems installed
    Installing ri documentation for fastthread-1.0.7...
    Installing ri documentation for daemon_controller-1.0.0...
    Installing ri documentation for rack-1.4.1...
    Installing ri documentation for passenger-3.0.12...
    Installing RDoc documentation for fastthread-1.0.7...
    Installing RDoc documentation for daemon_controller-1.0.0...
    Installing RDoc documentation for rack-1.4.1...
    Installing RDoc documentation for passenger-3.0.12...
    etc
    
  5. Add the paths, permissions, users, groups needed for redmine. I have a script. addweb-redmine.sh

     
      >./addweb-redmine.sh  (answer the questions)
    ## add gail and db0, db1, db9 dirs
    >mkdir /data/db0 /data/db1 /data/db9
    >ln -s /data/db0 /db0
    >ln -s /data/db1 /db1
    >ln -s /data/db9 /db9
    
    >echo 'gail:x:2916:201:Gail Binkley, L317, 498-7145, Lane:/home/gail:/bin/tcsh' >> /etc/passwd
    >echo 'gail:XXXXXXXXXXXX:1::::::' >> /etc/shadow
    >echo 'gail:*:201:gail' >> /etc/group
    >mkdir /home/gail;chown gail:gail /home/gail
    Add her to sudoers
    >visudo
    add gail ALL(ALL)
    
      
  6. add emacs if the kickstart hasn't already done so.

    >scp admin@starter:/share/kickstart/rpms.rhel58/emacs* /tmp
    >rpm -i emacs*
    >add xorg-x11-fonts-ISO8859-1-75dpi-7.2-9.1.el6.noarch.rpm if requested
    
  7. Run the passenger install check script.(This will check to make sure you have the right pieces) Like apr-devel, and apr-utils-devel, and others. Install with yum.

    >passenger-install-apache2-module
    > yum install httpd-devel
    >yum install apr-devel 
    >yum install apr-util-devel
    
  8. When the pssenger script is done it should spit out the following to install in apache configs..

    >passenger-install-apache2-module
    
    snip > it will do a whole lot of compliling then finish if successful with this:
    --------------------------------------------
    The Apache 2 module was successfully installed.
    
    Please edit your Apache configuration file, and add these lines:
    
       LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
       PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13
       PassengerRuby /usr/local/bin/ruby
    
    AND:
    --------------------------------------------
    Deploying a Ruby on Rails application: an example
    
    Suppose you have a Rails application in /somewhere. Add a virtual host to your
    Apache configuration file and set its DocumentRoot to /somewhere/public:
    
       <VirtualHost *:80>
          ServerName www.yourhost.com
          # !!! Be sure to point DocumentRoot to 'public'!
          DocumentRoot /somewhere/public    
          <Directory /somewhere/public>
             # This relaxes Apache security settings.
             AllowOverride all
             # MultiViews must be turned off.
             Options -MultiViews
          </Directory>
       </VirtualHost>
    
    
  9. Load and install the redmine download redmine-2.0.1.tar.gz from rubyforge.org

    ## load and install redmine
    >cd /share/sgd-vm02/www.data_redmine
    >cp /tmp/redmine-2.0.1.tar.gz .
    >tar xvfz redmine-2.0.1.tar.gz
    >ln -s redmine-2.0.1 redmine
    ## change permissions for redmine to apache:apache or redmine if that is the way to go.
    some files are required to be owned by apache, log, files, tmp. public
    
  10. Install Rails:

    >gem install rails  (this loads alot of stuff)
    Successfully installed i18n-0.6.0
    Successfully installed multi_json-1.3.6
    Successfully installed activesupport-3.2.5
    Successfully installed builder-3.0.0
    Successfully installed activemodel-3.2.5
    Successfully installed rack-cache-1.2
    Successfully installed rack-test-0.6.1
    Successfully installed journey-1.0.3
    Successfully installed hike-1.2.1
    Successfully installed tilt-1.3.3
    Successfully installed sprockets-2.1.3
    Successfully installed erubis-2.7.0
    Successfully installed actionpack-3.2.5
    Successfully installed arel-3.0.2
    Successfully installed tzinfo-0.3.33
    Successfully installed activerecord-3.2.5
    Successfully installed activeresource-3.2.5
    Successfully installed mime-types-1.18
    Successfully installed polyglot-0.3.3
    Successfully installed treetop-1.4.10
    Successfully installed mail-2.4.4
    Successfully installed actionmailer-3.2.5
    Successfully installed rack-ssl-1.3.2
    Successfully installed thor-0.15.2
    Successfully installed railties-3.2.5
    Successfully installed bundler-1.1.4
    Successfully installed rails-3.2.5
    27 gems installed
    
    
  11. Edit the gemfile to make sure the versions match what is in the gemfile!! muy importante!!:

    example:
    source 'http://rubygems.org'
    
    gem 'rails', '3.2.6'
    gem 'prototype-rails', '3.2.1'
    gem "i18n", "~> 0.6.0"
    gem "coderay", "~> 1.0.6"
    gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
    gem "builder"
    
    ## you can comment out blocks that you don't need such as postgress/sqlite etc.
    # Database gems
    #platforms :mri, :mingw do
    #  group :postgresql do
    #    gem "pg", ">= 0.11.0"
    #  end
    
    #  group :sqlite do
    #    gem "sqlite3"
    #  end
    #end
    
    platforms :mri_18, :mingw_18 do
      group :mysql do
        gem "mysql"
      end
    end
    
    platforms :mri_19, :mingw_19 do
      group :mysql do
        gem "mysql2"
      end
    end
    
    

    To find the gem versions type:

    >gem list
    *** LOCAL GEMS ***
    
    actionmailer (3.2.6)
    actionpack (3.2.6)
    activemodel (3.2.6)
    activerecord (3.2.6)
    activeresource (3.2.6)
    activesupport (3.2.6)
    arel (3.0.2)
    bigdecimal (1.1.0)
    builder (3.0.0)
    bundler (1.1.4)
    coderay (1.0.6)
    daemon_controller (1.0.0)
    erubis (2.7.0)
    fastthread (1.0.7)
    hike (1.2.1)
    i18n (0.6.0)
    io-console (0.3)
    journey (1.0.4)
    json (1.7.3, 1.5.4)
    mail (2.4.4)
    metaclass (0.0.1)
    mime-types (1.19, 1.18)
    minitest (2.5.1)
    mocha (0.11.4)
    multi_json (1.3.6)
    mysql (2.8.1)
    mysql2 (0.3.11)
    net-ldap (0.3.1)
    passenger (3.0.13)
    polyglot (0.3.3)
    prototype-rails (3.2.1)
    rack (1.4.1)
    rack-cache (1.2)
    rack-openid (1.3.1)
    rack-ssl (1.3.2)
    rack-test (0.6.1)
    rails (3.2.6)
    railties (3.2.6)
    rake (0.9.2.2)
    rdoc (3.12, 3.9.4)
    ruby-openid (2.1.8)
    shoulda (2.11.3)
    sprockets (2.1.3)
    thor (0.15.3)
    tilt (1.3.3)
    treetop (1.4.10)
    tzinfo (0.3.33)
    yard (0.8.2.1)
    
    
  12. run the bundle install: (this will install the needed from the Gemfile) If it can't find the gem you will get an error, or if the versions don't match

    >bundle install
    Fetching gem metadata from http://rubygems.org/.......
    Using rake (0.9.2.2) 
    Using i18n (0.6.0) 
    Using multi_json (1.3.6) 
    Using activesupport (3.2.6) 
    Using builder (3.0.0) 
    Using activemodel (3.2.6) 
    Using erubis (2.7.0) 
    Using journey (1.0.4) 
    Using rack (1.4.1) 
    Using rack-cache (1.2) 
    Using rack-test (0.6.1) 
    Using hike (1.2.1) 
    Using tilt (1.3.3) 
    Using sprockets (2.1.3) 
    Using actionpack (3.2.6) 
    Installing mime-types (1.19) 
    Using polyglot (0.3.3) 
    Using treetop (1.4.10) 
    Using mail (2.4.4) 
    Using actionmailer (3.2.6) 
    Using arel (3.0.2) 
    Using tzinfo (0.3.33) 
    Using activerecord (3.2.6) 
    Using activeresource (3.2.6) 
    Using bundler (1.1.4) 
    Installing coderay (1.0.6) 
    Installing json (1.7.3) with native extensions 
    Installing metaclass (0.0.1) 
    Installing mocha (0.11.4) 
    Installing net-ldap (0.3.1) 
    Using rack-ssl (1.3.2) 
    Installing rdoc (3.12) 
    Using thor (0.15.3) 
    Using railties (3.2.6) 
    Using rails (3.2.6) 
    Installing prototype-rails (3.2.1) 
    Installing ruby-openid (2.1.8) 
    Installing rack-openid (1.3.1) 
    Installing shoulda (2.11.3) 
    Installing yard (0.8.2.1) 
    Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
    Post-install message from rdoc:
    
    

    If you have problems installing the gem mysql-2.8.1 then run this command!.

    >bash-3.2# gem install mysql -- --with-mysql-dir=/tools/mysql/5.5.25
    ## also may have gem install activerecord-mysql-adapter failure!!!!
    ## change the ../public/config/database.yml adapter line from mysql to mysql2
    ## and then install mysql2:
    >gem install mysql2 -- --with-mysql-dir=/tools/mysql/5.5.25 
    
    this will install correctly.
    

    If you get the rmagik failure, know this is not needed

    ## comment out the whole list in the Gemfile
    >vi Gemfile
    # Optional gem for exporting the gantt to a PNG file, not supported with jruby
    #platforms :mri, :mingw do
     # group :rmagick do
        # RMagick 2 supports ruby 1.9
        # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
        # different requirements for the same gem on different platforms
    #    gem "rmagick", ">= 2.0.0"
    #  end
    #end
    ## then rerun bundle install
      
  13. Create a simple database just to get things up and running, make major changes later.:

    # prep the mysql to run and be ready.
    ## make a my.cnf file
    >vi /etc/my.cnf
    ## first make a database:
    >/tools/mysql/5.5.25/scripts/mysql_install_db --user=mysql --ldata=/db0/mysql/data/redmine
    ## might need to set the PATH:
    >export PATH=$PATH:/tools/mysql/current/bin
    ## and run it from /tools/mysql/current   not sure why but this way worked.
    start the database
    >./bin/mysqld_safe --datadir=/db0/mysql/data/redmine --user=mysql &
    ## or you can use mysqld_multi so you can have multiple instances running and stops certain ones.
    >./bin/mysqld_multi start  (stop)
    ## log on to the database.
    >mysql -u root   (-p if there is a password)
    ## create a password if you want
    >set password for root@localhost=passwd('redmine');
    ## create a database redmine
    >create database redmine;
    ## show the new database
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | redmine            |
    | test               |
    +--------------------+
    5 rows in set (0.00 sec)
    
    
    
  14. Change the password field in ../redmine/config/database.yml:

    production:
      adapter: mysql2
      database: redmine
      host: localhost
      username: redmine
      password: redmine <-------HERE
      encoding: utf8
      socket: /db0/mysql/admin/encode/mysql.sock
    
    

    Run the redmine database commands to get the default redmine migrated:

    >rake generate_session_store (old pre redmine-2.0)
    >rake generate_secret_token
    >RAILS_ENV=production rake db:migrate
    >RAILS_ENV=production rake redmine:load_default_data
      
  15. Restart apache as often as possible:

    >/usr/sbin/apachectl graceful
    
  16. Make sure you clear your cache!!!:

  17. Bring up your browser for redmine and see if it works.

  18. Added issue with Redmine "page not found" on issue links!!

    ## check the log files to see what the errors are:
    ActionController::RoutingError (No route matches {:action=>"show", :controller=>"issues", :id=>nil}):
      app/views/issues/show.html.erb:17:in `_app_views_issues_show_html_erb___1961913956454137140_168955960'
      app/controllers/issues_controller.rb:118:in `block (2 levels) in show'
      app/controllers/issues_controller.rb:115:in `show'
    

    go to the file show.html-erb

    $ cd /share/sgd-vm03/www-data_redmine/redmine/app/views/issues
    $ vi show.html.erb
    Change this code below:
    
      <% if @prev_issue_id || @next_issue_id %>
        <div class="next-prev-links contextual">
          <%= link_to_if @prev_issue_id,
                         "\xc2\xab #{l(:label_previous)}",
                         issue_path(@prev_issue_id),
                         :title => "##{@prev_issue_id}" %> |
          <% if @issue_position && @issue_count %>
            <span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
          <% end %>
          <%= link_to_if @next_issue_id,
                         "#{l(:label_next)} \xc2\xbb",
                         issue_path(@next_issue_id),
                         :title => "##{@next_issue_id}" %>
        </div>
      <% end %>
    
    ## To this code below:
    
        <% if @prev_issue_id %>
          <%= link_to "\xc2\xab #{l(:label_previous)}",
                      issue_path(@prev_issue_id),
                      :title => "##{@prev_issue_id}" %> |
        <% end %>
        <% if @issue_position && @issue_count %>
          <span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
        <% end %>
        <% if @next_issue_id %>
          <%= link_to "#{l(:label_next)} \xc2\xbb",
                      issue_path(@next_issue_id),
                      :title => "##{@next_issue_id}" %>
        <% end %>
    
    
  19. That did the trick