How to modify the server name reference method under Linux system

Source: Internet
Author: User

To view the host name of Ubuntu, you can view it by command:

Hostname

Modifying the host name requires two files to be changed:

/etc/hostname

/etc/hosts

In the hostname file, change the original host name to a new one. In the Hosts file, you can

Change the original hostname portion of the 127.0.0.1 resolution to the new host name

---------------------------------------------------

1. Modify the Linux server name

# vi/etc/sysconfig/network

Networking=yes

Hostname=yourname//change in this HOSTNAME

2. Modify the name inside the/etc/hosts

# vi/etc/hosts

127.0.0.1 localhost.localdomain localhost

127.0.0.1 yourname//change in this hostname

3. Finally executed under the terminal

#hostname * * * *//***** for modified hostname

The hostname command only temporarily changes the hostname, and the host name is restored to the original after reboot.

To permanently change the host name, you need to modify the/etc/sysconfig/network file.

View Host name command

# Uname-n

#Centos

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.