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.
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”.

[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

1. Change the gem source to allow
[email protected] [~]# gem sources -a 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.

[email protected] [~]# wget
[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.

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

– 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

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
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.
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,

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

Check Missing Ruby on Rails Gems

In Ruby on Rails (RoR), you might found some error from your mongrel log as some gems might missing to run your site properly, you may run the following command from your rails in order to fix/install automatically by the system.

[email protected] [/home/mickgenie/etc/rails_apps/]rake gems:install

(in /home/mickgenie/etc/rails_apps/blog)
gem install rails
Could not find main page README.txt
Could not find main page README.txt
Could not find main page README.txt
Could not find main page README.txt
Successfully installed rails-2.2.1
1 gem installed