nmtui-hostname is useful command in CentOS 8 which promt you to enter your machine hostname and press OK to finish.


Please take a look following example

# nmtui-hostname