How to Install Redmine 1.4 with cPanel 11.32

The reason I repost this article is because my previous article is old enough and I still can see the demand on this task.

Requirement:
– Ruby On Rails 1.8.x enabled, please downgrade to 1.8.7, 1.9.2 or 1.9.3 if your are running higher than that. To check the Ruby version, type “ruby -v” from shell.
– Shell Access(SSH) enabled
– MySQL Enabled
– Rubygems <= 1.8

Pre-Step:
1. Install gem rails version 2.3.14(exact version), from SSH shell, run

gem install rails -v=2.3.14

2. Install gem rack version 1.1.3, from SSH shell, run

gem install rack -v=1.1.3

3. Install gem rubygems 1.8.23(or higher version, not >= 1.8), from SSH shell, run

rubygems-update

If it is not working, refer to http://www.mickgenie.com/how-to-update-rubygems/.
4. Create MySQL database from your cPanel and I assume that you are using the database as detail below.
Database Name: mickgenie_redmine
Username: mickgenie_redmine
Password: StR0NgPa$$w0Rd

Installation Step:
1. Log into the cPanel, click on Ruby On Rails.
2. In the App Name, enter Redmine, environment session select Production and create the App.
3. Click on Create Rewrite button and enter the subdomain or path that needed, then save it.
4. Download Redmine from RubyForce.
5. Upload through File Manager according to the path that you created from the Ruby On Rails.
6. Extract the file to the RoR Apps.
7. Install bundler gem by enter,

gem install bundler

8. Now, run the following command to install all the required gem from Redmine,

bundle install --without development test postgresql

9. Rename the in config/database.yml.example to config/database.yml.
10. Open the database.yml file and look for the production section.
11. Modify the production section as detail below.
production:
adapter: mysql
database: mickgenie_redmine
host: localhost
username: mickgenie_redmine
password: StR0NgPa$$w0Rd

(These information is create as above).
12. Create session store secret.

rake generate_session_store

13. Create the database structure.

RAILS_ENV=production rake db:migrate

14. Create default data.

RAILS_ENV=production rake redmine:load_default_data

15. You have done the installation, just go to cPanel and start the mongrel.

Final Step:
You may now log into Redmine with detail below,
Username: admin
Password: admin

Apps Sharing: Redcar

Redcar is an apps that written in Ruby and run on JRuby, it is a useful text editor. It’s currently in active development and it’s getting quite mature.

With Redcar, everything is a plugin and every new plugin will written in Ruby where it is very easy to use by an user. At the moment, Redcar is still not in development product and still under alpha version where you may just install it through the RubyGems.

To install Redcar, it is very simple. All you should done is install Ruby on Rails with RubyGems.

gem install redcar
redcar install

Try it today by browse to the Redcar site.

how to update Rubygems

Today, I got another challenge from @thebosscat to help out the Ruby on Rails case.

Symptoms: the server using RubyGems 1.2.0 and all of the ruby gems could not able updated through “gem update” or even “gem update –system”.

To overcome the problem, I was trying to update the rubygems as step below.
1. Download rubygems version from URL below.
http://rubyforge.org/frs/?group_id=126
2. Extract the file (in this case, I used the version 1.3.1).

tar -xvf rubygems-1.3.1.tgz

3. Then enter to the path,

cd rubygems-1.3.1

4. Run the setup.

ruby setup.rb

5. Verify from the shell again.

gem environment

Could not find gem rack locally or in a repository

I was trying to install Ruby on Rails Gem and it is failed with error of “could not find gem rack locally or in a repository”.

–Error–
===================
[email protected] [~]# gem install rack
ERROR:  could not find gem rack locally or in a repository
===================

I did try to overcome the issue and found out there are two solutions for it.

Solution 1:
Change the gem source.

To show the gem source installed in the server,
===================
[email protected] [~]# gem source
*** CURRENT SOURCES ***

http://gems.rubyforge.org/
===================

1. Change the gem source to allow http://rubygems.org/.
===================
[email protected] [~]# gem sources -a http://rubygems.org/
http://rubygems.org/ added to sources

===================
2. Check the gem source again and it is added.
3. Install your gem again.
===================
[email protected] [~]# gem install rack
===================

Solution 2:
Download the Gem source to your server and install it locally and let say I am referring to rack gems.

Download the source file from URL below.
http://rack.rubyforge.org/

===================
[email protected] [~]# wget http://rubyforge.org/frs/download.php/71197/rack-1.2.0.tar.gz
[email protected] [~]# tar zxf rack-1.2.0.tar.gz
[email protected] [~]# gem install rack

===================

How to install Redmine with cPanel

Although Redmine do provide the installation guide as URL as below, however it might not work if you are using cPanel.
http://www.redmine.org/wiki/redmine/RedmineInstall

With this article, you may get a complete guide to install Redmine to cPanel server with Ruby on Rails running.

Requirement:
– Ruby On Rails 1.8.x enabled, please downgrade to 1.8.x if your are running higher than that. To check the Ruby version, type “ruby -v” from shell.
– Shell Access(SSH) enabled
– MySQL Enabled

Pre-Step:
1. Install gem rails version 2.3.5(exact version), from SSH shell, run “gem install rails -v=2.3.5”.
2. Install gem rack version 1.0.1(or higher version), from SSH shell, run “gem install rack”.
3. Install gem rubygems 1.3.1(or higher version), from SSH shell, run “rubygems-update”. If it is not working, refer to http://www.mickgenie.com/how-to-update-rubygems/.
4. Create MySQL database from your cPanel and I assume that you are using the database as detail below.
Database Name: mickgenie_redmine
Username: mickgenie_redmine
Password: StR0NgPa$$w0Rd

Installation Step:
1. Log into the cPanel, click on Ruby On Rails.
2. In the App Name, enter Redmine, environment session select Production and create the App.
3. Click on Create Rewrite button and enter the subdomain or path that needed, then save it.
4. Download Redmine from RubyForce.
5. Upload through File Manager according to the path that you created from the Ruby On Rails.
6. Extract the file to the RoR Apps.
7. Log into the SSH, run “rake gems:install” from the Ruby Apps path, for more information, please refer to URL at here.
8. Rename the in config/database.yml.example to config/database.yml.
9. Open the database.yml file and look for the production section.
10. Modify the production section as detail below.
production:
adapter: mysql
database: mickgenie_redmine
host: localhost
username: mickgenie_redmine
password: StR0NgPa$$w0Rd

(These information is create as above).
11. Run “rake generate_session_store” to create session store secret.
12. Next, run “RAILS_ENV=production rake db:migrate” to get the database structure.
13. Then you may run “RAILS_ENV=production rake redmine:load_default_data” to get the default data.
14. You have done the installation, just go to cPanel and start the mongrel.

Final Step:
You may now log into Redmine with detail below,
Username: admin
Password: admin

For Redmine 1.4, please refer to the URL as below,
http://www.mickgenie.com/how-to-install-redmine-1-4-with-cpanel-11-32/

Ruby on Rails Handy Guide

Some Useful command
To install ruby Gem,
gem install [gem_name]
eg, gem install rails

To install ruby Gem with certain version,
gem install [gem_name] –version=x.x.x
eg, gem install rails –version=2.3.5
eg, gem install rails -v=2.3.5

To update ruby Gem,
gem update [gem_name]
eg, gem update mysql

To update ruby Gem with latest version(for all)
gem update –system

To check missing gem
rake gems:install (must run from rails apps folder)

To install gem with lesser space
gem install –no-rdoc –no-ri [gem_name]
eg. gem install –no-rdoc –no-ri rails

To check RoR log,
Path: /home/[cpanel_username]/etc/rails_apps/[apps_name]/log

Continue reading Ruby on Rails Handy Guide

All in one redirect scripting

HTML redirect:

For most of the webmaster, they will prefer 301 Redirect. With HTML redirect with HTML, I will suggest canonical type.

You may use the following script from the HTML with canonical redirection.

<link rel="canonical" href="http://www.mickgenie.com/" />

htaccess with mod_rewrite redirect:

If you are using Apache or Mod_Rewrite enabled Web services, htaccess with mod_rewrite redirect is very useful, you may use the following script to perform your redirection.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mickgenie.com
RewriteRule (.*) http://www.mickgenie.com/$1 [R=301,L]

ColdFusion Redirect:

Sample code for Cold Fusion.

<cfheader name="Location" value="http://www.mickgenie.com/">

PHP Redirect:

Sample code for PHP.

<?php
header("location:http://www.mickgenie.com");
exit;
?>

ASP Redirect:

Sample Code for ASP.

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mickgenie.com/"
%>

ASP.Net Redirect:

Sample Code for ASP.Net.

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Location","http://www.mickgenie.com/");
}
</script>

Java Redirect:

Sample Code for Java.

<%
response.setHeader( "Location", "http://www.mickgenie.com/" );
response.setHeader( "Connection", "close" );
%>

Perl & CGI redirect:

Sample Code for Perl & CGI.

$q = new CGI;
print $q-› redirect(" http://www.mickgenie.com/ ");

Ruby & Ruby on Rails Redirect:

Sample code for Ruby & Ruby on Rails.

head :moved_permanently, :location =› "http://www.mickgenie.com/