Set hostname in CentOS 7

Hostname is a sub domain. To set hosting, edit file

vi /etc/hosts

Add

SERVER_IP_HERE HOSTNAME.yourdomain.com HOSTNAME

Example

72.21.51.194 server32.serverok.in server32

Now run

echo HOSTNAME.yourdomain.com > /etc/hostname

Example

echo server32.serverok.in > /etc/hostname

Run

/bin/hostname -F /etc/hostname

Edit file

vi /etc/sysconfig/network

Edit or add HOSTNAME entry

NETWORKING=yes
HOSTNAME=HOSTNAME.yourdomain.com

Reboot the server with

reboot

You can verify hostname with command

hostname

Related Posts

Change Server Hostname in VestaCP
Set Permanant hostname on AWS EC2 CentOS 7 server
Install SSL for Cpanel Server Hostname

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *