Change the hostname in the files /etc/hostname
, /etc/mailname
and /etc/hosts
. Afterwards run the script /etc/init.d/hostname.sh
to set the new hostname on the running system:
root@host:~# /etc/init.d/hostname.sh
Remove the SSH host keys which were generated on the old system:
root@host:~# rm /etc/ssh/ssh_host_*key{,.pub}
and create new SSH host keys for the new system:
root@host:~# ssh-keygen -A
If a static IP address configuration is used, change the IP addresses in /etc/network/interfaces
If postfix is installed change the hostname in the file /etc/postfix/main.cf
:
myhostname = <new hostname> mydestination = <new hostname>, <new fqdn>, localhost.localdomain, localhost
Update the local aliases file:
root@host:~# newaliases
Reboot the system.