<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi there</p>
    <p><br>
    </p>
    <p>I am a bit confused on how to est the hostname on an 18.04
      server.</p>
    <p>I intend to use the server as a mail server running iRedMail.</p>
    <p>The instruction to set up iRedMail instructs to set :</p>
    <p style="margin-bottom: 4px; padding: 0px; font-size: 17px;
      line-height: 24px; color: rgb(0, 0, 0); font-family: "PT
      Sans", Georgia, Palatino, serif; font-style: normal;
      font-variant-ligatures: normal; font-variant-caps: normal;
      font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
      start; text-indent: 0px; text-transform: none; white-space:
      normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
      0px; text-decoration-style: initial; text-decoration-color:
      initial;">On Debian/Ubuntu Linux, hostname is set in two files:<span> </span><code
        style="font-family: Consolas, Monaco, "Andale Mono",
        monospace; line-height: 25px; font-size: 14px; background:
        rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204);
        border-radius: 2px; padding: 1px 5px; overflow-wrap: normal;">/etc/hostname</code><span> </span>and<span> </span><code
        style="font-family: Consolas, Monaco, "Andale Mono",
        monospace; line-height: 25px; font-size: 14px; background:
        rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204);
        border-radius: 2px; padding: 1px 5px; overflow-wrap: normal;">/etc/hosts</code>.</p>
    <ul style="padding-left: 30px; margin: 0px; font-size: 17px;
      line-height: 24px; color: rgb(0, 0, 0); font-family: "PT
      Sans", Georgia, Palatino, serif; font-style: normal;
      font-variant-ligatures: normal; font-variant-caps: normal;
      font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
      start; text-indent: 0px; text-transform: none; white-space:
      normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
      0px; text-decoration-style: initial; text-decoration-color:
      initial;">
      <li style="line-height: 26px;"><code style="font-family: Consolas,
          Monaco, "Andale Mono", monospace; line-height: 25px;
          font-size: 14px; background: rgb(245, 245, 245); border: 1px
          solid rgb(204, 204, 204); border-radius: 2px; padding: 1px
          5px; overflow-wrap: normal;">/etc/hostname</code>: short
        hostname, not FQDN.</li>
    </ul>
    <pre style="padding: 5px 10px; white-space: pre-wrap; background: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 2px; overflow-wrap: normal; font-size: 14px; line-height: 25px; margin-left: 30px; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><code style="font-family: Consolas, Monaco, "Andale Mono", monospace; line-height: 25px; font-size: 14px; background: rgb(245, 245, 245); border: 0px; border-radius: 2px; padding: 5px 10px 5px 0px; overflow-wrap: normal; margin: 0px;">mx</code></pre>
    <p>and to to set etc hosts:<br>
    </p>
    <ul style="padding-left: 30px; margin: 0px; font-size: 17px;
      line-height: 24px; color: rgb(0, 0, 0); font-family: "PT
      Sans", Georgia, Palatino, serif; font-style: normal;
      font-variant-ligatures: normal; font-variant-caps: normal;
      font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
      start; text-indent: 0px; text-transform: none; white-space:
      normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
      0px; text-decoration-style: initial; text-decoration-color:
      initial;">
      <li style="line-height: 26px;"><code style="font-family: Consolas,
          Monaco, "Andale Mono", monospace; line-height: 25px;
          font-size: 14px; background: rgb(245, 245, 245); border: 1px
          solid rgb(204, 204, 204); border-radius: 2px; padding: 1px
          5px; overflow-wrap: normal;">/etc/hosts</code>: static table
        lookup for hostnames.<span> </span><strong>Warning</strong>:
        Please list the FQDN hostname as first item.</li>
    </ul>
    <pre style="padding: 5px 10px; white-space: pre-wrap; background: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 2px; overflow-wrap: normal; font-size: 14px; line-height: 25px; margin-left: 30px; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><code style="font-family: Consolas, Monaco, "Andale Mono", monospace; line-height: 25px; font-size: 14px; background: rgb(245, 245, 245); border: 0px; border-radius: 2px; padding: 5px 10px 5px 0px; overflow-wrap: normal; margin: 0px;"># Part of file: /etc/hosts
127.0.0.1   mx.example.com mx localhost localhost.localdomain
</code></pre>
    <br class="Apple-interchange-newline">
    <p>so what I did:</p>
    <p>in /etc/cloud/cloud.cfg</p>
    <p>I changed:</p>
    <p># This will cause the set+update hostname module to not operate
      (if true)<br>
      preserve_hostname: true</p>
    <p>in /etc/hostname:</p>
    <p>mx</p>
    <p><br>
    </p>
    <p>in /etc/hosts:<br>
    </p>
    <p>127.0.1.1 redcor.com redcor.com<br>
      127.0.0.1 mx.redcor.com localhost<br>
      <br>
      # The following lines are desirable for IPv6 capable hosts<br>
      ::1 ip6-localhost ip6-loopback<br>
      fe00::0 ip6-localnet<br>
      ff00::0 ip6-mcastprefix<br>
      ff02::1 ip6-allnodes<br>
      ff02::2 ip6-allrouters<br>
      ff02::3 ip6-allhosts<br>
      <br>
    </p>
    <p>However when I execute:</p>
    <p>hostname -f</p>
    <p>I get:</p>
    <p>mx</p>
    <p><br>
    </p>
    <p>How should I setup the hostname, that I can use the server as a
      mailserver for mail.redcor.com</p>
    <p><br>
    </p>
    <p>thannks, robert<br>
    </p>
  </body>
</html>