Linux hostname may be used in a lot of apps, mainly in email services.

CentOS 6

We need to change HOSTNAME value in /etc/sysconfig/network and add new hostname to /etc/hosts

CentOS 7

hostnamectl set-hostname <your new hostname>

Debian 7 Wheezy

Update /etc/hostname and /etc/hosts

vim /etc/hostname
vim /etc/hosts

Reboot

All distros should be rebooted after new hostname have been changed. You can restart services but that will take probably longer.

Resources