How to modify the Linux host name

Source: Internet
Author: User

Linux is a bit of a hassle, even modifying the hostname is no exception. Let's take a look at the specific methods below.

When Linux is installed, its default hostname is localhost. It takes 3 steps to modify the Linux host name.

Use hostname to modify the current host name.

Hostname new-hostname

Modify the/etc/sysconfig/network configuration file so that the next time you restart it, use the new host name.

Open a/etc/sysconfig/network file and modify Hostname=new-hostname.domainname.

The modified/etc/sysconfig/network file is as follows:

Networking=yes

Hostname=new-hostname.localdomain

Modify the native domain name resolution file/etc/hosts so that the native application can parse the new hostname.

Edit file:/etc/hosts

Modified: xxx.xxx.xxx.xxx new-hostname.domainname New-hostname

(Here XXX represents the network address of the machine, it can also be the loopback address 127.0.0.1)

The modified/etc/hosts file is as follows:

127.0.0.1 localhost.localdomain localhost

127.0.0.1 New-hostname.localdomain New-hostname

This article describes how to modify the hostname under the Linux system, actually know the method operation is very simple, I hope this article is helpful to everyone.

How to modify the Linux host name

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.