How to change hostname in ubuntu

1 Answer(s)

    Changing the hostname or computer name in ubuntu

    Edit /etc/hostname and change to the new value,

    nano /etc/hostname
    Edit /etc/hosts and change the old 127.0.1.1 line to your new hostname

    127.0.0.1 localhost
    127.0.1.1 ubuntu.local ubuntu # change to your new hostname

    Now after a reboot, your hostname will be the new one you choose.

    Answered on April 24, 2018.
    Add Comment

    Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.