Upto RHEL/CentOS 6 and some version of Fedora, one has to edit /etc/sysconfig/network and restart the server to change the hostname of a server. Starting RHEL7, you now have a new command to rename a server.
To display the current hostname info
[root@c7sandbox ~]# hostnamectl
Static hostname: c7sandbox
Icon name: computer-vm
Chassis: vm
Machine ID: f4eb9a7b40cc488882191b87cdd0a6a4
Boot ID: 4ac6b45da6c54325bfdbff821d8af31b
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.3.1.el7.x86_64
Architecture: x86-64
To set a new hostname
[root@c7sandbox ~]# hostnamectl set-hostname c7test
This persists across reboots.
[sai@c7test ~]$ hostname
c7test
[sai@c7test ~]$ hostnamectl
Static hostname: c7test
Icon name: computer-vm
Chassis: vm
Machine ID: f4eb9a7b40cc488882191b87cdd0a6a4
Boot ID: 2999ce807b0d4b9abcf8fe701816a006
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.3.1.el7.x86_64
Architecture: x86-64