Difference between revisions of "Change Default Host Names"
(Created page with "In order to ensure that every device has a unique hostname for [http://en.wikipedia.org/wiki/Dynamic_dns Dynamic] DNS (and because unique hostnames are simply good form), the ube...") |
(Added refs to install key hostname update option) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
In order to ensure that every device has a unique hostname for [http://en.wikipedia.org/wiki/Dynamic_dns Dynamic] DNS (and because unique hostnames are simply good form), the ubermix automatically assigns a hostname on first boot to every device it is installed on. This hostname, by default, is set to the word "system" followed by a "-" and the last 3 octets of the device's ethernet card [http://en.wikipedia.org/wiki/Mac_address MAC address]. So, for example, of my device's ethernet card has a MAC address of 18:03:73:78:36:67, on first boot my device's hostname will be set to "system-783667". While this works fine for most installations, some people would prefer to set hostnames to something else. | In order to ensure that every device has a unique hostname for [http://en.wikipedia.org/wiki/Dynamic_dns Dynamic] DNS (and because unique hostnames are simply good form), the ubermix automatically assigns a hostname on first boot to every device it is installed on. This hostname, by default, is set to the word "system" followed by a "-" and the last 3 octets of the device's ethernet card [http://en.wikipedia.org/wiki/Mac_address MAC address]. So, for example, of my device's ethernet card has a MAC address of 18:03:73:78:36:67, on first boot my device's hostname will be set to "system-783667". While this works fine for most installations, some people would prefer to set hostnames to something else. | ||
− | If you would like to set the hostname to something else, you | + | If you would like to set the hostname to something else, you have two options: |
+ | #Set your hostnames manually on each device, disabling the script entirely | ||
#Alter the hostname script that sets the hostname by adding your own customizations | #Alter the hostname script that sets the hostname by adding your own customizations | ||
− | + | ||
+ | |||
+ | Setting the hostname manually: | ||
+ | |||
+ | As of ubermix version 0.913, setting hostnames manually is super-easy. Simply boot your device off of any ubermix install key, choose option "5. Expert Options" then option "5. Set device hostname". This disables the auto set script and sets the machine to the hostname you desire. '''''Please note:''' You probably do not want to do this on a machine you plan to use for a master image (see [http://ubermix.org/customization.html Customization]), or all of your machines will have the same hostname (which is probably not good). | ||
Line 12: | Line 17: | ||
#Press "ctrl-x" to boot your machine | #Press "ctrl-x" to boot your machine | ||
#When your machine finishes booting up, open a terminal (ctrl-alt-t) and type the following: sudo gedit /usr/local/bin/update-hostname | #When your machine finishes booting up, open a terminal (ctrl-alt-t) and type the following: sudo gedit /usr/local/bin/update-hostname | ||
− | #Locate the following | + | #Locate the following section of the script, and change the three instances of the word "system" to whatever you like. Be careful not to delete the "\t" before the word "system" in the second instance: |
− | <nowiki>if ! | + | <nowiki>if ! $FOUND; then |
echo "system-$ETH_ADDR" >/etc/hostname | echo "system-$ETH_ADDR" >/etc/hostname | ||
− | |||
− | |||
− | |||
− | |||
sed -i "s/127.0.1.1.*$/127.0.1.1\tsystem-$ETH_ADDR/g" /etc/hosts | sed -i "s/127.0.1.1.*$/127.0.1.1\tsystem-$ETH_ADDR/g" /etc/hosts | ||
− | + | if `mount | grep -q "SYSTEM on /ro"`; then | |
+ | mount -o rw,remount /ro | ||
+ | cp /etc/hostname /ro/etc/hostname | ||
+ | cp /etc/hosts /ro/etc/hosts | ||
+ | mount -o ro,remount /ro | ||
+ | fi | ||
+ | hostname "system-$ETH_ADDR" | ||
fi | fi | ||
</nowiki> | </nowiki> | ||
When you are done, save your changes, reboot, and all future machines will use your new scheme. | When you are done, save your changes, reboot, and all future machines will use your new scheme. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 12:34, 11 April 2012
In order to ensure that every device has a unique hostname for Dynamic DNS (and because unique hostnames are simply good form), the ubermix automatically assigns a hostname on first boot to every device it is installed on. This hostname, by default, is set to the word "system" followed by a "-" and the last 3 octets of the device's ethernet card MAC address. So, for example, of my device's ethernet card has a MAC address of 18:03:73:78:36:67, on first boot my device's hostname will be set to "system-783667". While this works fine for most installations, some people would prefer to set hostnames to something else.
If you would like to set the hostname to something else, you have two options:
- Set your hostnames manually on each device, disabling the script entirely
- Alter the hostname script that sets the hostname by adding your own customizations
Setting the hostname manually:
As of ubermix version 0.913, setting hostnames manually is super-easy. Simply boot your device off of any ubermix install key, choose option "5. Expert Options" then option "5. Set device hostname". This disables the auto set script and sets the machine to the hostname you desire. Please note: You probably do not want to do this on a machine you plan to use for a master image (see Customization), or all of your machines will have the same hostname (which is probably not good).
To alter the hostname script, do the following:
- Boot or reboot your machine, and press "esc" when the screen goes blank immediately after showing the model specific splash screen.
- Select "Normal Boot" and press the "e" key on your keyboard
- Select the line in the box that begins with the word "initrd" and move the cursor to the end of the line. Backspace over the four letters "aufs" and replace them with "generic". Do not add any spaces.
- Press "ctrl-x" to boot your machine
- When your machine finishes booting up, open a terminal (ctrl-alt-t) and type the following: sudo gedit /usr/local/bin/update-hostname
- Locate the following section of the script, and change the three instances of the word "system" to whatever you like. Be careful not to delete the "\t" before the word "system" in the second instance:
if ! $FOUND; then echo "system-$ETH_ADDR" >/etc/hostname sed -i "s/127.0.1.1.*$/127.0.1.1\tsystem-$ETH_ADDR/g" /etc/hosts if `mount | grep -q "SYSTEM on /ro"`; then mount -o rw,remount /ro cp /etc/hostname /ro/etc/hostname cp /etc/hosts /ro/etc/hosts mount -o ro,remount /ro fi hostname "system-$ETH_ADDR" fi
When you are done, save your changes, reboot, and all future machines will use your new scheme.