Centos7 permanent hostname modification method, centos7hostname

Source: Internet
Author: User

Centos7 permanent hostname modification method, centos7hostname

The modification method of hostname in centos7 has changed. Modification of the/etc/hosts and/etc/sysconfig/network files is no longer effective. The new command used is:
Shell> hostnamectl set-hostname centos7
Shell> su
Shell> hostname
Use this method for versions earlier than centos 7:
Shell> vi/etc/sysconfig/network

Created by anaconda

HOSTNAME = centos6
: Wq # Save and exit
Host A/B accesses host B directly through hostname:

Host A settings

Shell> vi/etc/sysconfig/network
GATEWAY = # Intranet ip address of the current host
: Wq # Save and exit

Host A/B settings

Shell> vi/etc/hosts hostname
: Wq # Save and exit

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.