Setting The Hostname (Fqdn) in Linux Servers

Setting the Hostname (FQDN) in Linux Servers
by Janeth Kent Date: 29-05-2013 hostname fqdn linux server apache fedora ubuntu


Here we will show how to set your system's hostname and fully qualified domain name (FQDN). Your hostname should be something unique. Some people name their servers after planets, philosophers, or animals. Note that the system's hostname has no relationship to websites or email services hosted on it, aside from providing a name for the system itself. Your hostname should not be "www" or anything too generic.

CentOS / Fedora

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

echo "HOSTNAME=myservername" >> /etc/sysconfig/network
hostname "myservername"

Slackware

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

echo "myservername" > /etc/HOSTNAME
hostname -F /etc/HOSTNAME

Gentoo

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

echo "HOSTNAME=\"myservername\"" > /etc/conf.d/hostname
/etc/init.d/hostname restart

Arch Linux

Edit your /etc/rc.conf to configure the hostname for your system. Be sure to replace myservername with the hostname of your choice:

File excerpt:/etc/rc.conf

HOSTNAME="myservername"
  

Issue the following command to set the hostname, replacing myservername with the hostname of your choice:

hostname myservername

Update /etc/hosts

Next, edit your /etc/hosts file to resemble the following example, replacing myservername 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      myservername.example.com        myservername
  

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                     myservername.example.com        myservername
2600:3c01::a123:b456:c789:d012  myservername.example.com        myservername
  

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.

 
by Janeth Kent Date: 29-05-2013 hostname fqdn linux server apache fedora ubuntu hits : 8834  
 
Janeth Kent

Janeth Kent

Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN END DEVELOPMENT.

 
 
 

Related Posts

How to install a Linux partition on a Windows 10 PC

In spite of a past we could say almost confronted, the approach between Windows and Linux is accelerating more and more, drawing a story closer to love than to hate.…

Matrix. An open network for secure and decentralized communication that you can install in your Ubuntu server

Imagine to have an open platform that is as independent, vibrant and evolving as the Web itself, but for communication. As of June 2019, Matrix is out of beta, and the protocol…

WSL2 is released to run Linux distributions on Windows

If you are reading about this for the first time, the Windows Subsystem for Linux is a kind of virtual machine that allows you to run the Linux terminal on…

Linux For Dummies: Permissions

In the previous articles I made a short introduction to the Unix world and in the following article I have dealt with the basic commands for the file system management. Today we are…

Linux for Dummies: Ubuntu Terminal

I introduced in the previous article, available here, the basic concepts concerning the Linux world. Today we are going to have a look to some basic operations that we can perform…

Linux for Dummies: Introduction

If you have thought about migrating from Windows to a Unix operating system, or Linux specifically there are things you should know. The goal is to give essential information (and…

How to setup Free Let’s Encrypt SSL certificates with ISPConfig 3

Let’s Encrypt is an initiative to provide a better way of enabling encryption on websites. It is open, automated and above all: it offers free SSL certificates. Obtaining SSL certificates was always…

Must-Have htaccess Tips for you to Avoid Duplicate Content on Your Site

In order to be able to implement these tips it is necessary that your Apache server already has the mod_rewrite module activated. mod_rewrite and .htaccess are used together so that…

The Best RSS Readers for Ubuntu

Even if most of the tech experts actively claim that RSS (Rich Site Summary) is dead especially after Google Reader was discontinued 5 years ago but it isn’t yet as…

Configuring DNS-over-TLS and DNS-over-HTTPS with any DNS Server

The new DNS-over-TLS (DoT) and DNS-over-HTTPS (DoH) protocols are available for enabling end user's privacy and security given the fact that most DNS clients use UDP or TCP protocols which…

80 Linux Network Monitor Software & Tools for Managing & Monitoring Unix/Linux Systems

It’s hard work monitoring and debugging Linux performance problems, but it’s easier with the right tools at the right time. Finding a Linux Network Monitor tool or Software package for…

How to install Letsencrypt Certificates with Certbot in Ubuntu

In this article we will explain how to install, manage and configure the SSL Security certificate, Let's Encypt in NGINX server used as proxy. This certificate is free but does…

We use our own and third-party cookies to improve our services, compile statistical information and analyze your browsing habits. This allows us to personalize the content we offer and to show you advertisements related to your preferences. By clicking "Accept all" you agree to the storage of cookies on your device to improve website navigation, analyse traffic and assist our marketing activities. You can also select "System Cookies Only" to accept only the cookies required for the website to function, or you can select the cookies you wish to activate by clicking on "settings".

Accept All Only sistem cookies Configuration