RHEL 7/CentOS 7 system host name modification tutorial

Source: Internet
Author: User
Tags centos

RHEL 7/CentOS 7 has changed from the previous method of modifying the hostname, for example, CentOS modification/etc/sysconfig/network takes effect after restart. There are two ways to quickly modify the host name.

Method 1:

Hostnamectl is used to query and modify system settings. For more information about the usage, see online help.

[Root @ idoseek ~] # Hostnamectl set-hostname idoseek.com
[Root @ idoseek ~] # Hostnamectl
Static hostname: www.111cn.net
Icon name: computer-vm
Chassis: vm
Machine ID: fd8cf26e06e411e4a9d004010897bd01
Boot ID: 7f8dbd4c029c470ebbbd7d72ac53a678
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
Cpe OS Name: cpe:/o: centos: 7
Kernel: Linux 3.10.0-123. el7.x86 _ 64
Architecture: x86_64
[Root @ idoseek ~] #

Method 2:

Temporary modification. After exiting, the logon takes effect. After restarting, the modification becomes invalid:

[Root @ idoseek ~] # Hostname www.111cn.net

Permanent modification of host name:

[Root @ idoseek ~] # Vim/etc/hostname
Idoseek.com

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.