MilesWeb
MilesWeb Hosting Forum

Please login or register.

Login with username, password and session length

 

News:

SMF - Just Installed!


Author Topic: How to set hostname to your server ?  (Read 4525 times)

0 Members and 2 Guests are viewing this topic.

Offline Dipak Bhoi

  • MilesWeb Team Member
  • Full Member
  • ***
  • Posts: 208
  • Karma: +5/-0
    • View Profile
    • MilesWeb Internet Services
How to set hostname to your server ?
« on: January 21, 2014, 11:32:37 PM »
Hello guys,

This post cover how to set the server hostname on linux.

Quote
login as: root 
    root@example.com's password: 
    Last login: Tue Jan 21 06:33:17 2014
    [root@example ~]# hostname 
    example.com
 

You can also check via sysctl kernel.hostname

Quote
#sysctl kernel.hostname 
    kernel.hostname = example.com 

I wish to set for this server is instructor.example.com
Quote
# hostname instructor.example.com 

This will set the hostname.
Quote
# hostname 
    instructor.example.com 
once the server is rebooted, hostname is changing to example.com.

To permanently change the hostname, You need to edit the network file at /etc/sysconfig/network

Quote
#vi /etc/sysconfig/network
   
NETWORKING=yes 
HOSTNAME=example.com 
GATEWAYDEV=eth0 
GATEWAY=192.168.0.1

You will have to edit the HOSTNAME entry.

Quote
HOSTNAME=instructor.example.com 

Enjoy !!!

MilesWeb.com
cPanel Hosting in India - cPanel Hosting in India.

Grab an SSL for your website and SAVE 20% now. Coupon Code SSLSAVE20.

MilesWeb Hosting Forum

How to set hostname to your server ?
« on: January 21, 2014, 11:32:37 PM »