Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2002
    Location
    United Kingdom
    Posts
    1,236

    how do you set the hostname in linux?

    hi how do you set the hostname in linux?

    im a complete newbie, and its taking a while to adapt

  2. #2
    Join Date
    Aug 2001
    Posts
    615
    Edit the /etc/hosts file from the command line.

    # pico /etc/hosts

    Add the line but do not remove the first line.

    Control O Control X
    So we finish the 18th and he's gonna stiff me. And I say, "Hey, Lama, hey, how about a little something, you know, for the effort, you know?" And he says, 'Oh, there won't be any money. But when you die, on your deathbed, you will receive total consciousness.' So I got that goin' for me, which is nice." --Bill Murray Caddyshack

  3. #3
    Join Date
    Oct 2001
    Location
    Canada
    Posts
    157
    man hostname
    /etc/hostname

  4. #4
    Join Date
    Aug 2001
    Posts
    615
    Woops correct me if I am wrong.
    So we finish the 18th and he's gonna stiff me. And I say, "Hey, Lama, hey, how about a little something, you know, for the effort, you know?" And he says, 'Oh, there won't be any money. But when you die, on your deathbed, you will receive total consciousness.' So I got that goin' for me, which is nice." --Bill Murray Caddyshack

  5. #5
    Join Date
    Dec 2001
    Posts
    1,029
    Each Linux distribution has a different way of setting the host name, and if you're using control panel software, that can complicate things.

    I'm not sure about other control panels, but if you're using Cpanel, you should change the host name using WHM.

    Otherwise, In Red Hat Linux, edit /etc/sysconfig/network and change HOSTNAME to whatever you want the host name to be. For example, if you want the host name to be my.host.name, the line should look like this:

    HOSTNAME=my.host.name

    It is also a good idea to add the host name to /etc/hosts. Edit /etc/hosts and add a line with your server's main IP address followed by the host name. For example, if your server's main IP address is 127.142.128.35, the line should look like this:

    127.142.128.35 my.host.name

    Then on the shell, type hostname followed by the host name and press Enter. For example:

    hostname my.host.name

    That should take care of it. If you're a control panel, restart the control panel software, or reboot.
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

  6. #6
    Join Date
    Feb 2002
    Posts
    956
    Just enter this:
    Code:
    hostname google.com
    reboot
    This forum officially ****ing sucks

  7. #7
    hehe, why do you need to reboot?
    Powered by AMD & FreeBSD.
    "Documentation is like sex:
    when it is good, it is very, very good;
    and when it is bad, it is better than nothing."

  8. #8
    Join Date
    Dec 2001
    Posts
    1,029
    Originally posted by roly
    Just enter this:
    Code:
    hostname google.com
    reboot
    ...but that doesn't save the host name, so when you reboot, wouldn't it revert back to the old host name?
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

  9. #9
    Join Date
    Sep 2001
    Location
    Madras
    Posts
    738
    You should also remember to add an A record for the hostname in your domain's DNS .

    If for example you are going to use

    peacock.xanadu.com as the host name for a server

    you should have

    1] an A record for pecock.xanadu.com in the DNS info of xanadu.com [it is not necessary that either the DNS or xanadu.com be hosted on the server]

    2] the A record should resolve to an IP on the server

    If hostname doesn't resolve Apache wouldn't start

    Cheers
    Balaji
    Offering Managed Servers - for an exclusive clientèle who value uptime, caring support and superior technology.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •