• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

Change Hostname Amazon Linux

June 6, 2023

Here’s how to make a hostname stick on Amazon Linux.

Set preserve_hostname to true in /etc/cloud/cloud.cfg.

preserve_hostname: true

preserve_hostname: true

Set the hostname in /etc/sysconfig/network.

HOSTNAME=server.domain.com
NETWORKING=yes
NOZEROCONF=yes

HOSTNAME=server.domain.com NETWORKING=yes NOZEROCONF=yes

Reboot the server to make sure hostname sticks after a reboot.

shutdown -r now

shutdown -r now

Login to confirm hostname sticks.

Filed Under: Cloud, Linux Tagged With: amazon, aws, hostname, linux

  • Home
  • About
  • Search

Copyright © 2023