Setting up password-less SSH and SCP


In this post, I will explore how to perform a secure copy, the Linux scp command.

To this end, I will first detail how to setup password-less authentication with OpenSSH.

Setting up openssh on the guest and the host

What I want to achieve is to be able to ssh the remote host from my guest computer with the following

$ ssh username@hostname

Let’s consider that I have both the host and the guest running ubuntu. I have to install the openssh-client package on the guest with the following command:

$ sudo apt-get install openssh-client

For testing this how-to, I have set up a fresh virtualized Ubuntu install. When I attempt to connect to the host for the first time, I get the following error for example:

$ ssh stephan@10.211.55.10
ssh: connect to host 10.211.55.10 port 22: Connection refused

I have to install openssh-server on the host with the following command:

$ sudo apt-get install openssh-server    

Now, I can open an SSH connection between my guest and my host. As this is the first time I connect to the host, I have to accept that the host be added to the list of known hosts recognized by opens. The list is available in

~/.ssh/known_hosts

For example:

~ $ ssh username@10.211.55.10
The authenticity of host '10.211.55.10 (10.211.55.10)' can't be established.
RSA key fingerprint is 9c:f5:b7:93:7a:eb:d8:fe:e5:38:a8:52:e8:06:9b:2d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.211.55.10' (RSA) to the list of known hosts.
username@10.211.55.10's password: 
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

156 packages can be updated.
28 updates are security updates.

The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

username@host:~$ 

Now that openssh is configured on the host, we can set up password-less authentication.

Setting up password-less authentication with OpenSSH

Password-less authentication with OpenSSH works as follows. In order to secure the communication between the guest and the host without the need to provide a password, they will use the private key and public key of the client along with a username known on the server. The server will add the public key of the client to its lists of authorized keys.

As I authenticate as a particular user known on the host, I will set up the openssh configuration for the host to allow the user to ssh from the guest. I will generate a private/public key pair on the guest and add the public key to the list of authorized keys on the host.

The ~$ ssh username@hostname command will use the private key available in the ~/.ssh/id_rsafile of the user executing the command on the guest computer. If I wanted to use any other key file, I could use the -i pathToKeyFile parameter and specify another key file. For example:

$ ssh -i pathToMyFile username@hostname

Now that I know what I want to achieve, let’s configure both the guest and the host.

With the default key file

The first step is to generate a private and a public key on the guest computer. I will issue the following command to generate an RSA key. I could use -t dsa to generate a DSA private key.

ssh-keygen -t rsa

The command will yield the following output. It is important not to type in a passphrase and to simply hit enter twice.

Generating public/private rsa key pair.
Enter file in which to save the key (/home/stephan/.ssh/id_rsa): 
Created directory '/home/stephan/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/stephan/.ssh/id_rsa.
Your public key has been saved in /home/stephan/.ssh/id_rsa.pub.
The key fingerprint is:
24:c9:61:0f:c5:f3:69:24:92:21:2a:bf:6e:64:0b:17 stephan@stephan-Parallels-Virtual-Platform
The key's randomart image is:
+--[ RSA 2048]----+
|    . ==.        |
|   . +o=+ .      |
|. .   +.o= .     |
| oE    o  +      |
|  ..    S.       |
|. +.             |
| =..             |
| .o              |
| ..              |
+-----------------+

Now, I have two files in the ~/.sshdirectory of my guest computer: id_rsa and id_rsa.pub

I will now copy it to my host server with the OpenSSH scp command:

$ scp ~/.ssh/id_rsa.pub username@hostname:/home/username/.ssh/myguest_id_rsa.pub

On the host, I will now add the contents of the key to the list of authorized keys:

$ cat myguest_id_rsa.pub >> ~/.ssh/authorized_keys

The above command will append the contents of the myguest_id_rsa.pub file to the file authorized_keys. If the file does not exist, the command creates it.

Let’s now remove the no longer necessary file

$ rm myguest_id_rsa.pub

For better security, let’s set the proper rights on the authorized_keys file. 600 means that the owner only can read and write.

$ chmod 600 authorized_keys

Now, when I open an SSH connection with the given username from the guest computer (logged in as the user whose key is authorized on the host) to the host computer, I no longer have to provide a password. Instead of:

~/$ ssh stephan@10.211.55.10
stephan@10.211.55.10's password: 
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Last login: Sun Jun  3 16:44:22 2012 from stephans-macbook-pro.local

I now have

~/.ssh $ ssh stephan@10.211.55.10
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Last login: Sun Jun  3 17:26:52 2012 from stephans-macbook-pro.local
stephan@stephan-Parallels-Virtual-Platform:~$ 

With any key file

Let’s generate a key file outside of the ~/.ssh directory.

~/temp $ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/stephan/.ssh/id_rsa): ./standalone_id_rsa
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in ./standalone_id_rsa.
Your public key has been saved in ./standalone_id_rsa.pub.
The key fingerprint is:
d4:48:5d:30:10:80:f6:2d:75:1d:49:51:47:9f:5b:eb stephan@stephan-Parallels-Virtual-Platform
The key's randomart image is:
+--[ RSA 2048]----+
|     ...++o===..o|
|    o  ..oo.o  .o|
|   . . oo..    .o|
|      o..       +|
|       .S      o |
|              .  |
|               E |
|                 |
|                 |
+-----------------+

I generated the file in the folder I was in with ./standalone_id_rsa.

Let’s now copy the file to the host:

~$ scp ./standalone_id_rsa.pub username@hostname:/home/username/.ssh/myguest_id_rsa.pub

On the host, let’s add the public key to the list of authorized_keys:

~$ cat myguest_id_rsa.pub >> authorized_keys

Let’s remove the no longer necessary key file:

~$ rm myguest_id_rsa.pub

I can now connect with the provided file:

~/temp $ ssh -i ./standalone_id_rsa stephan@10.211.55.10
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Last login: Sun Jun  3 17:52:36 2012 from stephans-macbook-pro.local
stephan@stephan-Parallels-Virtual-Platform:~$ 

If I want to In this case, we must make sure that only the owner of the file has the rights to access the file. To achieve that, we will set the appropriate rights with chmod.

$ chmod 600 pathToMyKeyFile

References

Where are the system icons in Ubuntu?


One can find the system icons in:

/usr/share/icons/

There are multiple directories underneath, where one can find many icons.

Launching gnome-terminal with custom parameters


I wanted to create a custom launcher to launch gnome-terminal with a specific profile, set the working directory and maximise the window. Here’s the command to do it:

gnome-terminal --window-with-profile="Server Console"  --working-directory=/home/stephan/Development/servers --maximize

As the name of my profile contained white spaces, I had to use double quotes do delimit it.

Fixing the pesky perl: warning: Setting locale failed on Ubuntu Server


After having installed an new instance of Ubuntu Server, I run into the following error message

Setting locale failed.
perl: warning: Please check that your locale settings: LANGUAGE = “en_GB:en”, LC_ALL = (unset), LC_CTYPE = “UTF-8”, LANG = “en_GB.UTF-8” are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).

To fix it, I had to do the following:

$ sudo dpkg-reconfigure locales

That generated the following output:

Generating locales...
  en_AG.UTF-8... up-to-date
  en_AU.UTF-8... up-to-date
  en_BW.UTF-8... up-to-date
  en_CA.UTF-8... up-to-date
  en_DK.UTF-8... up-to-date
  en_GB.UTF-8... up-to-date
  en_HK.UTF-8... up-to-date
  en_IE.UTF-8... up-to-date
  en_IN.UTF-8... up-to-date
  en_NG.UTF-8... up-to-date
  en_NZ.UTF-8... up-to-date
  en_PH.UTF-8... up-to-date
  en_SG.UTF-8... up-to-date
  en_US.UTF-8... up-to-date
  en_ZA.UTF-8... up-to-date
  en_ZM.UTF-8... up-to-date
  en_ZW.UTF-8... up-to-date
Generation complete.

Then, I ran:

$ sudo locale-gen en_GB

That generated the following output:

Generating locales...
  en_GB.ISO-8859-1... done
Generation complete.

And I eventually ran:

$ sudo update-locale LANG=en_GB.UTF-8

Then, I added the following to my .profile

export LC_CTYPE=en_GB.UTF-8 export LC_ALL=en_GB.UTF-8

That did the trick.

Setting up Apache HTTP Server with SSL support on Ubuntu/Debian


I need to set up a server to host our subversion in a secured fashion and to make it available on the Web. Therefore, I first install the Apache HTTP Server (httpd) and configure it to allow for SSL connections only.

If there are mistakes in this post, please comment. I’m eager to improve it and learn.

It took me quite some time to find some proper documentation on how to configure Apache2 on Ubuntu/Debian. I came across that interesting page on the apache Web site that pointed me to a README file: /usr/share/doc/apache2/README.Debian.gz that contains information on how to configure Apache2 on Debian.

Step 1: Install the Apache2 package

There is an Apache httpd package readily available for aptitude under the name apache2. To install it, run the following command from the terminal.

$ sudo apt-get install apache2

To test that the package was properly installed, open the following address in your browser: http://yourhostname. If the installation was successful, the browser shall display the following:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

Step 2: Configure httpd to support SSL

The module mod_ssl (http://httpd.apache.org/docs/2.0/mod/mod_ssl.html) provides SSL/TLS support to httpd. It is available in the httpd installation as a part of the apache2-common package.

On Ubuntu/Debian, use the following commands to enable SSL

$ sudo a2ensite default-ssl

That yields

Enabling site default-ssl.
To activate the new configuration, you need to run:
service apache2 reload

$ sudo a2enmod ssl

That yields

Enabling module ssl.
See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
service apache2 restart

As written, let’s restart Apache2 to apply the changes with the following command:

$ sudo service apache2 restart

That command yields the following outcome:

* Restarting web server apache2 … waiting

and restart httpd:

$ sudo /etc/init.d/apache2 restart

Which yields again:

* Restarting web server apache2 … waiting

To test that the module was properly installed, open the following address in your browser: https://yourhostname. The first time you access the page, the browser will warn you that the certificate of the site is not trusted. You can proceed and you will get to the same page as before:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

Step 3: Generate a self-signed certificate

To use a self-signed certificate, the package ssl-cert must be installed, which it was on my install.

I wanted to configure my own self-signed certificate for the server and to store it in /etc/apache2/ssl. To do so, run the following command from the terminal:

$ sudo mkdir /etc/apache2/ssl
$ sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.crt

The command prompts you to enter the hostname to use in the certificate. Once done, you can now see that there is a new file in the /etc/apache2/ssl directory:

drwxr-xr-x 2 root root 4096 2011-12-16 14:40 ./
drwxr-xr-x 8 root root 4096 2011-12-16 14:12 ../
lrwxrwxrwx 1 root root 10 2011-12-16 14:40 a9630d61 -> apache.crt
-rw——- 1 root root 2685 2011-12-16 14:40 apache.crt

That last command will have generated an apache.crt file that contains both the certificate and the key. Let’s now separate that file into two files:

  • apache.pem to store the certificate
  • apache.key to store the key

I will simply copy the original apache.crt file twice, one with each name and edit each file.

$ cd /etc/apache2/ssl
$ sudo cp apache.crt apache.pem
$ sudo cp apache.crt apache.key

The apache.pem file must contain everything from the beginning line to the ending line of the certificate

-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

The apache.key file must contain everything from the beginning line to the ending line of the key

-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----

Step 4: Configure httpd to use the certificate

Now, I have to configure httpd to use my new certificate. To do so, I edit the configuration with nano

$ sudo nano /etc/apache2/sites-enabled/default-ssl

We have to update the following two lines

SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

with the following two lines

SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

The private key shall only be readable by root:

$ sudo chmod 600 /etc/apache2/ssl/apache.key

Let’s now restart Apache2

$ sudo /etc/init.d/apache2 restart

Step 5: Disable the HTTP port

On Ubuntu/Debian, the enabled ports are defined in /etc/apache2/ports.conf. As I want to disable the HTTP listener, I simply disable that port in that file by commenting out the following two lines:

#NameVirtualHost *:80
#Listen 80

Final test

To check that everything works fine, let’s try to access the page at http://localhost with curl

curl http://localhost
curl: (7) couldn’t connect to host

Let’s no try to access the page at https://localhost with curl -k. The -k is used to allow connections from sites without a certificate.

$ curl -k https://localhost</pre>
<h1>It works!</h1>
<pre>
This is the default web page for this server.

The web server software is running but no content has been added, yet.


That’s it.

Installing Oracle SQL Developer on Ubuntu


Update: As I switched to Linux Mint, I ran into an permission problem. To have it working, follow the procedure available at http://community.linuxmint.com/tutorial/view/938, which provides additional steps.


On my current project, we use Oracle database. The best free tool I have found so far to work with the database as a Java developer is Oracle SQL Developer.

Oracle does not provide a package for Debian based distros. I tried to run the tool from the generic archive but it failed to run because it seems to be aiming at another environment with respect to the Swing look and feel that it failed to load.  After some googling, I found that there is a package to make a package (sqldeveloper-package)out of the archive to make it installable as such.

Here is how to use it.

Download Oracle SQL Developer

As the download requires that one have an Oracle account, I download it from the browser at the following address: http://www.oracle.com/technetwork/developer-tools/sql-developer/sqldev-ea-download-486950.html

Install Java

See my post Install Sun JDK 6 on Ubuntu 11.10

Install the sqldeveloper-package and its dependencies

$ sudo apt-get install sqldeveloper-package debhelper

 Install dos2unix

$ sudo apt-get install tofrodos

It is necessary to create the following symlinks for the tool to work:

$ sudo ln -s fromdos dos2unix
$ sudo ln -s todos unix2dos

Make the deb package

It seems that the -b switch can be used to indicate where to generate the .deb but it does not seem to work (Or I did not spend enough time trying to get it to work). The tool will generate the .deb in the working directory.

$ cd ~/Downloads
$ make-sqldeveloper-package ~/Downloads/sqldeveloper-3.1.06.44-no-jre.zip

Install the package

$ sudo dpkg -i sqldeveloper_3.1.06.44+0.2.3-1_all.deb

The tool is now available in Applications->Programming->Sql Developer

Install Sun JDK 6 on Ubuntu 11.10


Update 2011-12-20: Following up on comments on the post, I added a section on how to  configure the Java Browser Plugin in manual installation

Update 2011-11-25: I added the information regarding the configuration of the JDK as in my previous post  Configuring Java on Kubuntu 10.10


Since Ubuntu 11.10, there is no longer an official package for the Sun/Oracle JDK. The package sun-java6-jdk is no longer officially available.

Method 1: Install a package provided by a PPA

There is a PPA (Personal Package Archives) made available by Roberto Ferramosca. To add this PPA, run the following command from the command line:

    $ sudo add-apt-repository ppa:ferramroberto/java
    $ sudo apt-get update

You can now install the JDK with the following command:

    $ sudo apt-get install sun-java6-jdk

I you’d like to install the JRE or the Java Plugin along with the JDK, use the following:

sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin sun-java6-fonts

You must now set the Sun JDK as the default. You can see how to achieve this in a previous post Configuring Java on Kubuntu 10.10.

The benefit of this method is that the JDK will be updated when a newer version of the package is made available.

Method 2: Installing the JDK manually

This method consists of downloading the adequate JDK from the Oracle Web site. The file is a bin file, e.g. jdk-6u29-linux-x64.bin

The first step is to create a temporary folder where we’ll download the file.

    $ mkdir -p ~/tmp/jdk-6u29
    $ cd ~/tmp/jdk-6u29

Once downloaded, make the file executable and run it.

    $ chmod +x jdk-6u29-linux-x64.bin
    $ ./jdk-6u29-linux-x64.bin

Now copy the file to the preferred target location, e.g. ~/dev/jdk

    $ mkdir -p ~/dev/jdk
    $ cd ..
    $ mv jdk-6u29 ~/dev/jdk/

Let’s now create a symbolic link so that we can easily update with newer versions in the future.

    $ cd ~/dev/jdk
    $ ln -s jdk-6u29 jdk-6

The next step is to add to the ~/.bashrc the path to our JDK binary files.

    #Use the symbolic link
    export JAVA_HOME="~/dev/jdk/jdk-6"
    export PATH=$PATH:$JAVA_HOME/bin

That’s it.

The benefit of this method is that one can install any version of the JDK (6 or 7). The downside is that one must manually upgrade the JDK.

Manually configuring the browser plugin

To configure the plugin, you need the JRE that comes with the JDK. If you installed the JDK in $JAVA_HOME, the JRE is located in $JAVA_HOME/jre.

Based on some documentation that I found on Oracle Web Site, the solution is simply to create symlinks to the plugin. The plugin can be found in

  • $JAVA_HOME/jre/lib/amd64/libnpjp2.so for 64bit machines
  • $JAVA_HOME/jre/lib/i386/libnpjp2.so for 32bit machines

You can go to http://javatester.org/version.html to check that the plugin works fine.

Configuring the plugin for Firefox

Create a symlink to the plugin

$ sudo ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so /usr/lib/firefox-addons/plugins/libnpjp2.so

This shall do the trick.

Configuring the plugin for Chromium

Create a symlink to the plugin

$ sudo ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so /usr/lib/chromium-browser/plugins/libnpjp2.so

With Chromium, it is necessary to enable plugins. You can just launch it from the command line once to enable the plugins with the following command

$ chromium-browser --enable-plugins %U

If you now naviate to chrome://plugins/, you shall see something like:

Java – Version: 1.6.0.30
The next generation Java plug-in for Mozilla browsers.
Disable

Removing the overlay scrollbar in Ubuntu 11.04


The overlay scrollbar in Ubuntu 11.04 that is not always visible and not very usable either really bugs me. Here is how to get rid of it, the hard way:

$ sudo apt-get remove overlay-scrollbar liboverlay-scrollbar-0.1-0

Installing Ruby 1.9.2 from the Source on Kubuntu or Ubuntu 10.10


I’m starting to learn Ruby. Therefore, I first need to install it on my Kubuntu 10.10 machine. Because I want to use the most current stable version, I’ll install it directly from the source code.

Installing from the code means downloading the source, building it and installing it. Here are the steps to install the latest stable version at the time of this post (version 1.9.2.p180). I only use the terminal to perform all operations.

This procedure works as well on Ubuntu 10.10.

Create a temporary folder

Let’s create a temporary folder in  ~/temp and work in that directory.

mkdir ~/temp ~/temp/ruby
cd ~temp/ruby

Download the source code

The source code for version 1.9.2.p180 is available at ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz

Let’s download it using wget.

wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz

You will see the terminal display something akin to

--2011-03-10 17:38:09--  ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
           => `ruby-1.9.2-p180.tar.gz'
Resolving ftp.ruby-lang.org... 221.186.184.68
Connecting to ftp.ruby-lang.org|221.186.184.68|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub/ruby/1.9 ... done.
==> SIZE ruby-1.9.2-p180.tar.gz ... 11158935
==> PASV ... done.    ==> RETR ruby-1.9.2-p180.tar.gz ... done.
Length: 11158935 (11M) (unauthoritative)

100%[==============================================================================================================================>] 11,158,935   948K/s   in 14s

The last line tells you that the download was successful.

Unpack the source code

Now that we’ve got the source code, we need to unpack it using the tar command:

tar -xvf ruby-1.9.2-p180.tar.gz

The execution of the command created a folder named ruby-1.9.2-p180. So let’s change to that directory:

cd ruby-1.9.2-p180

Install the libraries necessary to build the software

If we don’t install the necessary libraries, we will run into the following error for example:

 configure: error: in `/home/stephan/Temp/ruby/ruby-1.9.2-p180':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more detail

Let’s install the necessary libraries:

sudo apt-get install build-essential zlib1g zlib1g-dev

Generate config.h and Makefile

To build from the source code, we first need to prepare the configuration for make:

./configure

The execution of the command ends up with lines along the lines of the following:

.ext/include/x86_64-linux/ruby/config.h updated
ruby library version = 1.9.1
configure: creating ./config.status
config.status: creating Makefile

Run make

Let’s now run make.

make

The execution of the command ends up with lines along the lines of the following:

Generating RI...

Files:       515
Classes:    1087 (  654 undocumented)
Constants:  1364 ( 1141 undocumented)
Modules:     239 (  137 undocumented)
Methods:    7642 ( 2876 undocumented)
 53.46% documented

Elapsed: 54.8s

Run make test [Optional]

This optional test allow testing that the make went ok.

make test

The execution of the command ends up with lines along the lines of the following:

PASS all 934 tests
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./tool/runruby.rb --extout=.ext  -- "./bootstraptest/runner.rb" --ruby="ruby"  ./KNOWNBUGS.rb
2011-02-28 17:02:15 +0100
Driver is ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
Target is ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

KNOWNBUGS.rb .
PASS all 1 tests

Run make install

To install Ruby, one must be a super user. We will thus sudo the command.

sudo make install

The execution of the command ends up with lines along the lines of the following:

installing binary commands:   /usr/local/bin
installing base libraries:    /usr/local/lib
installing arch files:        /usr/local/lib/ruby/1.9.1/x86_64-linux
installing extension objects: /usr/local/lib/ruby/1.9.1/x86_64-linux
installing extension objects: /usr/local/lib/ruby/site_ruby/1.9.1/x86_64-linux
installing extension objects: /usr/local/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
installing extension headers: /usr/local/include/ruby-1.9.1/x86_64-linux
installing extension scripts: /usr/local/lib/ruby/1.9.1
installing extension scripts: /usr/local/lib/ruby/site_ruby/1.9.1
installing extension scripts: /usr/local/lib/ruby/vendor_ruby/1.9.1
installing extension headers: /usr/local/include/ruby-1.9.1/ruby
installing rdoc:              /usr/local/share/ri/1.9.1/system
installing capi-docs:         /usr/local/share/doc/ruby
installing command scripts:   /usr/local/bin
installing library scripts:   /usr/local/lib/ruby/1.9.1
installing common headers:    /usr/local/include/ruby-1.9.1
installing manpages:          /usr/local/share/man/man1
installing default gems:      /usr/local/lib/ruby/gems/1.9.1 (cache, doc, gems, specifications)
                              rake 0.8.7
                              rdoc 2.5.8
                              minitest 1.6.0

Verify the installation

To verify the installation, let’s check the version of Ruby and RubyGems.

ruby --version

Will yield on my computer:

ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

And

gem --version

Will yield

1.3.7

Update RubyGems

The current version of RubyGems at the moment of writing this post is 1.5.3. Let’s now update it:

sudo gem update --system

This command will yield:

Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.5.3
Updating RubyGems to 1.5.3
Installing RubyGems 1.5.3
RubyGems 1.5.3 installed

=== 1.5.3 / 2011-02-26

NOTE:  RubyGems 1.5.0 and 1.5.1 have a broken <tt>gem update --system</tt>.

To upgrade you'll need to use the manual upgrade recipe.  Using sudo/su as
appropriate:

  $ gem install rubygems-update
  $ update_rubygems

Bug Fixes:

* Fix for a bug in Syck which causes install failures for gems packaged with
  Psych.  Bug #28965 by Aaron Patterson.

------------------------------------------------------------------------------

RubyGems installed the following executables:
        /usr/local/bin/gem

Let’s now check the new version:

gem --version

Will yield

1.5.3

Clean up

We can now remove the temporary folder:

cd ~
rm -fr temp
%d bloggers like this: