Install Zimbra, can't use current hosts file

I'm trying to install zimbra on a linux server. I downloaded the Ubuntu 12.04 LTS version of zimbra, unpacked and tried to run install.sh. But after I have approved the license I get this problem.

ERROR: Installation can not proceeed. Please fix your /etc/hosts file to contain:

127.0.0.1 localhost.localdomain localhost

Zimbra install grants mysql permissions only to localhost and
localhost.localdomain users. But Fedora/RH installs leave lines such as these in /etc/hosts:

127.0.0.1 myhost.mydomain.com myhost localhost.localdomain localhost

This causes MySQL to reject users coming from 127.0.0.1 as users from myhost.mydomain.com. You can read more details at:

http://bugs.mysql.com/bug.php?id=11822

The hosts file now looks like this.

127.0.1.1   localhost.localdomain   localhost
127.0.1.1   linux-server-test   localhost
127.0.1.1   mail.mydomain.com   mail

# 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

I Change it to this

127.0.0.1   localhost.localdomain   localhost
127.0.0.1   linux-server-test   localhost
127.0.0.1   mail.mydomain.com   mail

# 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

I then run the script again and this time i get this problem.

ERROR: Installation can not proceeed. Please fix your /etc/hosts file to contain:

ip FQHN HN

Where is the ip address of the host, is the FULLY QUALIFIED host name, and is the (optional) hostname-only portion

I try a last time and remove the lines about localhost and linux-server-test yet the same result. I have config the dns to be able to handle email so that should not be a problem.

dig mydomain.com mx

; <<>> DiG 9.9.2-P1 <<>> mydomain.com mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15967
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mydomain.com.      IN  MX

;; ANSWER SECTION:
mydomain.com.   600 IN  MX  30 mail.mydomain.com.

;; Query time: 17 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Mon Aug 12 16:08:17 2013
;; MSG SIZE  rcvd: 66

So what I'm i doing wrong? (I Replaced all the domain entries in this post to mydomain.com instead of my real domain)


Solution 1:

Use a dedicated line to define your FQDN.

192.168.10.9     mail.mydomain.com mail

Remove it from the 127.0.0.1 line.

Solution 2:

Define the server in /etc/hosts

138.68.159.74 mail.domain.com mail

127.0.0.1 localhost

ensure the hostname is set to mail or whatever

hostname mail

Solution 3:

In all of your examples you are showing an IP of 127.x.x.x. You need to use a real IP. Here's what my hosts file looks like:

[root@zimbra ~]# cat /etc/hosts
1.2.3.4 zimbra.mydomain.com zimbra
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6