To change the hostname (computer name) on CentOS 8, you can use the following steps:
/etc/hostname using a text editor like nano or vi. Replace the current hostname with the new hostname that you want to use. Save and close the file.sudo nano /etc/hostname
/etc/hosts and update the hostname in the line that begins with 127.0.0.1. Replace the current hostname with the new hostname that you want to use. Save and close the file.sudo nano /etc/hosts
hostnamectl command to set the new hostname. This will update the hostname in the system's configuration and apply the change immediately.sudo hostnamectl set-hostname new_hostname
/etc/NetworkManager/NetworkManager.conf and update the hostname value to the new hostname. Save and close the file.sudo nano /etc/NetworkManager/NetworkManager.conf
sudo systemctl restart NetworkManager
After completing these steps, the hostname of your CentOS 8 system should be changed to the new hostname that you specified. You can verify the hostname by running the hostname command or by checking the output of the uname -n command.