FreeBSD(server)


以下の内容は6.3-RELEASEの話

インストール

  • パーティションは A = Use Entire Disk
  • ラベルは da0s1a / 3851MB UFS2
    スワップ無し
  • DistributionはA Minimal
  • /etc/fstabファイル
    asyncを追加
    server# cat /etc/fstab
    # Device                Mountpoint      FStype  Options         Dump    Pass#
    /dev/ad0s1a             /               ufs     rw,async        1       1
    #/dev/acd0              /cdrom          cd9660  ro,noauto       0       0
    #/dev/ad1               /usr/tmp        ufs     rw              1       2
    #/dev/ad3               /cdrom          ufs     rw              1       3
  • /etc/rc.confファイル
    # -- sysinstall generated deltas -- # Sat May  5 19:02:33 2007
    # Created: Sat May  5 19:02:33 2007
    # Enable network daemons for user convenience.
    # Please make all changes to this file, not to /etc/defaults/rc.conf.
    # This file now contains just the overrides from /etc/defaults/rc.conf.
    defaultrouter="192.168.1.1"
    hostname="server.mydomain.ddo.jp"
    ifconfig_re0="inet 192.168.1.2  netmask 255.255.255.0 -txcsum"
    keymap="jp.106"
    keyrate="fast"
    moused_enable="YES"
    moused_port="/dev/psm0"
    moused_type="auto"
    ntpdate_enable="YES"
    ntpdate_flags="-b ntp2.plala.or.jp"
    sendmail_enable="NONE"
    sshd_enable="YES"
    
    powerd_enable="YES"
    samba_enable="YES"
    courier_authdaemond_enable="YES"
    courier_imap_imapd_enable="YES"

VMware上で時刻が進む件

  • Open Virtual Machine Toolsを入れてみる
    %fetch http://nchc.dl.sourceforge.net/sourceforge/open-vm-tools/open-vm-tools-2008.03.19-82724.tar.gz
  • 途中でXとdnet(?)が無いと言われるので除外する。
    ./configure --without-x --without-dnet
    make
    (やめた)
  • /etc/vmware/configに追記
    vmware-config.plを実行すると消えてしまうようなので注意
    host.cpukHz = 1666666
    host.noTSC = TRUE
    ptsc.noTSC = TRUE

インストールしたports(記憶にあるもの、依存関係で入ったものを除く)

courier-authlib-base-0.60.2  >  succeeds port (port has 0.59.3)
courier-imap-4.2.1,1        >  succeeds port (port has 4.1.3,1)
iperf-2.0.2_1               =  up-to-date with port
ja-kakasi-2.3.4             =  up-to-date with port
ja-samba-3.0.26a,1          >  succeeds port (port has 3.0.24,1)
kqemu-kmod-1.3.0.p11_2      >  succeeds port (port has 1.3.0.p11)
popfile-0.22.5              >  succeeds port (port has 0.22.4)
portupgrade-2.3.1,2         >  succeeds port (port has 2.2.6_3,2)
qemu-0.9.0_3                >  succeeds port (port has 0.9.0_1)
rdiff-backup-1.0.5,1        =  up-to-date with port

portsの準備

  • portsnapは標準で入っている。
    /etc/portsnap.confがあることを確認(中身は特にいじらなかった)
    server# portsnap fetch
    Looking up portsnap.FreeBSD.org mirrors... 4 mirrors found.
    Fetching public key from portsnap1.FreeBSD.org... done.
    Fetching snapshot tag from portsnap1.FreeBSD.org... done.
    Fetching snapshot metadata... done.
    Fetching snapshot generated at Sat Mar 22 09:46:03 JST 2008:
    915f29a82296a03a25b7faf8b260b48633dc6ba1f28796 57% of   51 MB  130 kBps 02m48s
    (時間がかかる)
    server# portsnap extract
    (初回のみ、これも時間がかかる)
  • アップデート方法
    server# portsnap fetch update
  • portsupgrade
    server# cd /usr/ports/ports-mgmt/portupgrade
    server# make
    server# make install
    (ESCか[Cancel]を選択してunchanged)
    server# make clean
  • 増えた
    server# portversion -v
    db41-4.1.25_4               =  up-to-date with port 
    perl-5.8.8_1                =  up-to-date with port 
    portupgrade-2.4.3_2,2       =  up-to-date with port 
    ruby-1.8.6.111_1,1          =  up-to-date with port 
    ruby18-bdb-0.6.2            =  up-to-date with port 

portsの準備(この方法は古いやりかたらしい)

  • supfileを作成
    server# cp /usr/share/examples/cvsup/ports-supfile .
    server# vi ports-supfile
  • 内容を編集
    *default host=cvsup.jp.freebsd.org
  • portsを取得(定期的、portsをインストールする前に実施する)
    server# csup ports-supfile
    (初回は時間がかかる)

DNSアップデート

  • スクリプト
    server# cat /root/dnsupdate.sh
    #
    /usr/bin/fetch -o - "http://free.ddo.jp/dnsupdate.php?dn=mydomain&pw=*******"

バックアップ

  • rdiff-backupをportsインストール
  • スクリプト
    server# cat /root/rdiffbackup.sh
    #
    /usr/local/bin/rdiff-backup --include-globbing-filelist /root/include-list / /cdrom/backup
    /bin/sync
  • 設定ファイル
    server# cat /root/include-list
    - /.snap
    - /cdrom
    - /dev
    - /media
    - /mnt
    - /proc
    - /tmp
    - /usr/ports
    - /usr/tmp
    - /var/log
  • crontab
    server# cat /etc/crontab
    # /etc/crontab - root's crontab for FreeBSD
    ...
    # for server
    0      2       *       *       *       root    /root/rdiffbackup.sh

IMAP

  • 何も考えずにportsからインストール
  • /usr/local/etc/authlib/authdaemonrcは変更なし。(authdaemonrc.distから変更なし。)
  • /usr/local/etc/courier-imap/*も変更なし。(*.distから変更なし。)
  • /etc/rc.confに追記
    courier_authdaemond_enable="YES"
    courier_imap_imapd_enable="YES"
  • sendmailで受信したメールをMaildirに振り分ける
    server# cat .forward
    "|IFS=' ' && p=/usr/local/bin/procmail && test -f $p && exec $p -Yf- || exit 75 #xxxxxxxx"
    server# cat .procmailrc 
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
    MAILDIR=$HOME/Maildir/
    DEFAULT=$MAILDIR/
    LOGFILE=$MAILDIR/procmail.log
    #SENDMAIL=/usr/local/sbin/sendmail      # postfix
    SENDMAIL=/usr/sbin/sendmail
    TIMEOUT=60
    
    :0
    $DEFAULT
    

samba

SMTP


qemu(参考)

  • rc.localファイル
    kldload aio
    kldload kqemu
    kldload bridge
    kldload if_tap
    
    sysctl -w net.link.ether.bridge.config="em0 tap0 tap1"
    sysctl -w net.link.ether.bridge.enable=1
    
    /usr/local/bin/qemu -m 512 -localtime -k ja -hda /usr/tmp/cf4g-1.img -net  nic,model=rtl8139 -net tap -boot c -vnc :1 -kernel-kqemu -daemonize
  • NICのオプションでハードウェアチェックサムを無効にする。(仮想マシンでチェックサム異常になってしまう。)
    たとえばrc.conf内で「-txcsum」をつける。

POPFile(参考)

  • rc.localファイル
    (cd /usr/local/share/popfile; perl5 popfile.pl --set html_local=0) &

ネームサーバ(参考)

  • rc.localファイル
    chmod a+w /etc/namedb/master

メディアサーバwizd(参考)

  • rc.localファイル
    (cd /root/wizd_0_12; ./wizd)

PukiWikiをインストールしてみる


Apacheインストール

  • portsからインストール(/usr/ports/www/apache22)
  • オプションデフォルト
  • 増えた
    apache-2.2.8                =  up-to-date with port
    expat-2.0.0_1               =  up-to-date with port

PHPインストール

  • portsからインストール(/usr/ports/lang/php5)
  • オプション[X] APACHE Build Apache module
  • 増えた
    libxml2-2.6.31              =  up-to-date with port
    php5-5.2.5_1                =  up-to-date with port
    pkg-config-0.23_1           =  up-to-date with port

Apache設定

  • /etc/rc.conf
    apache22_enable="YES"
  • /usr/local/etc/apache22/httpd.conf

PHPが実行されない?

  • /usr/ports/lang/php5-extensionsをインストールしてみる
    ===>  Cleaning for php5-ctype-5.2.5_1
    ===>  Cleaning for php5-dom-5.2.5_1
    ===>  Cleaning for pecl-filter-0.11.0
    ===>  Cleaning for pecl-hash-1.5
    ===>  Cleaning for php5-iconv-5.2.5_1
    ===>  Cleaning for pecl-json-1.2.1
    ===>  Cleaning for php5-pcre-5.2.5_1
    ===>  Cleaning for php5-pdo-5.2.5_1
    ===>  Cleaning for php5-pdo_sqlite-5.2.5_1
    ===>  Cleaning for php5-posix-5.2.5_1
    ===>  Cleaning for php5-session-5.2.5_1
    ===>  Cleaning for php5-simplexml-5.2.5_1
    ===>  Cleaning for php5-spl-5.2.5_1
    ===>  Cleaning for php5-sqlite-5.2.5_1
    ===>  Cleaning for php5-tokenizer-5.2.5_1
    ===>  Cleaning for php5-xml-5.2.5_1
    ===>  Cleaning for php5-xmlreader-5.2.5_1
    ===>  Cleaning for php5-xmlwriter-5.2.5_1
    ===>  Cleaning for pcre-7.6
    ===>  Cleaning for php5-extensions-1.1
pcre-7.6                    =  up-to-date with port
pecl-filter-0.11.0          =  up-to-date with port
pecl-hash-1.5               =  up-to-date with port
pecl-json-1.2.1             =  up-to-date with port
php5-ctype-5.2.5_1          =  up-to-date with port
php5-dom-5.2.5_1            =  up-to-date with port
php5-extensions-1.1         =  up-to-date with port
php5-iconv-5.2.5_1          =  up-to-date with port
php5-pcre-5.2.5_1           =  up-to-date with port
php5-pdo-5.2.5_1            =  up-to-date with port
php5-pdo_sqlite-5.2.5_1     =  up-to-date with port
php5-posix-5.2.5_1          =  up-to-date with port
php5-session-5.2.5_1        =  up-to-date with port
php5-simplexml-5.2.5_1      =  up-to-date with port
php5-spl-5.2.5_1            =  up-to-date with port
php5-sqlite-5.2.5_1         =  up-to-date with port
php5-tokenizer-5.2.5_1      =  up-to-date with port
php5-xml-5.2.5_1            =  up-to-date with port
php5-xmlreader-5.2.5_1      =  up-to-date with port
php5-xmlwriter-5.2.5_1      =  up-to-date with port

最新の20件

2008-12-27 2016-06-18 2008-05-19 2016-07-23 2016-07-14 2016-05-29 2016-05-13 2016-04-08 2008-12-27 2008-10-11 2008-09-27 2008-05-19 2008-04-19 2008-04-12
  • FreeBSD(server)
2008-02-11 2008-02-10 2008-02-09 2008-02-08 2008-02-07

今日の15件

  • counter: 172
  • today: 1
  • yesterday: 0
  • online: 1