Let me give you a complete example:
R2(config)#ip domain-name networklessons.local
R2(config)#crypto key generate rsa
The name for the keys will be: R2.networklessons.local
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable…[OK]
R2(config)#username rene secret mysecretkey
R2(config)#line vty 0 4
R2(config-line)#login local
R2(config-line)#transport input ssh
And then on another router:
R1#ssh -l rene 192.168.12.2
Password:
R2>