Hostnames
All computers (hosts
) on the network have (or can have) a hostname. This is nothing more that what you might think of as the name of the computer. In the case of our robots, each robot has a hostname, e.g. platform3
.
Setting hostnames
To change the hostname on an Ubuntu system, you need to modify it in several places. Here are the steps to change the hostname permanently:
-
Edit the
Replace the current hostname with the new one you want./etc/hostname
file: -
Update the
Find the line with the old hostname and update it to the new hostname./etc/hosts
file: -
Use the
Replacehostnamectl
command to set the new hostname:new-hostname
with your desired hostname. -
To prevent cloud services from resetting the hostname, you may need to modify cloud-init configuration:
Find the linepreserve_hostname: false
and change it topreserve_hostname: true
. -
Reboot your system to apply all changes: