さくらVPSサーバ設定メモ(5)

2011年5月14日 オフ 投稿者: KYO

続いて、Perl、DNSなど。

  • perl
  • bind(DNS)

  • perl
    • モジュールは別途CPANコマンドからインストール

$ sudo yum install perl



 
<ul>
	<li>mysql</li>
</ul>


$ sudo yum install mysql mysql-devel mysql-server php-mysql mysql-bench

$ sudo vim /etc/my.cnf

$sudo /etc/rc.d/init.d/mysqld start

$sudo chkconfig mysqld on

 

  • bind(DNS)
    • さくらVPSでは、コントロールパネルからDNS設定可能なので通常は不要

 


$ sudo yum -y install bind caching-nameserver

$ sudo su

# cp /etc/named.caching-nameserver.conf /etc/named.conf

# chgrp named /etc/named.conf

# vim /etc/named.conf

&nbsp;

&nbsp;

//

// named.caching-nameserver.conf

//

// Provided by Red Hat caching-nameserver package to configure the

// ISC BIND named(8) DNS server as a caching only nameserver

// (as a localhost DNS resolver only).

//

// See /usr/share/doc/bind*/sample/ for example named configuration files.

//

// DO NOT EDIT THIS FILE - use system-config-bind or an editor

// to create named.conf - edits to this file will be lost on

// caching-nameserver package upgrade.

//

options {

version         "unknown";

directory       "/var/named";

dump-file       "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

memstatistics-file "/var/named/data/named_mem_stats.txt";

// Those options should be used carefully because they disable port

// randomization

// query-source    port 53;

// query-source-v6 port 53;

allow-query     { any; };

allow-query-cache { localhost; };

forwarders{

xxx.xxx.xxx.xxx;     // forwardするDNSサーバのIPを指定

};

allow-transfer {

127.0.0.1;

};

blackhole{

};

};

logging {

channel default_debug {

file "data/named.run";

severity dynamic;

};

};

// named.rfc1912.zones:

//

// Provided by Red Hat caching-nameserver package

//

// ISC BIND named zone configuration for zones recommended by

// RFC 1912 section 4.1 : localhost TLDs and address zones

//

// See /usr/share/doc/bind*/sample/ for example named configuration files.

//

zone "." IN {

type hint;

file "named.ca";

};

zone "localdomain" IN {

type master;

file "localdomain.zone";

allow-update { none; };

};

zone "localhost" IN {

type master;

file "localhost.zone";

allow-update { none; };

};

zone "0.0.127.in-addr.arpa" IN {

type master;

file "named.local";

allow-update { none; };

};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {

type master;

file "named.ip6.local";

allow-update { none; };

};

zone "255.in-addr.arpa" IN {

type master;

file "named.broadcast";

allow-update { none; };

};

zone "0.in-addr.arpa" IN {

type master;

file "named.zero";

allow-update { none; };

};

//

//      example.com

//

zone "example.com" IN {

type master;

file "example.com.zone";

allow-update { none; };

};

zone "xxx.xxx.xxx.in-addr.arpa" IN {

type master;

file "xxx.xxx.xxx.in-addr.arpa";

allow-update { none; };

};

 

  • root(dns)

# sudo dig . ns @198.41.0.4 &gt; /var/named/chroot/var/named/named.ca

zone(a)

 

  • ドメインゾーンファイルの編集
    • 正引きゾーン

# vim /var/named/example.com.zone

&nbsp;

&nbsp;

$TTL    3600

@       IN      SOA     example.com.  root.example.com.(

2010031203 ; Serial

28800      ; Refresh

14400      ; Retry

3600000    ; Expire

86400 )    ; Minimum

IN NS    ns1.example.com.

IN MX 10 mail.example.com.

@               IN A     xxx.xxx.xxx.xxx

www             IN A     xxx.xxx.xxx.xxx

ns1     IN A     xxx.xxx.xxx.xxx

*       IN A     xxx.xxx.xxx.xxx

 

  • zone(ptr)
    • 逆引きゾーン

# vim /var/named/18.212.49.in-addr.arpa

&nbsp;

&nbsp;

$TTL    3600

@       IN      SOA     ns1.example.com.  root.example.com.(

2011031102 ; Serial

7200       ; Refresh

7200       ; Retry

2419200    ; Expire

86400 )    ; Minimum

IN NS    ns1.example.com.

IN MX 10 example.com.

ns1     IN A     xxx.xxx.xxx.xxx

example.com. IN TXT "v=spf1 a mx ~all"

 

  • ゾーンファイルのチェック~サービス再起動

# /usr/sbin/named-checkzone example.com example.com.zone

# /usr/sbin/named-checkzone 49.212.18.145 18.212.49.in-addr.arpa

# /etc/rc.d/init.d/named restart

 

  • rootゾーン自動更新Shell

# cd /usr/local/sbin/

# vim named.root_update

# chmod 700 named.root_update

 

  • resolve.conf設定

$ sudo vim /etc/resolve.conf

&nbsp;

search sakura.ne.jp

nameserver 127.0.0.1

nameserver 210.224.163.3

nameserver 210.224.163.4