First edit the hostname file by typing:
sudo vi /etc/hostname
Delete the line that you see in the file so it our case we deleted:
localhost.localdomain
Now enter your hostname, in our case we called it darrens centos.
We then typed
esc wq!
to write and save the file.
We then restart the machine by typing
sudo init 6
When the machine has re-booted type in
hostname
to see the new hostname.
A video tutorial can be found here: