Change Hostname in CentOS 7

Source: Internet
Author: User

Change Hostname in CentOS 7

After upgrading the VPS system to CentOS 7, I tried to modify/etc/sysconfig/network to modify the hostname, but it was useless. the method for modifying the Hostname of CentOS 7 is different from that of the previous version. We hope this article will help you modify the Hostname on CentOS 7/RHEL 7.

Use hostnamectl to modify Hostname:

Check the current Hostname

[Root @ bkjia ~] # Hostnamectl status
Static hostname: bkjia. guest
Icon name: computer-vm
Chassis: vm
Machine ID: 19a12d5f5dda-794a19caf165a9b3bca
Boot ID: 21c75ffe0718431d800fd8159be13d99
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
Cpe OS Name: cpe:/o: centos: 7
Kernel: Linux 3.10.0-123.20.1.el7.x86 _ 64
Architecture: x86_64

Set a new Hostname

[Root @ bkjia ~] # Hostnamectl set-hostname mysql.jzbk.org

Check the current Hostname

[Root @ bkjia ~] # Hostnamectl status
Static hostname: mysql.jzbk.org
Icon name: computer-vm
Chassis: vm
Machine ID: 19a12d5f5dda-794a19caf165a9b3bca
Boot ID: 21c75ffe0718431d800fd8159be13d99
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
Cpe OS Name: cpe:/o: centos: 7
Kernel: Linux 3.10.0-123.20.1.el7.x86 _ 64
Architecture: x86_64

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.