Linux Modify machine Name

Source: Internet
Author: User

First modify the Linux server name

In the daily work, if there are a large number of servers, the establishment of easy to remember the machine name, easy to manage daily.

Recommended command rules: Use +IP address after 2 segment


1. Change the network file under/etc/sysconfig, Vi/etc/sysconfig/network, and replace the value after hostname to the hostname you want to set.

2. Change the Hosts file under/etc, vi/etc/hosts, and then replace Localhost.localdomain with the hostname you want to set. After this command goes in, there are multiple names, change the name of the red line below to the name you want, and ensure that the name in step 1 is consistent.


127.0.0.1 localhost Change the name of this location to the name you want localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6

3, enter the reboot command, restart the server, restart to take effect.
If it is not convenient to restart, you can use the input command: hostname computer name return (such as hostname Linux) temporary modification, if the configuration file is not changed, the restart is restored to the original, the configuration file will prevail

4, restart the completion of the system with the hostname command to query the host name


This article is from the Linux learning blog, so be sure to keep this source http://12681282.blog.51cto.com/12671282/1904836

Linux Modify machine 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.