CentOS 7.0 modify hostname

Source: Internet
Author: User

CentOS 7.0 modify hostname

In centos, you can modify the hostname temporarily or permanently. Temporary modification does not require a restart and takes effect immediately.

Temporarily modify hostname
# Hostname // view the current hostname # hostname newname // temporarily modify the hostname
Permanent modification of hostname

To permanently modify the hostname, You need to modify the file,man hostnameCheck the user manual,

Set name When called with one argument or with--Fileoption, the commands set the host name or the NIS/YP domain name.HostnameusesSethostname (2) function, while all of the threeDomainname,Ypdomain-nameandNisdomainnameuseSetdomainname (2). Note, that this is effec-tive only until the next reboot. Edit/Etc/hostnamefor permanent change.

If you want to modify the hostname permanently, you can modify it/etc/hostnameFile. Use vim to replace the hostname in the file with the value to be modified.

Note: If you want to permanently modify the RedHat hostname, modify the/etc/sysconfig/network file and change the HOSTNAME line to HOSTNAME = NEWNAME. NEWNAME is the hostname you want to set.

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.