Reset Host Name on Linux Systems

This section provides a tutorial example on how to view and change host name settings on Linux systems.

After installing a new Linux system, you want to check and reset its host name with more meaningful name.

1. View the current host name using the "hostname" command. I see the default host name "localhost.localdomain" on my CentOS computer.

herong$ hostname

localhost.localdomain

2. Reset the host name with "hostnamectl set-hostname" command. "mail" is used to identify this computer as the Mail server.

herong$ sudo hostnamectl set-hostname mail

herong$ hostname
mail

3. Look at hostname file on the system. You can actually set the host name by editing this file.

herong$ sudo more /etc/hostname
mail

4. Map host name to IP address.

herong$ sudo vi /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.100 mail.herongyang.com mail

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Memory Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

Installing CentOS

 Create CentOS Bootable USB

 Install CentOS from Bootable USB

 Install CentOS by Deleting Existing Partition

 Reset Timezone on Linux Systems

Reset Host Name on Linux Systems

 Update All Installed Packages

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB