@Lian Jiang
Password less ssh is not mandatory for agent installation. You can also install the ambari agent without setting up the password less ssh.
https://docs.hortonworks.com/HDPDocuments/Ambari-2.4.1.0/bk_ambari-reference/content/ch_amb_ref_inst...
.
If you want to setup password less ssh for local host then it is also possible too.
# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): (I kept it EMPTY)
Enter same passphrase again: (I kept it EMPTY)
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
# ssh-copy-id -i ~/.ssh/id_rsa.pub localhost
# ssh root@localhost
.