Zimbra on EC2 tips: Difference between revisions

Line 89: Line 89:
その為に、Zimbra を最初にインストールした際の、"logical hostname" ではプライベートIPアドレスが変わってしまっているので、LDAP サーバが bind できない、という事態に陥ります。
その為に、Zimbra を最初にインストールした際の、"logical hostname" ではプライベートIPアドレスが変わってしまっているので、LDAP サーバが bind できない、という事態に陥ります。
それを避けるために、内部 DNS サーバを立ち上げて、導入時に真の意味での、論理ホスト名になるような "logical hostname" を指定して、インスタンス起動時に割り当てられたプライベートIPアドレスに都度対応できるようにします。
それを避けるために、内部 DNS サーバを立ち上げて、導入時に真の意味での、論理ホスト名になるような "logical hostname" を指定して、インスタンス起動時に割り当てられたプライベートIPアドレスに都度対応できるようにします。
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo aptitude -y install bind9
sudo aptitude -y install bind9
sudo aptitude install python-ipy
sudo aptitude install python-ipy
Line 104: Line 104:


/etc/hostname に host名 (この場合は aws) を設定します。
/etc/hostname に host名 (この場合は aws) を設定します。
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
echo "aws" | sudo tee /etc/hostname
echo "aws" | sudo tee /etc/hostname
sudo /bin/hostname -F /etc/hostname
sudo /bin/hostname -F /etc/hostname
Line 110: Line 110:


/etc/hosts に、このインスタンスのプライベート IP address, fqdn, host名を設定します。
/etc/hosts に、このインスタンスのプライベート IP address, fqdn, host名を設定します。
<syntaxhighlight>
<syntaxhighlight lang="text" enclose="div">
127.0.0.1 localhost
127.0.0.1 localhost
IPADDRESS aws.example.com aws
IPADDRESS aws.example.com aws
Line 124: Line 124:


正しく host名と fqdn 設定されているかを確認します。
正しく host名と fqdn 設定されているかを確認します。
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
/bin/hostname -s
/bin/hostname -s
(host名が返る)
#(host名が返る)
/bin/hostname -f
/bin/hostname -f
(fqdnが返る)
#(fqdnが返る)
/bin/hostname -d
/bin/hostname -d
(ドメイン名が返る)
#(ドメイン名が返る)
</syntaxhighlight>
</syntaxhighlight>


Line 138: Line 138:


ec2-set-hosts
ec2-set-hosts
<syntaxhighlight lang="python" enclose="pre">
<syntaxhighlight lang="python" enclose="div">
#!/usr/bin/python
#!/usr/bin/python
#
#
Line 182: Line 182:




<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo chmod +x /usr/local/etc/init/ec2-set-hosts
sudo chmod +x /usr/local/etc/init/ec2-set-hosts
</syntaxhighlight>
</syntaxhighlight>


/usr/local/etc/bind/templates/hosts.tmpl
/usr/local/etc/bind/templates/hosts.tmpl
127.0.0.1 localhost
<syntaxhighlight lang="text" enclose="div">
$localipv4 $fqdn $hostname
127.0.0.1 localhost
$localipv4 $fqdn $hostname
# The following lines are desirable for IPv6 capable hosts
 
::1 ip6-localhost ip6-loopback
# The following lines are desirable for IPv6 capable hosts
fe00::0 ip6-localnet
::1 ip6-localhost ip6-loopback
ff00::0 ip6-mcastprefix
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff00::0 ip6-mcastprefix
ff02::2 ip6-allrouters
ff02::1 ip6-allnodes
ff02::3 ip6-allhosts
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
</syntaxhighlight>


/usr/local/etc/init に配置して、実行権限を付与します。
/usr/local/etc/init に配置して、実行権限を付与します。