Setting a Hostname in Linux – Linux Liaison

Setting a Hostname in Linux

  1. Log into the terminal with a user that possesses sudo privileges or as root
  2. Open, in vi the /etc/hostname file
  3. Press i to enter insert mode
  4. Delete the contents of the file and then type in the desired hostname. In my example I used fedora22 as the hostname
  5. Press Esc then :wq to save the file and quit vi
  6. Open the /etc/hosts file in vi and erase all the contents of the file
  7. Enter the IP of the local NIC, hit Tab, then the FQDN of the machine, Tab, and then the hostname of the machine
  8. Save and quit the file
  9. Reboot the machine

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.