ssh-keygen -t rsa -b 4096

-t — probably stands for type & RSA is the recomended type as of 2021.

-b — flag increasing the bits makes it harder to crack the key by brute force methods

how to transfer a public key to the server by connecting via a password since the pubic key is not yet placed in the server.

ssh-copy-id <username>@<host>