LearnSetting the Hostname and Timezone of Your Virtual Server

Jim Hoskins
writes on February 18, 2013

This is part two of this Quick Tip series. Click here to watch the first.

Now that you’ve setup and connected to your Linode, you need to give it a hostname. The hostname is the name of the machine, and can be set with just a couple commands.

Use the “echo” command, followed by the name of your server in quotes, followed by a greater than sign and /etc/hostname

Next, type in:
hostname -F /etc/hostname

You may also need to find and edit an additional file. To find out, type the following:
ls /etc/default/

If there dhcpcp file (in our case there isn’t), you will need to comment out the line that sets the hostname by placing the # symbol at the beginning of the line.

Now you’ll need to edit your hosts file with a text editor. You can use the built in nano editor by typing the following command:

nano /etc/hosts

Use the arrow keys to add in another line with the IP address of your server, then tab over and enter the name of your server. Save and exit the file.

Now you want to setup your timezone with the dpkg command:
dpkg-reconfigure tzdata

This will give you an interface to choose your geographic area and time zone of your server.

You now have a hostname and time zone for your Linode server.

One Response to “Setting the Hostname and Timezone of Your Virtual Server”

  1. you should point this article is about setting hostname and timezone on debian based servers, rhel/fedora based distros is done different, at least for the timezone

Leave a Reply

You must be logged in to post a comment.

Learning to code can be fun!

Get started today with a free trial and discover why thousands of students are choosing Treehouse to learn about web development, design, and business.

Learn more