호스트 이름을 변경할 수 없습니다

호스트 이름을 변경할 수 없습니다

Ubuntu 18.04 서버의 호스트 이름을 변경하고 싶습니다.

나는 그랬다:

hostnamectl --set-hostname newname --static
changed /etc/hostname file to newname
changed /etc/hosts file to newname
rm -f /etc/machine-id
dbus-uuidgen --ensure=/etc/machine-id
dbus-uuidgen --ensure
dpkg-reconfigure openssh-server

마지막으로 재부팅을 했습니다. 그러나 재부팅 후에도 여전히 이전 호스트 이름이 남아 있습니다. /etc/hostname 파일이 이전 호스트 이름으로 변경되었습니다.

호스트 이름을 영구적으로 변경하는 방법은 무엇입니까?

답변1

또한 /etc/cloud/cloud.cfg 파일을 변경해야 했습니다.

설정이 있습니다preserve_hostname: false

나는 그것을 거짓에서 진실로 바꿔야 했습니다. rebbot 호스트 이름이 변경된 후.

관련 정보