To change the hostname (computer name) of an Alpine Linux system, you can use the hostname
command. For example, to change the hostname to myhostname
, you would run the following command:
hostname myhostname
This will change the hostname of the system temporarily, but it will be reset to the original hostname after a reboot. To make the change permanent, you need to edit the /etc/hostname
file and replace the current hostname with the new hostname. For example, if the current hostname is oldhostname
, you would run the following command to make the change permanent:
echo myhostname > /etc/hostname
After making this change, you should reboot the system for the new hostname to take effect. You can also use the hostname
command to verify that the hostname has been changed successfully.