setting the hostname on ubuntu 18.04 / iRedMail

Tom H tomh0665 at gmail.com
Mon Jan 21 23:24:50 UTC 2019


On Wed, Jan 9, 2019 at 12:41 PM robert rottermann <robert at redcor.ch> wrote:
>
> I am a bit confused on how to est the hostname on an 18.04 server.
>
> I intend to use the server as a mail server running iRedMail.
>
> The instruction to set up iRedMail instructs to set :
>
> On Debian/Ubuntu Linux, hostname is set in two files: /etc/hostname and /etc/hosts.
>
> /etc/hostname: short hostname, not FQDN.
>
> mx
>
> and to to set etc hosts:
>
> /etc/hosts: static table lookup for hostnames. Warning: Please list the FQDN hostname as first item.
>
> # Part of file: /etc/hosts
> 127.0.0.1   mx.example.com mx localhost localhost.localdomain
>
> so what I did:
>
> in /etc/cloud/cloud.cfg
>
> I changed:
>
> # This will cause the set+update hostname module to not operate (if true)
> preserve_hostname: true
>
> in /etc/hostname:
>
> mx
>
> in /etc/hosts:
>
> 127.0.1.1 redcor.com redcor.com
> 127.0.0.1 mx.redcor.com localhost
>
> # The following lines are desirable for IPv6 capable hosts
> ::1 ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
> ff02::3 ip6-allhosts
>
> However when I execute:
>
> hostname -f
>
> I get:
>
> mx
>
> How should I setup the hostname, that I can use the server as a mailserver for mail.redcor.com

If you're using a dynamic address

# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 mx.redcor.com redcor.com
...ipv6...

If you're using a static address and don't want to use the above

# cat /etc/hosts
127.0.0.1 localhost
<static_address> mx.redcor.com redcor.com
...ipv6...

But you can use

# cat /etc/hosts
127.0.0.1 localhost
...ipv6...

if
you're using systemd-resolved and install lbnss-resolve
or if
you're not using systemd-resolved and install lbnss-myhostname




More information about the ubuntu-users mailing list