xntpd は標準で入っているので、/etc/rc.conf に xntpd を起動する設定を記述し、xntpd の動作設定ファイル /etc/ntp.conf を作成する。
/etc/rc.conf に追加する内容:
xntpd_enable="YES" xntpd_flags=""
/etc/ntp.conf の内容:
server 133.31.180.6 driftfile /etc/ntp.drift
公開 NTP サーバは
http://www.kt.rim.or.jp/~ksakai/ntp.html
などを参照してネットワーク的に近いところを選択。
133.31.180.6 = sutntp.sut.ac.jp
# pkg_add squid-2.3.tgz
acl localnet src 192.168.1.0/255.255.255.0 acl all src 0.0.0.0/0.0.0.0 http_access allow localnet http_access deny all
ftp_user net@uminari.yi.org
cache_dir ufs /var/squid/cache 100 16 256 cache_access_log /var/squid/logs/access.log cache_log /var/squid/logs/cache.log cache_store_log /var/squid/logs/store.log pid_filename /var/run/squid.pid
cache_effective_user net cache_effective_group www
# mkdir /var/squid/cache # chown net /var/squid/cache # chgrp www /var/squid/cache # mkdir /var/squid/logs # chown net /var/squid/logs # chgrp www /var/squid/logs # /usr/local/sbin/squid -z
0 6 * * 1 /usr/local/sbin/squid -k rotate
apache をインストールする。
# pkg_add apache-1.3.12.tgz
httpd.conf に設定する。
User net Group www
ServerAdmin net@uminari.yi.org ServerName waffle.uminari.yi.org
MinSpareServers 2 MaxSpareServers 4 StartServers 2 MaxClients 64
AddType text/html .shtml AddHandler server-parsed .shtml
AddHandler cgi-script .cgi
また、.bz2 や .rar などをバイナリデータ扱いするために、 mime.conf に設定する。
application/octet-stream bin dms lha lzh exe class bz2 rar
http://uminari.yi.org/ の URL でアクセスした場合に返すデータを変えるために Name-based Virtual Host を設定する。Virtual Host 設定のためには IP アドレス情報が httpd.conf に必要であるので、上記まで設定した httpd.conf を httpd.conf.base として、 /etc/dhclient-exit-hooks で httpd.conf を生成するようにする。
#!/bin/sh cd /usr/local/etc/apache /bin/cp httpd.conf.base httpd.conf if [ x$new_ip_address != x ]; then /bin/cat<<EOF>>httpd.conf <Directory "/home/net/www"> Options MultiViews Indexes FollowSymLinks Includes ExecCGI DirectoryIndex index.shtml index.html index.htm AllowOverride AuthConfig Limit Order allow,deny Allow from all </Directory> NameVirtualHost $new_ip_address <VirtualHost $new_ip_address> DocumentRoot /usr/local/www/data ServerName $new_ip_address </VirtualHost> <VirtualHost $new_ip_address> DocumentRoot /home/net/www ServerName uminari.yi.org CustomLog "|/usr/local/sbin/rotatelogs /var/log/httpd-uminari.log 604800" combined </VirtualHost> <VirtualHost 192.168.1.1> DocumentRoot /home/net/www ServerName uminari.yi.org CustomLog "|/usr/local/sbin/rotatelogs /var/log/httpd-local.log 604800" combined </VirtualHost> EOF if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ] && \ [ -f /var/run/httpd.pid ]; then /bin/kill -USR1 `cat /var/run/httpd.pid` fi fi
postfix をインストールする。
# pkg_add postfix-19991231.08.tgz
postfix では、仮想ユーザとして postfix、グループとして postfix と maildrop を必要とする。pkg_add からも作成できるが、ID を指定できないので、 pkg_add の前にあらかじめこれらのユーザとグループを作成しておいたほうがいい。
/usr/local/etc/postfix/main.cf を編集する。
queue_directory = /var/spool/postfix command_directory = /usr/local/sbin daemon_directory = /usr/local/libexec/postfix mail_owner = postfix default_privs = nobody myhostname = waffle.uminari.yi.org mydomain = uminari.yi.org myorigin = $mydomain mydestination = $myhostname, localhost.$mydomain, $mydomain mail_spool_directory = /var/mail mailbox_command = /usr/local/bin/procmail mynetworks = 192.168.1.0/24, 127.0.0.0/8 local_destination_concurrency_limit = 2 default_destination_concurrency_limit = 10 debug_peer_level = 2 debugger_command = PATH=/usr/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5 allow_mail_to_commands = alias,forward,include relayhost = プロバイダのメールサーバ
設定のチェックを行い、問題がなければ、起動する。
# /usr/local/sbin/postfix check # /usr/local/sbin/postfix start
自動起動用のスクリプト /usr/local/etc/rc.d/postfix.sh を作成する。
#!/bin/sh if [ -x /usr/local/sbin/postfix -a -f /usr/local/etc/postfix/main.cf ]; then /usr/local/sbin/postfix start echo -n ' postfix' fi
poppoer をインストールする。
# pkg_add qpopper-2.53.tgz
/etc/inetd.conf に設定する。
pop3 stream tcp nowait root /usr/local/libexec/popper popper
# make install perl ./makefml install ---NOT USING configuration file (for the first time) THIS HOST (waffle.uminari.yi.org) IS [i386-unknown-freebsd3.5.1] ---Please Define Your Fml System Configurations Personal Use or ML-Admin-Group-Shared or fmlserv you use? Personal, Group, Fmlserv (personal/group/fmlserv) [personal] DOMAIN NAME [uminari.yi.org] FQDN [waffle.uminari.yi.org] EXEC FILES DIRECTORY [/usr/local/fml] TOP LEVEL ML DIRECTORY [/var/spool/ml] Language (Japanese or English) [English] Japanese TimeZone (TZ: e.g. +0900, -0300) [+0900]
Samba をインストールする。
# pkg_add ja-samba-2.0.5a.2.tgz
プライベートネットワークのホストに対してのみファイルアクセスを許可する。
その他のパラメータ、わりと嘘 (ぉ
いや、そのうち……
[global] server string = Gateway (samba %v) dead time = 36000 hosts allow = localhost 192.168.1. workgroup = uec encrypt passwords = yes security = user domain_master = yes preferred master = yes local master = yes os level = 65 wins support = yes client code page = 932 coding system = euc socket options = IPTOS_LOWDELAY TCP_NODELAY getwd cache = yes ; oplocks = false ; fake oplocks = no [homes] comment = Home Directories browseable = no read only = no create mode = 0644
# cd /usr/local/samba/ # mkdir private # chmod 500 private # cd /usr/src/samba-2.0.6/source/script/ # chmod 755 mksmbpasswd.sh # cat /etc/passwd | ./mksmbpasswd.sh >/usr/local/samba/private/smbpasswd