The Linux hostname command is not enough, as it won’t change HELLO for Exim, or reset the SSL certificates.
The good hostname script is:
/usr/local/cpanel/bin/set_hostname
The hostname need to be FQDN, in the format, for example:
/usr/local/cpanel/bin/set_hostname host.exampledomain.com