To generate a key pair, use the ssh-keygen(1) command.
Here is a sample interaction with ssh-keygen:
-bash-2.05b$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/admin/.ssh/id_rsa): Enter passphrase (empty for no passphrase): ****** Enter same passphrase again: ****** Your identification has been saved in /home/admin/.ssh/id_rsa. Your public key has been saved in /home/admin/.ssh/id_rsa.pub. The key fingerprint is: 8c:ff:d4:50:65:46:9f:6b:59:34:43:3a:5f:e7:5a:54 admin@staging.my.com
At this point, there are two new files in the home directory: ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. The first file is the private key (in binary form) and the second is the public key (in text form).