Saturday, May 14, 2011

How to change your hostname in Ensim?

October 12, 2009 by admin  
Filed under Ensim

Leave a Comment

There are many discussions about changing your hostname in Ensim. Many are overly complicated or detailed, miss critical steps, or add steps that are unnecessary. Changing your hostname requires editing two files and restarting your server — thats it!

Of course, you will need to know how to use telnet or SSH and a text editor on Linux. If you are new to linux and have ever used PINE email, then pico will be familiar to you as it is the internal editor used in PINE.

Editing The Files

You need to edit two files to change your hostname on ensim. The first file is a network configuration file that sets the hostname when the server starts. The second file is the hosts file that the system uses to map your hostname to an IP address. Keep in mind that we only need to change the domain name or hostname in each file. The IP address and domains used below are just examples.

Network Configuration File

The first file, called network, is located in /etc/sysconfig/network. Let’s, take a look at its contents:

NETWORKING=yes
HOSTNAME=”ensim.rackshack.net”
GATEWAY=”192.168.1.100″
GATEWAYDEV=”eth0″
FORWARD_IPV4=”yes”

You only need to edit one line in this file; the line beginning with HOSTNAME should be changed to reflect the hostname you want. We suggest using ensim.domain.com where domain.com is the primary domain for your server.

We are going to change our domain to ensim.rackaid.com. After the change, our file will look like this:

NETWORKING=yes
HOSTNAME=”ensim.rackaid.com”
GATEWAY=”192.168.1.100″
GATEWAYDEV=”eth0″
FORWARD_IPV4=”yes”

This will set the hostname to ensim.rackaid.com on the next reboot. To check the file after saving, simply use either the more or cat command:

more /etc/sysconfig/network
cat /etc/sysconfig/network

Make sure the file is correct and that you have not introduced extra spaces and/or eliminated necessary quotes. Now that this is change, we need to edit our hosts file.

Hosts File

As with the network file, this is very easy. You simply need to change one line to reflect the proper hostname. The second file, called hosts, is located in /etc/hosts. Let’s, take a look at its contents:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain   localhost
192.168.1.100    ensim.rackshack.net   ensim

As you can see, this file is mapping the IP addresses to the hostnames. The localhost entry should not be touched as it is used for a variety of programs. This file is actually tab delimited. This is because certain system utilities use tabs instead of spaces to edit this file. The file will work with spaces but I also make sure there is at least one tab between each field.

As before making the change is easy. Simply edit the file to match your new hostname, in this case ensim.rackaid.com:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain   localhost
192.168.1.100    ensim.rackaid.com   ensim

Now the hostname is changed in the hosts file we can reboot the server. Simply issue the command “reboot” at the command line to reboot your server. When the server comes backup, login to your control panel to see the new hostname.

GD Star Rating
loading...
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

No related posts.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
Click here to cancel reply.