Thursday, September 11, 2008

Linux : setting up hostname

Here's how you can set hostname of your linux machine

Become root, save hostname in /etc/hostname and tell the hostname
command to read the name from the file.
Here are the commands to do the same

% su
% echo your_hostname > /etc/hostname
% hostname -F /etc/hostname

However, on next reboot, hostname will be lost.

On Red Hat / centOS, edit HOSTNAME= entry of the file
/etc/sysconfig/network

This sets up the hostname permanently.

No comments: