How to Set Hostname in Linux
- 06/06/2020 8:01 PM
REDHAT/CENTOS
Local hostname and domain name of your server defined in text configuration located in /etc directory.
If you are using Red Hat, Fedora
Use redhat-config-network GUI tool. Type following command and click on DNS tab > Setup hostname and domain name:
# redhat-config-network
On other hand you can edit a text file in CENTOS. Find out and set up the value for HOSTNAME in the file /etc/sysconfig/network:
# vi /etc/sysconfig/network
Setup/replace HOSTNAME
HOSTNAME=myserver.domain.com
DEBIAN
You need to edit /etc/hostname file and put hostname.domain.com in this file:
# vi /etc/hostname
Set or replace hostname:
myserver.domain.com