nano /etc/ssh/sshd_config
Edit the line which says Port 22 to Port 2222.
Do remember that the port should not be in use by another program or service.Now,restart SSH server via
service ssh restart
You may want to setup your IPtables rules or other firewall rules to allow incoming TCP packets in port 2222.In case you are using ufw ,you would do ,
ufw allow 2222/tcp