First:
[root@localhost ~]# ssh-keygen -t rsa
this command will generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
second:
[root@localhost ~]# scp /root/.ssh/id_rsa.pub root@<other_host_ip:/root
[root@localhost ~]# ssh other_host_ip
[root@otherhost ~]# cat /root/id_rsa.pub >> /root/.ssh/authorized_keys
ok,you will login other_host_ip without input password.