ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Renaming hostname in Ubuntu Server 18.04

    IT Discussion
    3
    4
    503
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • black3dynamiteB
      black3dynamite
      last edited by black3dynamite

      For those who installed Ubuntu Server 18.04 using the new installer from (ubuntu-18.04-live-server-amd64.iso), you will notice that renaming the hostname is not preserved after a reboot.

      You'll find that you will need to change preserve_hostname: from false to true in /etc/cloud/cloud.cfg.

      Now you can change your hostname using sudo hostnamectl set-hostname <new-hostname> and will stay put after a reboot.

      Here's a one-liner command to change the preserve_hostname setting to true and to set a new hostname

      sudo sed -i '/preserve_hostname: false/c\preserve_hostname: true' /etc/cloud/cloud.cfg; sudo hostnamectl set-hostname YourNewHostname
      
      1 Reply Last reply Reply Quote 2
      • JaredBuschJ
        JaredBusch
        last edited by

        That sounds just stupid.

        black3dynamiteB 1 Reply Last reply Reply Quote 1
        • black3dynamiteB
          black3dynamite @JaredBusch
          last edited by

          @jaredbusch said in Renaming hostname in Ubuntu 18.04:

          That sounds just stupid.

          It was pissing me off trying to figure out why it didn't keep the new name.

          1 Reply Last reply Reply Quote 1
          • dafyreD
            dafyre
            last edited by

            Looks like I will not be using any Ubuntu based systems if I can help it... I'm liking Debian 9 rather well right now.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post