Setting the hostname in Fedora 18

I didn’t get to install the OS on my new laptop… oh yeah, I got a new laptop! It is awesome, and I will write about it somewhere.

Anyhow, I opted for Fedora 18, and the ZaReason folks installed it for me. It is nice having it ready to go, although it was funny to see some wierd name at the login…

I don’t have complex hard drive setups, so the only thing that I needed to set correctly was the hostname for this new machine. A bit harder than normal, since there were changes to how it works from Fedora 17. However, it is pretty easy to fix with a tool called hostnamectl.

Checking the status shows what the hostnames are set as:

[maiki@localhost ~]$ hostnamectl status
   Static hostname: localhost.localdomain
   Pretty hostname: n/a
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 69d27b356a94476da859461d3a3bc6fd
           Boot ID: 1da3adf2786146f681afd9f9983c9f8d
  Operating System: Fedora 18 (Spherical Cow)
       CPE OS Name: cpe:/o:fedoraproject:fedora:18
            Kernel: Linux 3.7.9-205.fc18.x86_64
      Architecture: x86_64

My laptop designation is orenji, so I use:

[maiki@localhost ~]$ hostnamectl set-hostname orenji

Then another status shows:

[maiki@localhost ~]$ hostnamectl status
   Static hostname: orenji
   Pretty hostname: orenji
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 69d27b356a94476da859461d3a3bc6fd
           Boot ID: 1da3adf2786146f681afd9f9983c9f8d
  Operating System: Fedora 18 (Spherical Cow)
       CPE OS Name: cpe:/o:fedoraproject:fedora:18
            Kernel: Linux 3.7.9-205.fc18.x86_64
      Architecture: x86_64

And of course if you open a new terminal, you will see your new hostname in the default prompt:

[maiki@orenji ~]$