first part of line in terminal

Tom H tomh0665 at gmail.com
Sun Jan 9 10:43:56 UTC 2011


On Sun, Jan 9, 2011 at 5:22 AM, Jacob Mansfield <cyberjacob at gmail.com> wrote:
> On 09/01/11 08:57, Colin Law wrote:
>>
>> When installing Ubuntu there is a field for entry of the machine name,
>> which is defaulted to a value the installer chooses.  I don't remember
>> exactly where that is, but I do know that it is easy to miss, I have
>> more than once not noticed it and ended up with machine name I did not
>> want.
>
> The hostname is set in the installation when the default user is created.
> assuming ubuntu desktop with a user name of Peter Parker the hostname
> becomes Peter-Desktop by default.
> this setting can be changed by editing /etc/hostname and rebooting

Rebooting isn't necessary.

You can run "hostname <newhostname>" or "sysctl
kernel.hostname=<hostname>" to change the hostname on the fly.

To ensure that this change is persistent across reboots, edit
"/etc/hostname" and "/etc/hosts" (the "127.0.1.1" line and, if you're
using a static ip, the <ip> line).

I've never renamed a box because we always rebuild a box if we rename
it, but there may be other files to edit depending on your setup (if
you're running a mail server, you have to change "/etc/mailname"; if
you're running mdadm, you *may* have to update the metadata and the
initrd).




More information about the ubuntu-users mailing list