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

How to create archives and compress file in Linux

With Linux default environment, tar is come by default and you may easily archives and compress a file or folder easily by using tar command.

If you familiar with Linux, you should know that file could be archives to .tar, .tar.gz, .tgz, .bz2, .tgz, etc, but do you know how to archives it and how to remember and understand it? It is pretty easy, actually.

To archives each of the folder/file, you may refer to the step as below.

.tar -> tar -cf file.tar folder/ # c indicate that you are creating a file and f is use to force create the inheritance file from the folder.
.tar.gz -> tar -zcf file.tar.gz folder/ # z indicate that you are using .tar.gz or tgz extension
.tgz -> tar -zcf file.tgz folder/
.bz2 -> tar -jcf file.bz2 folder/ # bz2 is a type of archives that using lesser space and it required option j.
.gz -> gzip file.gz folder/ # gzip use to zip and remove the original file.
.zip -> zip -r folder.zip folder/ # zip is another archives type that not using tar but it is useful for Windows Operating System.

To extract the file as above, simply change all c to x.

.tar -> tar -xf file.tar
.tar.gz -> tar -zxf file.tar.gz
.tgz -> tar -zxf file.tgz
.bz2 -> tar -jxf file.bz2
.gz -> gunzip file.gz
.zip -> unzip folder.zip