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/hostnamefile: -
Update the
Find the line with the old hostname and update it to the new hostname./etc/hostsfile: -
Use the
Replacehostnamectlcommand to set the new hostname:new-hostnamewith your desired hostname. -
To prevent cloud services from resetting the hostname, you may need to modify cloud-init configuration:
Find the linepreserve_hostname: falseand change it topreserve_hostname: true. -
Reboot your system to apply all changes: