Pages

Sunday, 8 February 2015

Redmine install steps for shared environment.

Installing Redmine
-------------------

Before you install Remine, you need to make Ruby on Rails installed on clients server. If that not installed then install using cPanel script.

1. Install Ruby

# /scripts/installruby

2. Then install rails,

# gem install rails

You can list all installed gems using below command,

# gem q -L (Check mongrel & fastthread installed)

3. Then Open ports 3000 and 12001 if you’re running a firewall.

You can verify the installed Ruby On Rails by login to any of the cPanel account. There will be a Ruby On Rails option in cPanel.

Now we need to install Redmine (For one particular domain)


1. We need to set-up a Rail environment. A user application environment,

For this you need to login to users cPanel and select Ruby On Rails section. There will be a section "Create Ruby on Rails Application". In that you need to
enter few fields.

App Name: redmine
Application Path: /rails_apps/redmine 
Environment: production

Then hit create. Then, it will create a directory at /home/[username]/rails_apps/[app name].

2. Download the Application

Go to http://www.redmine.org/projects/redmine/wiki/Download to download Redmine.
Upload the application file (redmine-2.4.5.tar.gz) to ~/rails_apps directory and extract.
Replace the default cPanel Redmine directory with the one we downloaded.


3. Setup a DB and a DB user

Go to cPanel and MySQL section create a DB and a user to Manage Redmine. Give the user full access over the DB,

4. Connects Rails with the Database (Give SSH accesss to the cPanel user)

a) If you logged in as user then switch the user as cPanel user.
b) Change directories to our rails_apps/redmine directory:

# cd rails_apps/redmine

c) Copy config/database.yml.example to config/database.yml and edit this file in order to configure our database settings for "production" environment:

# cp config/database.yml.example config/database.yml

d) Edit the file to add our MySQL credentials we created in step for DB:

production:
  adapter: mysql2
  database: [DB_Name]
  host: localhost
  username: [DB_User]
  password: [DB_User_Password]
  encoding: utf8
 
5. Then run few command as cPanel user: (Execute all commands within our App directory ""rails_apps/redmine"")

# bundle install (If you get any permission error then add the option ""--path vendor/bundle"" with the command )
# bundle install --path vendor/bundle

# rake generate_secret_token

6. To create tables and an administrator account:

# RAILS_ENV=production rake db:migrate

7. Insert default configuration data in database, by running the following command:

# RAILS_ENV=production rake redmine:load_default_data

8. After all this, setup a sub-domain for Redmine

Create sub-domain from cPanel.

9. Create symlink

We remove the folder that created with the creation of sub-domain and create symlink from our app directory.

# cd ~/public_html
# rm -rf redmine
# ln -s ~/rails_app/redmine/public redmine


10. Setting redirection.

Edit ~/rails_apps/redmine/public/.htaccess (Login as user)

Options -Multiviews
RewriteRule ^(.*)$ "http://127.0.0.1:3000%{REQUEST_URI}" [P,QSA,L]

11. Then browse your sub-domain to see the Redmine app.

Admin logins are

User: admin
Pass: admin

12. Don't forget to start the Redmine server.

# ruby script/rails server webrick -e production

Keep in mind that, you need to start the ruby redmine server in screen.

All good now and the sub-domain will load the Redmine app :)