Ubuntu – How to set the fully qualified domain name in 12.04

resolv.conf

I tried adding

dns-domain domain.com

to /etc/network/interfaces with no luck. When I run

hostname -d

I get an empty string

Best Answer

Edit /etc/hostname and add your unqualified hostname:

boson

Edit /etc/hosts:

sudo vi /etc/hosts

Add an entry of your desired hostname by replacing boson.dev.local boson where boson.dev.local is the fully qualified hostname and boson is hostname.

127.0.1.1 boson.dev.local boson

Restart the hostname service:

sudo service hostname restart

Test your configuration by opening a terminal and enter the below commands:

  • hostname
    • This should output boson
  • hostname -f
    • This should output boson.dev.local

Hope this helps.

Related Question