My computer is macbook pro.
1. Use ssh-keygen to generate the rsa key pair.
ssh-keygen
2.The key pair will generate under the folder User/%username%/.ssh
cd User/jason/.ssh
ls
id_rsa #private key
id_rsa.pub #public key
3.Copy the public to the server
scp ~/.ssh/id_rsa.pub username@hostname:~/.ssh/id_rsa.pub
4.Login the server with password and append the key to the authorized_keys file
cd ~/.ssh/
cat id_rsa.pub >> authorized_keys
rm id_rsa.pub
5.Logout the server and login again, no need provide the password.