Set the hostname of a machine on CentOS

While setting up some AFP shares on a CentOS server earlier, I needed to change the hostname of the machine so that it would display properly to other machines on the network (its localhost by default).