Two places need to be modified: One is/etc/sysconfig/network, the other is/etc/hosts, and modifying any one of these will cause the system to boot abnormally. First switch to root user.
The code is as follows:
/etc/sysconfig/network
Open the file in any of your favorite editors, with a line of Hostname=localhost.localdomain (if default), and modify localhost.localdomain for your hostname.
The code is as follows:
/etc/hosts
Open the file and there will be a row 127.0.0.1 localhost.localdomain localhost. Where 127.0.0.1 is the local loop address, Localhost.localdomain is the host name (hostname), which is what you want to modify. LocalHost is the alias of the host name (alias), which appears under the Konsole prompt. Change the second item to your host name and the third option.
When the above two documents have been modified, they will not take effect immediately. If you want to take effect immediately, you can use hostname your-hostname to make temporary changes, it is only temporarily modify the hostname, the system will restore the original after reboot. However, modifying the top two files is permanent, and restarting the system will get the new host name.
Finally, check the host name uname-n after reboot.