Modify Linux host name (hostname)

Source: Internet
Author: User

When the Inux is installed, its default hostname is localhost.

It takes 3 steps to modify the Linux host name:

1. Modify the current host name using hostname.

Hostname new-hostname

2. Modify the/etc/sysconfig/network configuration file so that the new hostname is used the next time you restart.

Open the/etc/sysconfig/network file and change the hostname to the following content.


Hostname=new-hostname.localdomain

3. Modify the local domain name resolution file/etc/hosts, so that the application of this machine can resolve the new host name.

Edit file:/etc/hosts
Modified: xxx.xxx.xxx.xxx new-hostname.domainname New-hostname
(XXX here on behalf of the local network address, can also be loopback address 127.0.0.1)
The modified/etc/hosts file is as follows:

127.0.0.1 localhost Localhost.localdomain
127.0.0.1 New-hostname New-hostname.localdomain

The reboot will take effect.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.