Modify the Linux host name)

Source: Internet
Author: User

Next, let's take a look at the Linux host name modification method. I hope this article will help you.

After inux is installed, its default host name is localhost.

Three steps are required to modify the Linux host name:

1. Use hostname to modify the current host name.
 
Hostname new-hostname

2. Modify the/etc/sysconfig/network configuration file so that the new host name can be used at the next restart.

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

 
HOSTNAME = new-hostname.localdomain

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

Edit the file:/etc/hosts
Modify: xxx. xxx new-hostname.domainname new-hostname
(Here xxx represents the network address of the local machine, or the loopback address 127.0.0.1)
The modified/etc/hosts file is as follows:

127.0.0.1 localhost. localdomain
127.0.0.1 new-hostname.localdomain new-hostname

Restart takes effect.

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.