Hostname and TimeZone


Ubuntu / Debian

Enter following commands to set the hostname, replacing plato with the hostname of your choice:

echo "plato" > /etc/hostname
hostname -F /etc/hostname

If it exists, edit the file /etc/default/dhcpcd to comment out the SET_HOSTNAME directive:

File excerpt:/etc/default/dhcpcd

#SET_HOSTNAME='yes'

Update /etc/hosts

Next, edit your /etc/hosts file to resemble the following example, replacing plato with your chosen hostname, example.com with your system's domain name, and 12.34.56.78 with your system's IP address. As with the hostname, the domain name part of your FQDN does not necesarily need to have any relationship to websites or other services hosted on the server (although it may if you wish). As an example, you might host "www.something.com" on your server, but the system's FQDN might be "mars.somethingelse.com."

File:/etc/hosts

127.0.0.1        localhost.localdomain    localhost
12.34.56.78      plato.example.com        plato

If you have IPv6 enabled on your Linode, you will also want to add an entry for your IPv6 address, as shown in this example:

File:/etc/hosts

127.0.0.1                       localhost.localdomain    localhost
12.34.56.78                     plato.example.com        plato
2600:3c01::a123:b456:c789:d012  plato.example.com        plato

The value you assign as your system's FQDN should have an "A" record in DNS pointing to your Linode's IPv4 address. For Linodes with IPv6 enabled, you should also set up a "AAAA" record in DNS pointing to your Linode's IPv6 address. For more information on configuring DNS, seeAdding DNS Records.

Setting the Timezone

All Linodes are set to Eastern Standard Time by default, but you can change the timezone to whatever you want it to be. It may be best to set it to the same timezone of most of your users. If you're unsure which timezone would be best, consider using universal coordinated time or UTC (also known as Greenwich Mean Time).

Ubuntu / Debian

Enter the following command to access the timezone utility:

dpkg-reconfigure tzdata

Checking the Time

Now try entering the following command to view the current date and time according to your server:

date

The output should look similar to this: Thu Feb 16 12:17:52 EST 2012.


Tag Cloud