0

I've spent the last number of hours trying to work out what's causing the error "hostname: Name or service not known" to be produced when I run the command "hostname -f" on the latest version of Debian 9. When I run "hostname" I get the hostname ok though and I suspect that it is something to do with the fact that lightsail automatically alters the FQDN hosts.debian.tmpl file (I think). How to I change the FQDN on a Lightsail instance successfully?

Daniel B
  • 3
  • 2

1 Answers1

0

1) Allocate an Elastic IP and assigned it to the Instance.

2) Replace the "/etc/cloud/cloud.cfg" with a brand new 'out-of-the-box' one.

3) Edit "/etc/sysconfig/network":

NETWORKING=yes HOSTNAME=myhostname

4) Edit "/etc/hosts":

127.0.0.1 myhostname.mydomain.com myhostname localhost.localdomain localhost localhost4.localdomain4 localhost4

5) Stop the Instance

6) Edit the Instance's User Data:

cloud-config

hostname: myhostname

7) Restart the Instance

Passatizhi
  • 46
  • 1
  • 2